I want to have an update section on my site, but it is very annoying to go to every page an change the section. Is there anyway I can have a link or something to a filein my updates section, and then update just that file, so every page is automatically updated?
-
Use PHP for dynamic content. Use the `include` function.. – Josh Crozier Oct 05 '13 at 18:04
5 Answers
I think you're looking for something more than HTML and CSS. Personally I would recommend PHP, a server-side scripting languages, which will help you put HTML files together based on pieces, like a header, content, and footer. It's fairly simple, you can use the PHP function include() to get started: http://php.net/manual/en/function.include.php

- 575
- 2
- 4
- 16
-
Thanks. I knew I would need more than just HTML and CSS. I considered PHP, I'm just not very skilled, so I tried to avoid it. – user2850141 Oct 05 '13 at 18:07
-
It's not terribly hard, and most of the time you're just putting HTML in a PHP file, with small amounts of PHP here and there – russtuck91 Oct 05 '13 at 18:09
You can use a php include to to have that file inserted into a certain area on any page, then changing that file will mean that that change will be reflected on any page which you have included it.

- 5,440
- 23
- 37
- You can use Master Page concept if go for ASP.Net
- In HTML you can add includes where ever you want as a part of common page for all .
HTML5 Solution
Warning: May not work on older browsers, not officially supported yet
You can use <object>
which should look like this:
<object name="foo" type="text/html" data="foo.inc"></object>
Remember that it is not a self closing tag so you must use </object>
for it to be valid HTML5.
<embed>
can also be used for including external html content (and any MIME type):
<embed type="text/html" src="foo.inc">

- 2,733
- 7
- 37
- 78
Have you tried using Javascript? You can load the content using one of jQuery's AJAX function:
$("#mysection").load("ajax/test.html");
Remember that it must load a file from the same domain to prevent issues with the Same-Origin Policy. Another approach which I personally wouldn't recommend is putting your section within an iFrame.

- 2,733
- 7
- 37
- 78

- 812
- 6
- 7