Shoutbox

HTML/PHP Advice - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: HTML/PHP Advice (/showthread.php?tid=73610)

HTML/PHP Advice by albert on 04-15-2007 at 03:13 AM

For a long time I've been using Iframes to code my websites, and although it does work properly, everyone seems to say that this is no way close to be the best way to put both pages together.

My question is what alternative do you have for it then? I don't want to put the menu on every page, since the menu changes every here and then, so what method should I opt for?

If I remember correctly there's someway to do it with PHP with an include or something.. But I don't know if I'm remembering correctly or if I'm just mixing something with something else..

Thanks for your reply.


RE: HTML/PHP Advice by wj on 04-15-2007 at 03:17 AM

You could do it eaisly with this:

<?php
include 'menu.php';
?>

That would add the contents of menu.php where you put that code.

That what you're trying to accomplish?


RE: HTML/PHP Advice by albert on 04-15-2007 at 03:19 AM

quote:
Originally posted by wj
You could do it eaisly with this:

<?php
include 'menu.php';
?>

That would add the contents of menu.php where you put that code.

That what you're trying to accomplish?

Yes, but I didn't seem to be able to do this earlier.. I'll try it right away, thanks for the advice.

Question though, will that only put the text, or the design as well?

Yay it worked!
RE: HTML/PHP Advice by Volv on 04-15-2007 at 01:47 PM

quote:
Originally posted by alby
Question though, will that only put the text, or the design as well?
It is exactly the same as copying the contents of menu.php to the place where you type the "include 'menu.php'" including any html formatting, php code etc.
RE: HTML/PHP Advice by Matti on 04-15-2007 at 05:06 PM

The "include" function reads the file and adds its contents on the current position in the document. Therefore, make sure you don't have any <html> or <body> tags in the menu.php file. ;)