Jump to content

referencing external text inside html "class" code


annikassociates
 Share

Recommended Posts

Hi to anyone that can help me… i'm not an expert in html coding but get by for the projects I need so was wondering if there is a way to bring into existing html coding, text from another file... for instance:
 
the coding example below has an <li class with some text in for now of "mix March 2020"… however I want it to contain literally 100s of words ( don't ask why, there is a reason :-) )… so as you can imagine that would take up a lot of room in the html file and therefore make it difficult to scroll through lines and lines to get to the next element, which would also have the same etc etc…
 
What I would like to do is have all the 100s of words in another file that is somehow referenced into the class quotes… i.e. if a file called "March2020.txt"   contained the words, I could then simply put a reference to it inside the quotes for the <li class?? Something like: 
 
<li class="mix "/external/March.txt" ">  ... i know this coding is totally wrong but im trying to illustrate the point… is there a way to do this anyone???
 
thanks, Andy
 
 
CODING EXAMPLE
 
<li class="mix March 2020 ">
 
<div class="container_annik">
</li>
 
 
 
best regards,
Andy
Link to comment
Share on other sites

It can't be done in pure HTML.

You can have a server-side programming language generate the HTML with the classes from a file, but when you look at the source code, it is going to be just as long.

It could also be achieved with Javascript when running on a web server but I would discourage using Javascript for content and presentation.

Do you know what server-side languages are available to you?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...