Structure of a PHP-driven site

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • danep

    #1

    Structure of a PHP-driven site

    Hey everyone,

    I've been managing a few websites, all built around the same
    architecture, for several years now, but it's time to hand them off to
    someone else and I'm trying to "clean them up" before I go. It got me
    to wondering how other people structure their sites, and if mine is
    optimal.

    For instance, all of the pages on my site are accessible from one
    navigation bar with several subcategories. Each page starts by
    declaring $page_title, $page_category etc, and then including a
    standard headers file, with our logo/banner/database connection/etc,
    and finally including a second navigation bar for whatever category
    the page is in. Then you put whatever content you want on the page,
    and end it by including a standard footers file.

    I was considering moving all of the data like $page_title,
    $page_category, and the entire menu/category structure into a separate
    XML file, or an array in PHP. Then, each page would just look like
    "include(header s), page content, include(footers )", and PHP would
    simply lookup the page's file name in the XML table/array, and render
    the appropriate navigation bars, styles, whatever. Somehow the idea
    of having the entire sitemap in one XML file or array seems really
    elegant to me.

    Does this sound like a good idea? How do you usually structure your
    pages? Is it even remotely like this? I get the sense that what I'm
    doing now is a sort of a beginner's technique for building dynamic
    websites.

  • Captain Paralytic

    #2
    Re: Structure of a PHP-driven site

    On 2 Feb, 08:17, "danep" <danepow...@gma il.comwrote:
    Hey everyone,
    >
    I've been managing a few websites, all built around the same
    architecture, for several years now, but it's time to hand them off to
    someone else and I'm trying to "clean them up" before I go. It got me
    to wondering how other people structure their sites, and if mine is
    optimal.
    >
    For instance, all of the pages on my site are accessible from one
    navigation bar with several subcategories. Each page starts by
    declaring $page_title, $page_category etc, and then including a
    standard headers file, with our logo/banner/database connection/etc,
    and finally including a second navigation bar for whatever category
    the page is in. Then you put whatever content you want on the page,
    and end it by including a standard footers file.
    >
    I was considering moving all of the data like $page_title,
    $page_category, and the entire menu/category structure into a separate
    XML file, or an array in PHP. Then, each page would just look like
    "include(header s), page content, include(footers )", and PHP would
    simply lookup the page's file name in the XML table/array, and render
    the appropriate navigation bars, styles, whatever. Somehow the idea
    of having the entire sitemap in one XML file or array seems really
    elegant to me.
    >
    Does this sound like a good idea? How do you usually structure your
    pages? Is it even remotely like this? I get the sense that what I'm
    doing now is a sort of a beginner's technique for building dynamic
    websites.
    Take a look at: http://www.php-mysql-tutorial.com/cms-php-mysql.php

    Comment

    Working...