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
help for someone new to php
Old 03-28-2009, 07:22 PM help for someone new to php
konetch's Avatar
Ultra Talker

Posts: 258
Trades: 0
I'm new at php and want to change my current html page to php. This question is probably very simple and unintelligent, but I need to know how to create an external .php file that loads on every page. But, I need each page to look slightly different.

I want the logo, the navbar,the background and the footer to all look alike on every page, but want the content to be different.

I'm not sure if this is very clear? So, if you need me to clarify the question I will try.

Thanks

-Alex Konetchy
konetch is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-28-2009, 07:49 PM Re: help for someone new to php
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
The easiest thing to do is divide your pages in a header, a footer and then content in between them. Place the header part in a file "header.php" for example, and the footer in "footer.php". On every page, do something like this
PHP Code:
require 'path/to/header.php';

echo 
"Hello! This is the content of this page.";

require 
'path/to/footer.php'
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 03-28-2009, 07:57 PM Re: help for someone new to php
konetch's Avatar
Ultra Talker

Posts: 258
Trades: 0
ok if you want to look at my site it may help
http://www.konetchreport.com

I want to keep the entire site layout the same. I just want to change the body content, the posts.

How would I do this, because if I used your example it would look coarse.
konetch is offline
Reply With Quote
View Public Profile
 
Old 03-29-2009, 05:43 AM Re: help for someone new to php
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
Lets say your site looks like this:
Code:
<html>
<head> stuff... </head>
<body>

some menu, adds, links...

<div id="content">  
Changeable content here!
</div>

some common stuff
footer with copyright and other things...
</body>
</html>
Now, extract everything from <html> to <div id="content"> and put it in a file header.php, and everything from </div> to </html> and put in a file footer.php. Then you can apply the code in my previous post.
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Reply     « Reply to help for someone new to 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.13078 seconds with 12 queries