Templates & "common" functions &...

User 2584478 Photo


Guest
1 post

Is there a way to create templates for page layouts - that can be used on each page in the website? The themes seem to only be used on the first page, then you just do your own thing on subsequent pages.
In addition, can you create a page-layout that is used on multiple pages but if you need to change it is changed in only one place & the change filters across all other pages using it?
For example, using a menu. You may want to have the same menu on each page, but if you add a new menu item you don't want to have to change it on each page. Perhaps "menu's" isn't a good example as you have a menu application - which I haven't used as I am only trialling the software so far. However, I hope you get my meaning.

Along similar lines - is there a way to have a common "item" which can be used on multiple pages & on forms, emails etc, but which can be held (& thus changed) in one place only? For example: a fee for a specific job may be refered to on several pages, in forms & emails etc, but if you need to change it you don't want to have to track it down on every page, form etc & change each reference.
User 38401 Photo


Senior Advisor
10,951 posts

Hiya Linric,

You can accomplish both of your needs using PHP includes or SSI includes and CSS. You can Google those to see how that all works.

You would use the PHP Includes for the same structure items (Menu, Header, Footer, Sidebars, etc.). PHP includes require you to then change your page extensions to .php and wouldn't be viewable in previews of the HTML Editor (assuming that's the program you're asking about here since I'm unsure what program you're trying to use for this). You can install things like Xammp (spelling?) or a few others that allow you to load the pages on a local server so you can view the changes.

As for items on different pages. The best way to do that would be using CSS and images. If you have prices you need to change regularly put them into an image. Code the image into CSS and then all you need to do is alter the image so the price (or whatever it is) changes and reupload it keeping the same dimensions and same name. If you change the dimensions or name you just change it in the CSS and it will update anywhere that CSS class is used on all pages. That would be the simplest solution for this part.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.