[Phpwm] Site Structure

Matt Harris mharrisweb at yahoo.co.uk
Sat Dec 10 15:03:38 GMT 2005


Hi Guys,
  
  I've thought about going with something like this (see below). 
  
  My main index has two sets of includes, the action pages that talk to  the Db are included at the top of my page, before other output, so I  can use the header redirect. The other pages that include html/ output  are included in the content div.
  
  Does that look ok?
  
  Thanks again
  
  Matt
  
  ----------------------------index.php-----------------------------------
  <?php
  // db functions
  include_once "common_db.php";
  // include action pages before other output to enable redirect
  $page = (!empty($_GET['page'])) ? $_GET['page'] : null ;
  switch ($page){
  case 'addeventaction':
     include('addeventaction.php');
     break;
  }
  ?>
  <html>
  <head>
  <style media="all" type="text/css">
  #menu{
  width:25%;
  float:left;}
  #content{
  width:75%;
  float:left;}
  .horiz li{
  display: inline;
  }
  </style> 
  </head>
  <body> 
  <div id="menu"> 
    <ul> 
      <li><a href="index.php?page=addevent">add event</a></li> 
      <li><a href="index.php?page=test">add event</a></li> 
      <li>link</li> 
      <li>link</li> 
      <li>link</li> 
      <li>link</li> 
    </ul> 
  </div> 
  <div id="content"> 
  <?php
   // include other pages that dont use redirects
  $page = (!empty($_GET['page'])) ? $_GET['page'] : null ;
  switch ($page){
  case 'addevent':
     include('addevent.php');
     break;
  default:
     include("welcome.php");
  } 
  ?>
  </div> 
  </body>
  </html>
  
  
  

Greg Morley <greg.morley at hyperreality.net> wrote:                  Not exactly on-target with this,  but related to the theme of the current thread:
  
  "Defining CSS constants using PHP" :  http://tylerhall.ws/css/constants/  (via digg.com)
  
  Pretty useful.
  
  Greg.
  
  
  
  
  David Goodwin wrote:      
Joe Beard wrote :
  
          
 My current site has just one skin.php file which contains header,
footer and body functions, which I can then supply content to, or
alter to become page specific, so a general file takes on the form:

include("/functions/skin.php");
page_header();
page_body_title("This is a Page");
page_body_content("Some content here");
page_footer();

but this means I can then call the functions for different purposes,
for example 90% of my site doesn't use frames, but I have a cgiirc
forum, so that page has frames that contain the page_header() function
with arguments to return just the side bar for example.
    
        

I used nearly exactly the same with a previous employer's website; 
although I defined e.g. $title before calling page_header() (perhaps I
should have passed $title as an argument in instead?) to provide custom
titles etc for pages.

I found it worked quite well, at least from a code reuse point of
view....

David.

  
    _______________________________________________
Phpwm mailing list
Phpwm at mailman.lug.org.uk
http://mailman.lug.org.uk/mailman/listinfo/phpwm



		
---------------------------------
Yahoo! Messenger  NEW - crystal clear PC to PC calling worldwide with voicemail 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/phpwm/attachments/20051210/47ccfa43/attachment.html


More information about the Phpwm mailing list