kenspants Posted February 23, 2004 Posted February 23, 2004 I want to pull my own header bar (called ddheader.htm which is in my site root) into the catalog/includes/header.php. How would I pull (using include or whatever) it in to the header.php and still keep all the paths working. I tried the code below but didn't work. (Snipit from header.php near line 60) ?<tr class="header"> ? <td align="center" valign="middle"><?php include ('../../ddheader.htm'); ??></td> <td align="right" valign="bottom"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a> <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?> </td> ?</tr> I also tried copying the ddheader.htm into the catalog/includes/ but then I have 2 versions floating around and the image paths are all screwy. Im not a php writer but Im trying to learn. Can I use require(DIR_WS_something . 'ddheader.htm') and then define the path somewhere?
detsouvalas Posted February 23, 2004 Posted February 23, 2004 Try the includes stuff again as if header.php was in the /catalog directory, so your includes statement would be like <?php include ('../ddheader.htm'); ?> Antonios Antonios
kenspants Posted February 23, 2004 Author Posted February 23, 2004 Problem. That only partially works. I see do the HTML but all my (relative) image paths in the ddheader.htm are busted. So I get no images. It is looking for http://www.domain.com/catalog/images/ddheader_r2_c1.gif and not http://www.domain.com/images/ddheader_r2_c1.gif. From the ddheader.htm's perspective, its path is relative to my /catalog/includes/header.php. :( Try the includes stuff again as if header.php was in the /catalog directory, so your includes statement would be like <?php include ('../ddheader.htm'); ??> Antonios
ptrau Posted February 23, 2004 Posted February 23, 2004 try the entire path: <?php include('path/to/your/actual/header/file.html');?> "Aliiiiive, it's alive, it's ALIIIIIIIIIIIIIVE!!!"
kenspants Posted February 23, 2004 Author Posted February 23, 2004 try the entire path: <?PHP include('path/to/your/actual/header/file.HTML');?> That results in the same problem. The HTML file still comes up but the image files don't load cuz of the base reference. I was hoping some PHP genius knew a way around this dilemma.
detsouvalas Posted February 23, 2004 Posted February 23, 2004 I don't think that it is a real PHP problem, but rather an HTML coding problem! You have to see the matter from the perspective of your php script! By including a file (which is in the root directory) in to your script (which 'physically' is in /catalog), it is as if the file in question was also in the /catalog directory! That's why it looks for the relative image path images in /root/catalog and not in /root! (It's not a technical explaination, but it behaves like that!) Try changing the image path in the html file to ../images/filename, or use an absolute path! Antonios B) Antonios
Recommended Posts
Archived
This topic is now archived and is closed to further replies.