For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > April 2004 > Include Files Solution









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Include Files Solution
Robert Sossomon

2004-04-22, 2:33 pm

Here's the solution I came up with that works for the site:

<code snippet>
$display_block .= "<?php\n";
$display_block .= "\n include(\"../nav/top_nav.html\");";
$display_block .= "\n";
$display_block .= " include(\"../nav/side_nav.html\");";
$display_block .= " \n?>";
<end code snippet>

I am only using the PHP parser once instead of twice, the \n makes the
whole thing nicely readable in the HTML source files that are generated,
and the paths were modified (and the navigation templates were as well)
to give the correct paths to all the images and files concerned.

The biggest reason I had path problems was that I set the page
generation in the home directory, the generated pages in their own
directory (as well as the rest of the pieces of the online catalog quote
request form) and the navigation sits in it's own directory off the root
folder.

/
page generation
/catalog
pages
/nav
templates
/images
images
/product_images
images

What had me perplexed was I coded the product images correctly to work
right from the beginning with the leading '/' character and so since I
did it correct at the beginning it should hold true that I coded it
correctly throughout, right? WRONG! I completely bungled the whole
paths and was left with a bunch of garbage. Now I have the paths all
loaded correctly, the templates were all modified to call images and
pages with a leading '/' character, and everything is working fluidly.

Now I'm ready to call it a w and go to the beach!!! Who's with me?!

BTW, if you want to see the output pages then feel free to click here:
http://www.pfssales.com/catalog.html and click on any of the links.

Robert
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com