Jump to content


alternative way to include header /footer etc


4 replies to this topic

#1 trs21219

    Young Padawan

  • Members
  • Pip
  • 31 posts
  • Gender:Male
  • Location:Pittsburgh, Pa

Posted 12 May 2007 - 10:26 PM

ok im used to using php to include files such as the header and footer and then using switch statements to pull the content into the middle these. this makes all the pages look alike and nice.

i was looking at sites such as www.redvsblue.com and noticed that their pages dont all stay on the same page but all look alike (they pull thier header footer and sidebars etc without staying on the same page (ex. index.php)

do they use php include() or are they using some other way to pull their other pages in? i just like the way that it can go to for example (sitename.com/members/memberlist.php) without looing like this (index.php?act=members&page=memberlist (the way mine looks))

#2 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 13 May 2007 - 01:24 AM

well, in the case of "sitename.com/members/memberlist.php" I doubt they are doing anything with mod_rewrite, which is a possibility to make it appear as though it is going to individual pages when it isn't.

It is also possible that they are including the headers and footers on those pages as well.

#3 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 13 May 2007 - 02:08 AM

Honestly, it would surprise me more if they were not using mod_rewrite than if they were.

When you ask for alternatives to this, and you're working with php, you'll have to keep one thing in mind. There are litterally hundreds of different ways to do this. A couple of includes and a switch() is the most basic of which and inteneded for elementary level programmers (no offense). Template class are a few steps further up the chain and by far more fun to work with. But don't expect to be able to write or even comprehend one right off the bat. I even struggled to get mine working, and am still struggling with revising a few features.

#4 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 13 May 2007 - 10:46 AM

Ya, I would agree with rc, there are tons of ways to do it.

I just recently studied how php.net does it, and I rather liked it, so I 'adopted' their method.

If you can make an sense of it on your own, you can see how they build their pages here. Thats the main layout file atleast, there are tons of other files they use and such as you can see on the left panel. I really like how they built it so that they could include as many columns and wrappers as they need on any page, and its all without using a complex template system.

#5 trs21219

    Young Padawan

  • Members
  • Pip
  • 31 posts
  • Gender:Male
  • Location:Pittsburgh, Pa

Posted 13 May 2007 - 12:20 PM

View Postrc69, on May 13 2007, 03:08 AM, said:

Honestly, it would surprise me more if they were not using mod_rewrite than if they were.

When you ask for alternatives to this, and you're working with php, you'll have to keep one thing in mind. There are litterally hundreds of different ways to do this. A couple of includes and a switch() is the most basic of which and inteneded for elementary level programmers (no offense). Template class are a few steps further up the chain and by far more fun to work with. But don't expect to be able to write or even comprehend one right off the bat. I even struggled to get mine working, and am still struggling with revising a few features.

i take no offense by that because i am an elementry level programmer. i just got into php about 2 or 3 months ago. thank you all for your help and i will be sure to look around like at the php.net site and see what they have done.

quick question... is template class what IPB uses with IPSClass??

:friends:

Edited by trs21219, 13 May 2007 - 12:36 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users