|
|
|
|
![]() ![]() |
Jan 30 2008, 10:20 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 416 Joined: 26-January 08 Member No.: 56,881 |
(If I am posting this in the wrong forum, please tell me the correct place to be putting it.)
I want to install a global announcement banner on the top my website, in case there is some major update. I am currently learning PHP for this very purpose, and would like to ask how it is made. (I know how the HTML layout is going to look like, I just want to be able to actually include the PHP portion on the website.) I heard it had something to do with includes in PHP... how exactly does this work? |
|
|
|
Jan 30 2008, 10:32 PM
Post
#2
|
|
|
|||[ n00b King ]||| ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 643 Joined: 20-June 07 From: Auckland Member No.: 45,102 |
all it is is just a section of code being included. THat section of code can be what ever you'd like included and you can place it where ever you like
for example index.php --------------- *page start *include('stuff.php'); *page end --------------- thats how it works. You can apply includes to all individual files you want included or you can make 1 template and include it there, that way the template can be used for all your web pages. |
|
|
|
Jan 30 2008, 11:34 PM
Post
#3
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 416 Joined: 26-January 08 Member No.: 56,881 |
all it is is just a section of code being included. THat section of code can be what ever you'd like included and you can place it where ever you like for example index.php --------------- *page start *include('stuff.php'); *page end --------------- thats how it works. You can apply includes to all individual files you want included or you can make 1 template and include it there, that way the template can be used for all your web pages. For some reason, I remember the manual saying that the PHP stuff like that was only for header files. I'll try that, though, and see if it works. |
|
|
|
Jan 30 2008, 11:39 PM
Post
#4
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 775 Joined: 13-April 07 From: mreža Member No.: 41,558 |
Yes you are right but the thing is that you have to include all files and start sessions and other cookies before you send any header information. However if you like to make different sections and models of code like me then you would include code in method or function and then simply call the function in the part of code where you need it in fact.
|
|
|
|
Jan 31 2008, 05:46 PM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 416 Joined: 26-January 08 Member No.: 56,881 |
Yes you are right but the thing is that you have to include all files and start sessions and other cookies before you send any header information. However if you like to make different sections and models of code like me then you would include code in method or function and then simply call the function in the part of code where you need it in fact. I don't actually need it for functions. I just want to include a sidebar. |
|
|
|
Jan 31 2008, 08:43 PM
Post
#6
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,882 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
Design your html page with the sidebars as you want them.
Instead of adding the content to the div for the sidebar, do the php include as per above for that div. Make sure the page has a php file extension and not an html extension. (Or mod your htaccess file to have html pages parsed as php.) |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 26th July 2008 - 06:41 AM |