I just did this for a site awhile back.  All the pages use the same
template, but you could modify pretty easily.    Build out an array like
the one below that defines your entire site heirarchy.  In my example, I
set the url, title, alttext (for the image button), the image name (for
javascript rollovers), urls to active/inactive states for the button, and
an option image header.  The example below would create a primary
navigation consisting of "home" and "products" and products would have a
sub nav of the latter three elements.  You could easily add a "template"
variable to control what template to use.

Each of my pages then sets a variable for where it is (ie
"/products/howitworks") which is passed to a function that builds the
template, and the navigation, etc... works all right for me.

$navAry['home']->url = "/";
$navAry['home']->title = "Foobar, LLC.";
$navAry['home']->alttext = "Home";
$navAry['home']->imgname = "btn_home";
$navAry['home']->img_a = "/img/btn_home_a.gif";
$navAry['home']->img_i = "/img/btn_home_i.gif";

$navAry['products']->url = "/products/";
$navAry['products']->title = "Foobar | Products";
$navAry['products']->header = "/img/hdl_product.gif";
$navAry['products']->alttext = "The Product";
$navAry['products']->imgname = "btn_products";
$navAry['products']->img_a = "/img/btn_products_a.gif";
$navAry['products']->img_i = "/img/btn_products_i.gif";


    unset($subAry);
    $subAry['howitworks']->url = "/products/howitworks.php";
    $subAry['howitworks']->title = "Foobar | Products | How it Works";
    $subAry['howitworks']->header = "/img/hdl_product_howitworks.gif";
    $subAry['howitworks']->alttext = "How it Works";
    $subAry['howitworks']->imgname = "btn_products_howitworks";
    $subAry['howitworks']->img_a = "/img/btn_sub_howitworks_a.gif";
    $subAry['howitworks']->img_i = "/img/btn_sub_howitworks_i.gif";

    $subAry['security']->url = "/products/security.php";
    $subAry['security']->title = "Foobar | Products | Security";
    $subAry['security']->header = "/img/hdl_product_security.gif";
    $subAry['security']->alttext = "Security";
    $subAry['security']->imgname = "btn_products_security";
    $subAry['security']->img_a = "/img/btn_sub_security_a.gif";
    $subAry['security']->img_i = "/img/btn_sub_security_i.gif";

    $subAry['isplicensing']->url = "/products/isplicensing.php";
    $subAry['isplicensing']->title = "Foobar | Products | ISP Licensing";
    $subAry['isplicensing']->header = "/img/hdl_product_isp.gif";
    $subAry['isplicensing']->alttext = "ISP Licensing";
    $subAry['isplicensing']->imgname = "btn_products_isplicensing";
    $subAry['isplicensing']->img_a = "/img/btn_sub_isp_licns_a.gif";
    $subAry['isplicensing']->img_i = "/img/btn_sub_isp_licns_i.gif";

    $navAry['products']->sub = $subAry;

On Wed, 19 Dec 2001, Martin Hughes wrote:

> Heya,
>
> OK - I have a site I've been working on on and off for a while. It started
> as a static page, then I changed it so it uses php. This was great - until I
> started putting content in the design. I now have about 300 *.inc files for
> the site, and updating them is a joke!
>
> The site is designed in a heirachical way:
>
> Top
>   Section 1
>     id 1
>     id 2
>     id 3
>     id 4
>   Section 2
>     id 1
>     id 2
>     id 3
>   Section 3
>     id 1
>     id 2
>     id 3
>     id 4
> etc...
>
> I'm using 1 file for the code - index.php?sect=XX&id=XX and the nav menus
> are dynamically generated and populated on the page along with the content
> which is filled by an inc file in directory: root/php/"sectname"/"id".inc
> where "sectname" is the name of a section defined in an array in index.php
> (eg, section 6 is "synthesizers"). The images and headings on the page are
> also dynamically generated (images have a number eg "2.jpg" for the heading
> of section 2 etc.)
>
> In sections 6 though, ids 2-6 are based on one template, so i have 5 files:
> 2.inc, 3.inc, ... 6.inc all exactle the same, just containing <?
> require_once('php/synthesizers/template.inc') ?>
> This seems somewhat stupid.
>
> Oer X-Mas & New Year, I want to entirely recodethe site so it is more "user
> friendly" for me to maintain. I am slowly getting better and better at php
> so it should be good.
>
> Does ANYONE have any pointers as to how to start and do this thing. Any
> ideas for how my site should be layed out (directory-wise etc - is it easier
> to have 1 directory per section and hold everything in it - images included,
> or is it best to have a separate img/ directory??).
>
> many thanks all - Seasons greets!!
>
> Martin
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to