Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 02-07-2010, 03:09 AM nav bars with php
TheDon's Avatar
Extreme Talker

Posts: 216
Name: Don
Trades: 0
Hi all,
I am watching a tutorials on php but would like to know how I can have my nav bars in a external php file and embed it into the main website.
I want this as I change my menu every few months and this would help me alot as I will not have to change every single page.

__________________
[
Please login or register to view this content. Registration is FREE
] [
Please login or register to view this content. Registration is FREE
] [
Please login or register to view this content. Registration is FREE
]
TheDon is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-07-2010, 03:18 AM Re: nav bars with php
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Just create a common nav bar (this usually applies to headers and footers as well), and include it:

http://us2.php.net/manual/en/function.include.php

Ex:
PHP Code:
include('sidebar.php'); 
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 02-07-2010, 08:57 PM Re: nav bars with php
TheDon's Avatar
Extreme Talker

Posts: 216
Name: Don
Trades: 0
ok, so I can copy the code from my homepage, paste it into a file say verticlenav.php and the same with the horizontal nav.
Do I need to change the index.html to index.php ?
__________________
[
Please login or register to view this content. Registration is FREE
] [
Please login or register to view this content. Registration is FREE
] [
Please login or register to view this content. Registration is FREE
]
TheDon is offline
Reply With Quote
View Public Profile
 
Old 02-07-2010, 09:50 PM Re: nav bars with php
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Yes, you need to change your index file to a .php file. You're index.php file should look something like this:
PHP Code:
<?php
include('nav.php');
?>

your index html code here
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to nav bars with php
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13922 seconds with 12 queries