single php-file page with include???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bergie
Forum Newbie
Posts: 2
Joined: Mon Nov 18, 2002 5:36 am

single php-file page with include???

Post by bergie »

Hi,

at the moment im developing a litte page just for fun, it looks like this:

-there is 1 single phpfile (index.php)
-the secion ist selected by giving a variable named content
(f.e.: index.php?content=news)
- i have a funtion drawcontent() which checks what the var "$content" is an displays the content by including a file
f.e.: if ($content == "news")
include ("news.php")

ok, my question? is it a stupid way to handle? (be polite *g*). is it bad vor the webserver etc? is there another more simple way?

p.s.: i dont want frames and i have seen there ARE a few pages handling there content with only one file

thanks a lot!
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you like the way that this works for you then there really isn't anything wrong with the approach - and as you've noticed it's a fairly common way of doing dynamic sites.

This may be of interest to you:
viewtopic.php?t=3262&highlight=include+header+footer

Mac
bergie
Forum Newbie
Posts: 2
Joined: Mon Nov 18, 2002 5:36 am

Post by bergie »

as i said before: thx a lot
-> close
Post Reply