![]() |
|
||||||
SEPERATE FILESthis 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.
Comments:
|
|
|||||||||||||||||||||||||||||||||||||||