Page 1 of 1

Template problem

Posted: Sun Oct 22, 2006 12:56 pm
by pedro84
Hello Again:)


I have splitted my source for the files:
header.php
content.php
footer.php
menu.php

Source [part]:

Code: Select all

<div id="bckg"></div>

<div id="left">

<div id="menu">
<ul class="menu_t">
<li class="menu_item_lefth">&nbsp;Michael-Schenker.com</li>

My source is div based.


I have serious problems with my template. I don't know where I have to include files to make pages with different content. Do I have to put my tamplate in index.php? Or can it be juest like I've splitted it?
header.php
content.php
footer.php
menu.php?

I have read many tutorials but I haven't found what I'm looking for [Smiley U2]


Thanks in advance for help
Greetings
Pedro

Posted: Sun Oct 22, 2006 1:28 pm
by andym01480
Not a hugely clear question but here goes...

I am assuming you have a CSS file with the layout for your various divs?

If you have a different file for each of your content pages, you could do something like this....

index.php

Code: Select all

<?php
include("header.php");
include("menu.php");
//calling your content depending on the url variable pageid
if (isset($_GET['pageid'])){
switch ($_GET['pageid']) {
case 1:
    include("content1.php");
   break;
case 2:
   include("content2.php");
   break;
case 3:
include ("content3.php"); 
  break;      
default:
      include("content1.php"); // this stops pageid to be set by the user trying to break your script
}
}
else {
include ("content1.php");  //this one allows for just index.php to get default page
}

include("footer.php");
?>
Then you make...

content1.php with the content for page 1
content2.php with the content for page 2
etc

Your pages are called by the menu with urls like
index.php - which yanks up content1.php as the content
index.php?pageid=1 for content 1
index.php?pageid=2 for content 2
index.php?pageid=3 for content 3...

You could use this kind of layout to pull the page contents from a database!

Each of your include files contains the <div id=foo>Bar</div> etc

The header.php includes doctype, head, body tags
and the footer.php closes off the html
Hope that helps

Posted: Sun Oct 22, 2006 1:32 pm
by pedro84
Oh my God!!

THANK YOU

Posted: Sun Oct 22, 2006 2:02 pm
by pedro84
One more: how to put content files in subfolders? What will be path?

Posted: Sun Oct 22, 2006 2:31 pm
by John Cartwright
yoursubdirectory/ :?