Guest Posted November 14, 2005 Share Posted November 14, 2005 Ok. I want to place a background image in a custom table in the left upper corner of my site that changes as I change categories. The images I want to use are my default category image I have uploaded for each category, right now with some assistance from a php'r I've got this that will grab an image based on top $cpath number, I just haven't got it to explode to the sub categories. But I've had to create a custom folder and define it in the config file and rename the images to match the cpath# How would I do it so that I can just grab the image based on the category like it shows in the default set-up but instead of <img src= it's background="? Here's how I'm doing it. At the top of my index.php just above the require(includes/application_top.php) I have.. if(isset($cPath)){ $exploded_str = explode('_', $cPath); $header_image = $exploded_str[0]; } else{ $header_image = "home"; } require('includes/application_top.php'); Then I have this coded in the place where I want the image to display as a background. <TABLE border="0" width="100%" cellpadding="0" cellspacing="0" background="<? echo DIR_WS_HEADER_IMAGES . "/$header_image.jpg"; ?>" height="221"> <TR> <TD valign="bottom" align="right"><IMG width="90" src="../../../images/theme/uimages/outcurv_BR.gif" height="90"></TD> </TR> </TABLE> I've defined the DIR_WS_HEADER_IMAGES folder in my config file But I had to make duplicates of the images and rename them to match the cpath number for the top level. Is there a better way? Please help! I now what to grab the sub-category images as well as the parent category images. what do I need to change so that it will grab more than just the top category? Would I be able to just copy all of my sub-category images to my header image folder and name them like 1_12.jpg, etc. for each sub-and sub-sub category like 1_12_1.jpg? So that it displays each default category image in that corner? Is there a change I need to make to the ifisset for that to work? If so, what is the change? here's a link to my site http://www.sugarcreektreasures.com/ So you can see what I mean. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.