|
|
Inroduction
Htags are for easily adding recuring information and layout to your site without the burden of having to code anything.
They can also be used to setup presets to simplify the source html instead of cluttering it with tedious things like menus.
Setting up htags
You simply write out an html file and store it within any of the tag paths available to your configs, using an html extension.
From that point on, any tag which starts with the filename of the file (less .html) and which ends with a "!" character is a viable custom tag.
For example, you store a file with the following contents, named webmaster.html
<A href="mailto:sysadmin@yoursite.com"> webmaster </A>
This would allow you to add <webmaster!> to any site page and would be replaced by this following link : webmaster
persistent parsing?
Interesting point is that htags can use any other tags within, including other htags and even rtags!
This means you could then define an htag saved as footer.html and which would include the following mark up:
<hr> <center! <p! last updated: <modified!>> <webmaster!> <link! http://www.rebol.com <img! %images/powered-by-logo.jpg>> <link! %index.html <img! %images/built-with-remark.jpg>> <link! http://www.opensource.org/ <img! %images/osi-certified-60x50.gif>> >
Then at the bottom of your page, you just place a <footer!> tag, and you get all of the above inserted in place when the tag appears.
ex:
<HTML>
<HEAD><TITLE> MY WEB SITE </TITLE></HEAD>
<BODY>
<H3> This is my site </H3>
<p> and I've got nothing to say</p>
<footer!>
</BODY>
</HTML>
Note that the rtags and htags included within the htags are persistently reparsed. Meaning that even if those tags return rtags or other htags, they will be reparsed again, until no detectable custom tags are found within return code.
The above, generates something very similar to the footer used for this whole web site:
<HTML>
<HEAD><TITLE> MY WEB SITE </TITLE></HEAD>
<BODY>
<H3> This is my site </H3>
<p> and I've got nothing to say</p>
<hr>
<center> <p> last updated: 8-Feb-2005/23:03:42-5:00</p>
<A href="mailto:sysadmin@yoursite.com"> webmaster </A>
<A HREF="http://www.rebol.com"><IMG SRC="../images/powered-by-logo.jpg"></A>
<A HREF="../index.html"><IMG SRC="../images/built-with-remark.jpg"></A>
<A HREF="http://www.opensource.org/"><IMG SRC="../images/osi-certified-60x50.gif"></A>
</center>
</BODY>
</HTML>
usage in more detail:
This is a subtle example, but in reality, if you ever need to change this page's content, then many things are easily managed, and will change, without you needing to edit much. Especially if your tags are properly fragmented
When merged with the template tags, htags mean your site is built up from small components which are shared amongst all pages which use them, instead of copied over and over.
You will have an easier time of managing little parts of information and wherever that information is used, it will always be accurate, instead of you trying to rememeber to have to edit dates, names, page references, mail addresses, etc.
Whevener graphics layout enters the scene and you must play around with lots of nested tables and things like that, you will rapidly be gaining hours of time.
You will be litterally freed from the tedious process of having to integrate the content and the layout and any in site where page design and gfx aspect is more advanced, like having table-generated complex shadow image borders, you will be able to place neet effects everywhere just like if you where using a normal <p> tag.
Remember that you can even GENERATE images and composite them within REBOL's integrated view engine, so that you can add site-wide switches and all the pages change color, of graphic watermarks appear for any image used on the site! This is possible without ANY graphic artist intervention!!!
last updated: 16-Feb-2006/16:22:14-5:00