Left Quote    I have not failed. I've just found 10,000 ways that won't work.
- Thomas Alva Edison    
Right Quote
[login] | [Register]

Site Design Made Simple

by: Superterran
Page: 3 of 4
(View All)


this puts all the sections that make the interface in separate files. To assemble the interface, we will use some basic php. This will put the file above back together.

Put this text in a html or php file, such as 'assemble.php'

the ' <? And ?> tells the server to run php code. The include function tells the server to add the code in that file to the code in the file its running (in our case assemble.php). This way the files are easily manageable.

If you run that script, you will see that it looks just like the same as the original html file did. Pretty nifty eh?

You can take this farther though. If you want to add extra content, then all you need to do is make another page (for example like home.php or something) and place the body of the page in there. Like your welcoming message, what ever news items you want, stuff like that. Then, all you have to do is replace the body.php inside the include tag with home.php. And then save that version of assemble.php to something else. This makes site management a lot easier.

I'm going to take this one step further for you, then your on your own. You don't want all your pages to have the same title do you? If not, I recommend you doing this. At the top of the assemble.php include this within the <?. = "whatever I want the page title to be";

and save it. open the header.php and modify it to mirror this

see the echo tag up there? This is what's going to happen. The is a variable. This variable gets passed to the header.php where it gets caught by the echo statement and placed in to the code.

Ok, so we have the page working. I'm going to throw out one little tip for you since you are new to this kind of page rendering. If you're like me, your side bar has a lot of content, and you don't want your entire side bar on all the pages of your site. So, what I do is I split the code up from the side bar in to other php files, and use the php include function to build the side bar that I want for whatever section of the site I am working on. This way you can have customized sidebar content to complement your page.

Using these simple concepts will vastly increase your productivity, decrease your coding errors and preserve your sanity as a html coder.

1  |  2  |  3  |  4  |  
Next »


  Subject: "Variable Title" Date: Dec 08 2007 at 9:50 am    
You have written:
At the top of the assemble.php include this within the

<?. = "whatever I want the page title to be";

But what will happen after it. When it is written, page shows nothing or error.
You Must be logged in or a member to comment.

Tutorial Stats

Tutorial Stats

2 Total Comments
4 Rating of 5 (6 Votes)


Tutorial Options

· Login to Rate This Article
· Login to Post a Comment
· Read more by this author
Digg This Article! Bookmark This Article Reddit: Bookmark This Article BlinkList: Blink This Article! YahooMyWeb BlogMarks: Add This Mark! Furl: Save This Article Spurl: Mark This Article



· HTML Tutorial
· New windows without using the target attribute
Your Article Here

"" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank