Gus
Gus

Reputation: 15

How can I import a single string line of text to multiple HTML files?

This may be a very silly question with a very simple answer, but here goes:

I'm creating a Movie Catalogue in HTML to come up on my Galaxy 3 Tablet to help me chose what movies to watch (not commercial or professional).

I currently have around 10x various HTML pages for lists, main menu, frames, etc, and will be soon creating a further 20x pages for individual genres soon. At the bottom centered on every page I have a small foot-note containing my name and the date I last updated my catalogue:

Gus Diaz - 16/02/2015

That's it! It's pretty simple! This little footnote helps me understand just exactly how badly outdated my catalogue might be.

QUESTION:
Is there a way to dynamically update every HTML file with one central file using "quite possibly" a .CSS file or a Javascript file? I tried looking into the (STRING) command but couldn't find any answers.

IDEALLY:
I'd like to simply open a central .CSS file with the following string:

"Gus Diaz - 16/02/2015" and manually change it, and that could then update all other 20-30x various HTML files dynamically with a special code (maybe?)...

I even experimented this code on my HTML files, but it didn't work:

CSS:

.string .update {
    "Gus Diaz - 16/02/2015"
}

HTML:

<string class="update"></string>

Any ideas? Any help? Thanks in advance, the help I've received earlier on from this forum was tremendous!

Gus

Upvotes: 0

Views: 205

Answers (5)

Joe Fitter
Joe Fitter

Reputation: 1309

Simplest way would be to use CSS :before or :after selectors:

.update:before {
    content: 'Gus Diaz - 16/02/2015';
}

see http://jsfiddle.net/j81wrL1m/1/ for a working example

Upvotes: 0

Nikhil sHETH
Nikhil sHETH

Reputation: 530

Html File

<div id="footer1"></div>

javascript file

document.getElementById('footer1').innerHTML="Gus Diaz - 16/02/2015"

and add javascript file using script code in every HTML file u want

Upvotes: 0

Turnip
Turnip

Reputation: 36642

You could do this with CSS:

.update:before {
    content: "Gus Diaz - 16/02/2015";
}
<string class="update"></string>

Upvotes: 3

Carlos M. Meyer
Carlos M. Meyer

Reputation: 446

Write the same code on all the pages you want to show the message:

HTML

<span class="update"></span>
<script src="update.js"></script>

And edit just one js file:

JavaSCRIPT (update.js)

document.getElementById("update").innerHTML = "Gus Diaz - 16/02/2015";

Upvotes: 1

Sipty
Sipty

Reputation: 1154

All you need is a global variable, let's say: footnote in one file and then just refer to it from everywhere else.

Upvotes: 0

Related Questions