This is an old revision of the document!
Create an HTML button from the given params
Name | Mandatory | Description |
---|---|---|
template | Yes | The template that will be used to construct the button. |
href | No | The href params of the link (<a href=”..”>). This parameter will be store in the variable <#button_href> |
onclick | No | The onclick params of the link (<a onclick=”..”>). This parameter will be store in the variable <#button_onclick> |
caption | No | The caption of the button (<a href=”..”>caption</a>). This parameter will be store in the variable <#button_caption> |
title | No | The Title of the link (<a title=”..”>). This parameter will be store in the variable <#button_title> |
itemprop | No | The itemprop value of the button (<a itemprop=”..”>). This parameter will be store in the variable <#button_itemprop> |
extra_params | No | Extra params for the link (<a extra_params>). This parameter will be store in the variable <#button_extra_params> |
extra_class | No | Extra Class for the link (<a class=“Btn_main_class extra_class”>). This parameter will be store in the variable <#button_extra_class> |
The function <#button> will simply create from it's parameters the variables <#button_href>, <#button_onclick>, <#button_caption>, <#button_title>, <#button_itemprop>, <#button_extra_params>, <#button_extra_class> and them parse the template and return the result
We define the template of MyButton.html like this :
<a class="MyButtonClass<#if condition"'<#button_extra_class>' <> ''"> <#button_extra_class><#endif>" href="<#button_href>" <#if condition"'<#button_onclick>' <> ''"> onclick="<#button_onclick>"<#endif> <#if condition"'<#button_title>' <> ''"> title="<#button_title xmlencode=1>"<#endif> <#if condition"'<#button_itemprop>' <> ''"> itemprop="<#button_itemprop>"<#endif> <#if condition"'<#button_extra_params>' <> ''"> <#button_extra_params><#endif>> <span class="l"></span> <span class="m"><#button_caption xmlencode=1></span> <span class="r"></span> </a>
if we call this function
<#Button Template="MyButton.html" Href="MyPage.html" Caption="Go to my Page">
the output will be
<a class="MyButtonClass" Href="MyPage.html"> <span class="l"></span> <span class="m">Go to my Page</span> <span class="r"></span> </a>