Best Practice for a dynamic site

    Date: 12/12/05 (PHP Community)    Keywords: php

    I've recently started developing page's in a more "dynamic" way. So instead of having 1 page that for each page of content I would have 1 index page that simply reference's other pages and then variable's to control the content.
    Example
    First off I have a $_POST variable called $p, this basically control's which page you want to access. I then pipe this though an If...Then loop
    eg
    pagchg.php

    <.?.php
    if ($p == 1) {
    include ('includes/mainpage.php');
    } elseif ($p == 2) {
    include ('includes/page2.php');
    }
    ?.>


    In each "selected" page I just have the main content eg

    <.?.php
    print "

    Test
    ";
    ?.>

    And then the menu would be something like

    <.a href='?p=1'>Test1


    <.a href='?p=2'>Test2

    The main index.php page would just reference page's like

    <.?.php
    include_once('includes/header.php');
    include_once('includes/pagechg.php');
    include_once('includes/footer.php');
    ?.>

    What I want to know is, is this a safe method of creating a dynamic site. I do use htaccess so the user would see somesite.com/somepage instead of somesite.com/?p=1. If this isn't safe what is a safer method?

    Thanks again for any replies

    Source: http://www.livejournal.com/community/php/378469.html

« regular expressions || Query Help »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home