Jump to content

holladb

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

holladb's Achievements

Member

Member (2/5)

0

Reputation

  1. no luck yet...
  2. anybody anybody?
  3. Prior to turning off all errors i was receiving one error notice. But it didn't seem to be an issue with the pages it showed up on as all the functions were working. php Notice: Undefined variable:
  4. the code generating the images is fine. it does that. tested and works. As far as it holding the data, yes it does. The function responsible for pulling the image from the database however does not work. function getImage($table, $value) { if ($value == '') { return array(); } eval('$path = '.strtoupper($table.'_path').';'); $path = FILES_PATH.$path; $file_name = $path.$value; if (file_exists($file_name)) { $file_info = getimagesize($file_name); return array( 'src' => '/'.$file_name, 'width' => $file_info[0], 'height' => $file_info[1], ); } return array(); } I did a little test just changing the above to something standard like "/files.jpg"; and it outputted src=/ It looks like some where there is an error where it's only allow the variable to handle 1 character.
  5. gd lib works fine, the problem is it's not transferring over the $file_info['src'].
  6. did that, didn't really see any major issues that would make it not work. I'm thinking more along the lines of apache possibly.
  7. Hey i cant figure this out. I just got a new debian server for our client using PHP5 and the GD Library. My problem is that I can't figure out why one of the tables isn't pulling from the database. http://www.idealclothing.net everything is fine and the images work. On our offline new debian server everything works fine except the images. We're using a custom templating system. The code doesn't seem to be transfering over the "src" on the new server. Here is the code where it's supposed to be pulling. <? require_once 'inc/config.inc.php'; $id = intval($id); $db->setTable($GLOBALS['t_items']); $irow = $db->get("id='$id'"); //echo $id; exit; //echo "<pre>"; print_r($irow); exit; $no_list = $db->get("id='".$irow['categories_id']."'", 'is_no_list', $GLOBALS['t_categories']); $tpl->loadTemplatefile('contentb'); $db->setTable($GLOBALS['t_brands']); $rows = $db->select("categories_id='".$irow['categories_id']."' and name!=''", 'name'); $alias = $db->get('id='.intval($irow['categories_id']), 'alias', $GLOBALS['t_categories']); if (isset($rows)&&is_array($rows)) { if ($no_list != 1 && $irow['brandid'] != '') { array_unshift($rows, array('category_alias'=> $alias, 'name' => 'All')); } foreach ($rows as $row) { $row[name] = str_replace(' ', ' ', $row[name]); if ($irow['brandid'] == $row['id']) { $tpl->setCurrentBlock('brands_active_link'); $tpl->setVariable(array( 'category_alias'=> $alias, 'alias' => $row['alias'], 'name' => $row['name'], 'is_new' => ($row['is_new'])?'':null, 'is_clearance' => ($row['is_clearance'])?'':null )); } else { $tpl->setCurrentBlock('brands_inactive_row'); $tpl->setVariable(array( 'category_alias'=> $alias, 'alias' => $row['alias'], 'name' => $row['name'], 'is_new' => ($row['is_new'])?'':null, 'is_clearance' => ($row['is_clearance'])?'':null )); } $tpl->parseCurrentBlock(); $tpl->setCurrentBlock('brands'); $tpl->parseCurrentBlock(); } } $contentb = $tpl->get(); $row = $irow; $multiple_images = false; $tpl->loadTemplatefile('item_new'); $file_info = getImage('items', $row['image']); if ($file_info['src'] != '') { $first_src = $file_info['src']; $row['src'] = $file_info['src']; $row['width'] = $file_info['width']; $row['height'] = $file_info['height']; } //echo "<pre>"; print_r($row); exit; $row['is_new'] = ($row['is_new'])?'':null; $row['is_sale'] = (($row['is_sale']) ? (($row['original_price'] > 0) ? ('(Original Price: &#36;'.$row['original_price'].')') : "") : null); $row['description'] = nl2br($row['description']); $row['from_date'] = ($row['from_date'] == '' || $row['from_date'] == '0000-00-00')?null:dateFormat($row['from_date']); $row['to_date'] = ($row['to_date'] == '' || $row['to_date'] == '0000-00-00')?null:dateFormat($row['to_date']); $file_info = getImage('items', $row['second']); if ($file_info['src']) { $tpl->setCurrentBlock('second_image'); $multiple_images = true; $im = array(); $im['src'] = $file_info['src']; $im['id'] = $id; if((int)$_GET['image'] == 2) { $row['src'] = $file_info['src']; } $tpl->setVariable($im); $tpl->parseCurrentBlock(); } $file_info = getImage('items', $row['third']); if ($file_info['src']) { $tpl->setCurrentBlock('third_image'); $multiple_images = true; $im = array(); $im['src'] = $file_info['src']; $im['id'] = $id; if((int)$_GET['image'] == 3) { $row['src'] = $file_info['src']; } $tpl->setVariable($im); $tpl->parseCurrentBlock(); } $file_info = getImage('items', $row['fourth']); if ($file_info['src']) { $tpl->setCurrentBlock('fourth_image'); $multiple_images = true; $im = array(); $im['src'] = $file_info['src']; $im['id'] = $id; if((int)$_GET['image'] == 4) { $row['src'] = $file_info['src']; } $tpl->setVariable($im); $tpl->parseCurrentBlock(); } $file_info = getImage('items', $row['fifth']); if ($file_info['src']) { $tpl->setCurrentBlock('fifth_image'); $multiple_images = true; $im = array(); $im['src'] = $file_info['src']; $im['id'] = $id; if((int)$_GET['image'] == 5) { $row['src'] = $file_info['src']; } $tpl->setVariable($im); $tpl->parseCurrentBlock(); } $file_info = getImage('items', $row['swatch']); if ($file_info['src']) { $tpl->setCurrentBlock('swatch_image'); $im = array(); $im['src'] = $file_info['src']; if($row['swatch_text']) { $im['swatch_text_message'] = nl2br($row['swatch_text']); } else { $im['swatch_text_message'] = 'Color Swatch'; } $tpl->setVariable($im); $tpl->parseCurrentBlock(); } // Only display the first thumbnail if there are others... if ($row['src'] && $multiple_images) { $tpl->setCurrentBlock('first_image'); $im = array(); $im['src'] = $first_src; $im['id'] = $id; $tpl->setVariable($im); $tpl->parseCurrentBlock(); } for ($i=1;$i<=5;$i++) { $db->setTable($GLOBALS['t_items_params']); $prows = $db->select("items_id='".$row['id']."' AND params_id='$i'", 'id'); // sort($prows); // echo "<pre>"; print_r($prows); $options = ''; $list = ''; if (isset($prows) && is_array($prows)) { foreach ($prows as $prow) { $options .= '<option value="'.$prow[name].'">'.$prow[name]; if ($list != '') $list .= ','; $list .= $prow[name]; } } $row['param'.$i.'_name'] = $ITEMS_PARAMS[$i]; $row['param'.$i.'_options'] = $options; } $brand_data = $db->get("id='".intval($row['brandid'])."'", '', $GLOBALS['t_brands']); $stext = $db->get("id='".$brand_data['size_charts_id']."'", 'text', $GLOBALS['t_size_charts']); if ($stext == '') { unset($row['brandid']); } $tpl->setVariable($row); $_SESSION['ideal_back'] = 'item.php?id='.$id; $item_id = $id; parseGlobal('global', $contentb); $db->disconnect(); $tpl->show(); ?>
  8. Found the solution, I'm a moron and forgot to turn RewriteEngine on in apache!
  9. I made the INI file a replica of the PHP4 ini file. Here is an example of the code used to display: require_once 'inc/config.inc.php'; $tpl->loadTemplatefile('page'); $db->setTable($GLOBALS['t_contents']); if ($id != '') { $page = $db->get("id='".intval($id)."'", array('id', 'title', 'text')); } if ($alias != '') { $page = $db->get("alias='".mysql_escape_string($alias)."'", array('id', 'title', 'text')); } $tpl->setVariable(array( 'TEXT' => $page['text'] )); parseGlobal('global', '', 'page', $page['id']); $db->disconnect(); $tpl->show();
  10. For the life of me i can't figure this out... I have a website that was running on PHP4 just fine. Now that we're transferring the website to a dedicated PHP5 server it fails to work. http://www.idealclothing.net <--PHP4 The PHP5 server is offline... On the PHP4 server we are using a templating system. The admin side is also using a templating system. The admin template system works fine but the user side fails to work. Lets say you click on "About Us" it goes to idealclothing.net/about. Works fine on PHP4 but on PHP5 i get a 404 error. Does anybody know how to fix this??
  11. I have a variable being sent over and i need to grab the first 2 characters...i've tried a couple different things but nothing seems to work. Here is what i had last: $code1 = $_POST['code1']; $a = count_chars($code1, 2); foreach (count_chars($code1,1) as $i => $val) { $item .= chr($i).","; } //$item = sort($item); $c = array($item); echo $c; echo $item; //echo "<b>".$1."<b>".$2; echo $a; Now this way works in the sense that it puts it in an array and i will be able to explode it and list each variable but it mixes up the format. For instance if the post variable of code1 was AB12 it would put 21ba. So that wont work. Anybody have a solution??
  12. Can somebody help me? I'm trying to display the $color with the corresponding $id. My cart is setup like $id-$color, So the items become separated by commas and the variables become separated by dashes. I'm in crunch time on this project, the website needs to be live tomorrow so it is up for black friday. Please help! Below is my code: function showCart() { global $db; $cart = $_SESSION['cart']; print($cart); if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $new = explode('-',$item); list($id, $color) = $new; $contents[$id] = (isset($contents[$id])) ? $contents[$id] + 1 : 1; $contents[$id] = $contents[$color]; $content .= $color; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { foreach ($contents as $id=>$co) { print_r($contents); echo $co; $sql = 'SELECT * FROM products WHERE cereal = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = '<td>'.$row['itemcode'].' - '.$co.'</td>'; $output[] = '<td>$'.$row['pricemiddle'].'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td>$'.($row['pricemiddle'] * $qty).'</td>'; $total += $row['pricemiddle'] * $qty; $output[] = '</tr>'; } } $output[] = '</table>'; $output[] = '<p>Grand total: <strong>$'.$total.'</strong></p>'; $output[] = '<div><input type="image" src="images/buttons/update.gif" border="0"> <a href="checkout.php"><img src="images/buttons/checkout.gif" border="0"></a></div>'; $output[] = '</form>'; } else { $output[] = '<p>Your shopping cart is empty.</p>'; } return join('',$output); }
  13. yeah that'll work thanks any way kids!
  14. i just thought about this a little bit, what if i put all of the data into 1 array... like $do = array(1F-Black-167,2F-Yellow-192); //and explode it $it = explode(',',$do); foreach($it as $i) { $new = explode('-',$i); echo $new; } But how would i get it to explode that data and set each $new as a separate variable?
  15. Hey fellas. I have a shopping cart script and i need to add product attributes. I have the attributes added to a separate array from the cart items. The color attribute is going in fine. The only problem is displaying. My problem: Say you added a product called 1F with the color yellow, you go back and add 2F with the color black. In your cart now you see: 1F - Yellow : price 1F - Black : price 2f - Yellow : price 2f - Black : price Does anybody have an idea of how i can properly display my attributes or have a better way of doing this! function showCart() { global $db; $cart = $_SESSION['cart']; $attributes = $_SESSION['attributes']; print($attributes); if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $at = explode(',',$attributes); $content = array(); foreach ($at as $a) { $content[$a] = (isset($content[$a])) ? $content[$a] + 1 : 1; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { foreach ($content as $att=>$qty2) { $sql = 'SELECT * FROM products WHERE cereal = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = '<td>'.$row['itemcode'].' - '.$att.'</td>'; $output[] = '<td>$'.$row['pricemiddle'].'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td>$'.($row['pricemiddle'] * $qty).'</td>'; $total += $row['pricemiddle'] * $qty; $output[] = '</tr>'; } } $output[] = '</table>'; $output[] = '<p>Grand total: <strong>$'.$total.'</strong></p>'; $output[] = '<div><input type="image" src="images/buttons/update.gif" border="0"> <a href="checkout.php"><img src="images/buttons/checkout.gif" border="0"></a></div>'; $output[] = '</form>'; } else { $output[] = '<p>Your shopping cart is empty.</p>'; } return join('',$output); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.