Template Question

Howdy everyone. I are having trouble with applying a themplate to help my website. What I want to perform is have any template that performs from an alternative file that is applicable itself to anyother page linked to it. I don’t know how to do this, but I’m pretty sure it really is done. I need this specific because my site will get pretty big as soon as I add all of the content and We would like this for two reasons: I don’t want to apply your theme individually for every single page in addition to because if from now on I would must update my format, this would be a Easier way of doing this. I’ve heard this may be done through CSS in addition to PHP through the use of variables or something similar to that, but that’s pretty much all I find out. Please give us some suggestsions on how to begin this. Thanks in improve.

There are many ways to accomplish this, and you require a server edge language.

To all methods, you could have a template’ internet page, which will consist of the framework in your site design. This template page will likely then be called to display each other page’s contents.

YOU. The database means: Your contents’ HTML, including page something, are stored within a database.

COUPLE OF. The flat record way: The details are stored throughout flat file (could possibly be PHP).

What you complete next is as long as you and you might want to think through this decision a lttle bit. You can have got links like:

Code:
list. phppage=ThePage

index. phppage=AnotherPage

Where list. php is a person’s template page, plus the page variable conveys to the template which contents to exhibit. The index. php page then pulls inside contents from the particular database or the flat files as well as sends it on the browser.

Additional way is for you to include() your template into each article. The way you are doing that, is around each page, determine a variable (the web site ID, call it pageID) then include the template file. This permits you to have proper names for your pages, like get in touch with. php and guestbook. php. Cases:

Code:
get in touch with. php
php
$pageID = " ContactPage";
include " /path/to/template/page. php";
/php

guestbook. php
php
$pageID = " Guestbook";
include " /path/to/template/page. php";
/php

And etc. The template internet page. php will function much like the index. php above: it finds the right contents for that pageID, assembles this page, and blows.

Here’s I making feeling

Thanks in your reply. Isn’t it true for your first way we would only be able to use HTML as being the flat files. In that case, then this will not work because a lot of the flat files will be files using comprises for news pieces of software and such that would, in switch, require the file to get php rather compared to html.

You’ll be able to include either PHP as well as HTML files. Any PHP code inside PHP files will be executed.

O . k, i’ll give the item a try
Thanks plenty.

K, I’m back out of trying and I’ve encountered an issue. With the " id=" system, when I endeavor to include php reports in my site, it works very good until i simply click the comments url. Then, i guess, it tries to help load something different inside " id=" (something from cutenews) and yes it confilicts with the initial included file and also i get blunders. So what I care is if you’ll find any other types of doing this. YOU SHOULD PLEASE PLEASE!!! with thanks.

The easiest thing is probably change YOUR site’s " id" in order to something else, like pageid or articleid or perhaps something.

I hate the item when scripts don’t even think about this possibility and use very common variable names.

This entry was posted in Web Design and tagged , , . Bookmark the permalink.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *