1.

Solve : Simplifying repetitive HTML by some form of 'id' templating. Is this possible??

Answer»

Hi everyone,

I've recently wrote some HTML code which works for what I wanted it to do, but because of its length, I find it a little cumbersome to repeat its contents every time I want to add the same type of thing in one of my HTML pages. Here is an example of the HTML code I've written.

Code: [Select]&LT;a  title="Custom Statement - a statement not easily extractable from sources. Experience may be embedded within the statement." id="statement"><img src="images/customstatement.png" width:="32px" height:="32px"></a><a href="http://www.avfacts.com.au/sample/perinst1.pdf" target="_child" title="Linked Source" id="sourcetype"><img src="images/sourcelinked.png" width="32px" height="32px"></a>
This is what I want to do. I hope you understand it and if not, please send me a reply so that I may be able to explain myself better.

Code: [Select]<!-- Current html code -->
<a id="statement type: Custom, Modified or Original"  title="hover text to describe the statement type" ><img src="associated image with the type of statement" width="image width fixed" height="image height fixed"></a><a id="source type: Linked or ReferenceOnly" title="Here, it will either state 'Link Available' if a href exists else if I don't provide a href i.e. only a reference, then the reference will be stated here instead" href="url if source exists" target="_child" ><img src="associated image with type of source" width="image width fixed" height="image height fixed"></a>

<!-- What I want it SIMPLIFIED to if possible-->
<a id="statement type"></a><a id="source type" title="to be written if only a reference exists" href="to be written only if a source is linked"></a>

<!--
The statement type will have a predefined title, img src, width and height for that img scr.
When the source type id is "Linked", the title shall be prefined as "Link Available"  and the href shall be written by the CODER. The target shall be predefined as "_child" and the associated image along with its dimensions will be predefined.
When the source type id is "ReferenceOnly", the title shall be written by the coder and the href shall be predefined as "#". The target shall be predefined as "_child" and the associated image along with its dimensions will be predefined.
-->
I understand that this likely will require more than just html if it is possible of course 
Please help me if you have a solution or any constructive feedback as soon as time permits.

Kind Regards
brainyantIf you dont want to type this every time... save a text file with this info in it and simply open the text file and copy paste it to your html file.

If you want this to be dynamic as in, redundant info you dont have to type, you would want to look into like PHP or Perl with Dynamic HTML.Thanks DaveLembke for the suggestion . I'll take it onboard and use 'php include' in my html.

Kind Regards,
Anthony



Discussion

No Comment Found