You are here: Re: Header link advice « HTML « IT news, forums, messages
Re: Header link advice

Posted by Jim Moe on 09/20/07 18:14

Confused but working on it wrote:
>
> I have a reasonably simple site hat I've started to organize a bit
> better. Most everything was in the main directory, same as the index
> file. I use a header and footer PHP include on every page and just
> realized that the links in my header file give a 404 error.
> From the index page I link to /dogs/poodles/poodles.php

> In poodles.php i include:
> <?php include("../../header.php"); ?>
> The ../../ get the header file from the main directory of the site.
>
> So now the header thinks the other site files are in the poodles
> directory when in reality most are still in the same as index.
>
Another option is to define a base directory variable in a common file
that all pages include:

require('/path/to/base-paths.inc');
$phpbase = '/path/to/root/of/php/code/';

Then all includes are accessed by:
include($phpbase . 'file.php');

The advantage here is the option to have other common or global
variables defined in <base-paths.inc> that may not be related directly to PHP.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация