The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HTML common pill file
scott449
post Jul 5 2020, 12:10 PM
Post #1





Group: Members
Posts: 3
Joined: 30-June 20
Member No.: 27,415



I have several web sites
They all have a common footer
Is there way to have a common “footer file” then insert some HTML code into all my pages that pills the “footer file” in the footer section of each page.
Huge pain in the ass to update all my footers

this would alos be usefull for other parts of my sites that have common information that is updated regulary

TIA
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jul 5 2020, 12:33 PM
Post #2


Computer says no.
********

Group: WDG Moderators
Posts: 18,968
Joined: 9-August 06
Member No.: 6



Sure, but not with HTML. Unless you use frames. And you don't want to use frames. happy.gif

It's easily done server side. Earlier SSI, Server Side Includes, that's available on Apache was much used and is still perfectly fine to use. It isn't a programming language per se, more a collection of server directives that can be embedded in the HTML.

Nowadays it's more common to use PHP, which is a programming language. The advantage is that if you later want to use other PHP features you can just go ahead. If you start with SSI and want to add PHP later you would have to redo your SSI included and change them to PHP ones.

It all depends on what you want to do and what's available to you on the server. If you are at a free host that maybe don't offer any server side features there are preprocessors that run locally on your machine and basically do what SSI does on the server. The difference is that if you update your included menu or footer you need to run the preprocessor again and upload the changed files to the server.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
scott449
post Jul 5 2020, 12:35 PM
Post #3





Group: Members
Posts: 3
Joined: 30-June 20
Member No.: 27,415



ok thanks for the responce. hoping i could do it in HTML all that other stuff is WAY over my head

thanks for the info
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jul 5 2020, 12:48 PM
Post #4


Computer says no.
********

Group: WDG Moderators
Posts: 18,968
Joined: 9-August 06
Member No.: 6



Actually, it isn't that complicated.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 6 2020, 06:36 PM
Post #5


.
********

Group: WDG Moderators
Posts: 8,501
Joined: 10-August 06
Member No.: 7



QUOTE(scott449 @ Jul 5 2020, 07:10 PM) *

I have several web sites
They all have a common footer

You mean on separate domains, or just different pages on the same domain?

QUOTE
Is there way to have a common “footer file” then insert some HTML code into all my pages that pills the “footer file” in the footer section of each page.

On a single website it's easy, for example here's all the PHP code needed to include the contents of the text file footer.txt:

CODE
<?php include 'footer.txt'; ?>

You may also need to give the HTML files a .php extension instead of .html, though that can be changed.

If you want to include a file from another domain, your server's PHP module must be configured to allow that in https://www.php.net/manual/en/filesystem.co...low-url-include this might be up to your webhost support, not sure.

See also https://www.php.net/manual/en/function.include.php
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 6th August 2020 - 11:56 PM