billysprocket88 — 2014-05-28T14:43:48-04:00 — #1
Hi everyone !
I am new to both this forum and web design and I must say people seams pretty awesome around here !
So yes ! I was wondering if there was a way in HTML to change the page layout ( like the nav bar, footer ,logo etc...) on multiple page/file in a website ?
I hope there is a better way than changing the code on every single page.
I don't really know if my question is clear that's why I came here.
Many thanks !
rubble — 2014-05-28T14:56:14-04:00 — #2
A certain amount can be done if you used css and this is a good reason to use a templating system with something like php; but that sounds to late for you now?
billysprocket88 — 2014-05-28T16:23:28-04:00 — #3
No no it's not too late ! I asked before I got that problem because every tutorial I watched did not adress that issue.
I don't know php yet, but is there a well known tool to do that job ( templating via php ) ?
Thank you !
rubble — 2014-05-28T16:55:33-04:00 — #4
Yes there are templating systems but when you use php you can "include" other files. So you can have a page and include a header and a footer so that you only need to change the header or footer file and it will change on all the pages.
I am not a WYSIWYG user but there is probably some software that you can setup a template and use it on each page but you will have to look around to see what software may use it.
As I say there is a lot you can do with css for instance you can change the layout and style of all the pages by modifying the one css file. You can link the header logo/image within the css file and you can also change the layout of the page by modifying the divisons which layout the positions of the header, navigation etc.
billysprocket88 — 2014-05-28T17:01:46-04:00 — #5
good ! Very enlightening ! I'm going to think of that when I start to code!
Thank you very much
felgall — 2014-05-28T17:23:28-04:00 — #6
Even without a complete templating system you can do quite a lot using ANY server side language simply using include statements.
Just place the common parts of the page layout into separate files that get included in each page in their appropriate locations. Only the content that is unique to each page would then be actually included in each file.
You would then be able to change the complete layout of the entire site simply by replacing the contents of the includes without needing to touch any of the actual page files.
john_betong — 2014-05-28T23:22:40-04:00 — #7
It is difficult to recommend a solution without knowing how your pages are generated. Is it possible to supply a typical page layout or possibly a URL to your site.
I use a PHP Framework that generates common pages, includes vary depending on the page generated:
$page = substr($_SERVER['PHP_SELF'], 1+strrpos($_SERVER['PHP_SELF'], '/') );
include '_footer-about.php'; break;
include '_footer-blog.php'; break;
include '_footer-contact.php'; break;
include '_footer-terms.php'; break;
} // endswitch;
billysprocket88 — 2014-05-29T06:50:12-04:00 — #8
Thanks felgall !
I don't have anything yet, I was just being preventive because I knew I was going to run in that problem eventually !
Beside being .php does this technique have a name ? Can I find documentation somewhere ?
I don't know php yet but I would like to learn how to do that when the time comes.
john_betong — 2014-05-29T11:16:08-04:00 — #9
Running a localhost server from your computer is also recommended so search for Wamp or Xampp servers which allow running websites from your desktop.
I would also investigate a free web hosting service which will allow you to create your own website.
The list of website information is increasing on a daily basis and it is difficult to keep abreast.
billysprocket88 — 2014-05-29T12:21:22-04:00 — #10
Thanks for the support !