Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> How Do I Include A Php Sidebar In My Website?, This is a question about PHP...
tricky77puzzle
post 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?
Go to the top of the page
 
+Quote Post
sonesay
post 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.
Go to the top of the page
 
+Quote Post
tricky77puzzle
post Jan 30 2008, 11:34 PM
Post #3


Super Member
*********

Group: [HOSTED]
Posts: 416
Joined: 26-January 08
Member No.: 56,881



QUOTE(sonesay @ Jan 30 2008, 05:32 PM) *
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.
Go to the top of the page
 
+Quote Post
hitmanblood
post 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.
Go to the top of the page
 
+Quote Post
tricky77puzzle
post Jan 31 2008, 05:46 PM
Post #5


Super Member
*********

Group: [HOSTED]
Posts: 416
Joined: 26-January 08
Member No.: 56,881



QUOTE(hitmanblood @ Jan 30 2008, 06:39 PM) *
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.
Go to the top of the page
 
+Quote Post
jlhaslip
post 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 Icon

Group: [MODERATOR]
Posts: 3,882
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



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.)
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. The Most Annoying Website(57)
  2. The Best And Free Website/html Editors + Text Editors(48)
  3. Give Me Website Ideas..(30)
  4. Oldest Website?(37)
  5. One Website = Google Adsense + Adbrite(7)
  6. Excellent Free Website Templates(16)
  7. Read File (.txt) On Another Website Using Jsp?(3)
  8. Innovative Login System(17)
  9. Runescape 2 Website(55)
  10. What Are The Steps To Making A Website?(15)
  11. Adding Your Website To Google(20)
  12. Php Scripts And Website Templates(6)
  13. I Need A Review On My Website(12)
  14. I Am Looking Into Going With A Paid Hosting Service And Trap17 Has Been Good To Me So Whats The Paid Hosting's Website?(7)
  15. Flash Media Into Html/css Website(1)
  1. Creating A Good Website, How?!(18)
  2. Basic Of Website Creation(6)
  3. Website/blog Layout (circle Design)(2)
  4. Has Anyone Designed A Website For A Wow Guild?(0)
  5. Best Way To Make Money From Your Website?(5)
  6. Free Domains For Bloggers(3)
  7. Website Optimization Help(0)
  8. Need Help To Increase The Page Rank Of Website!(2)
  9. I Can && Cannot Acces My Website(4)
  10. I Cannot See My Website Or Log Into Cpanel(7)
  11. Which Mail For My Website?(3)
  12. Postage Costs Problem For My Website(4)
  13. Free Web Hosting: (klusk) [screened](1)


 



- Lo-Fi Version Time is now: 26th July 2008 - 06:41 AM