QPR Knowledge Base 2014.1

Example of a Header with Replace Tags as Parameters

Example of a Header with Replace Tags as Parameters

Previous topic Next topic  

Example of a Header with Replace Tags as Parameters

Previous topic Next topic JavaScript is required for the print function  

Web Template "mailheader2.tpl" will create a blue bar with width of 100% and a link to QPR Online. It may have an E-mail link to the author of the model only if passed in the Include Replace Tag.

 

Web Template "mailheader2.tpl"

<table width="100%" cellpadding="2" cellspacing="0" border="0">

  <tr>

    <td bgcolor="#336699" align="left">

      <a href="mailto:<#Parameter ID="EMail">"><#Parameter ID="Name"></a>

    </td>

    <td bgcolor="#336699" align="right">

      <a href="http://www.qpronline.com" style="color:#fff;">QPR Online</a>

    </td>

  </tr>

</table>

<#Parameter ID="DefaultGreeting">

   

To make this HTML appear as the first thing on the view, following Replace Tag should be inserted in the correct templates, right after body starting tag:

<#Include Template="mailheader2.tpl" EMail="<#ModelProperty ID=AuthorEMail>" Name="<#ModelProperty ID=AuthorName>" DefaultGreeting="Hello World!" TemplatedParameters="Email,Name" >

 

This Include Replace Tag will pass the parameters Email and Name to the template, which can be used there with the Parameter Replace Tag as <#Parameter ID="EMail"> and <#Parameter ID="Name">. Before that, it will collect the correct values for parameters defined with parameter TemplatedParameters. The value of the parameter DefaultGreeting is not a Replace Tag and does not need to be processed.

 

NOTE: Nested quotes must be different (' and "). Leaving out quotes in plain text parameters of Replace tags is correct. All the parameter values that have character ">" must be in parenthesis, for that is otherwise read as the ending character of the Replace Tag itself, not the parameter.

Correct:

 

<#Include Template="mailheader2.tpl" Name="<#ModelProperty ID='AuthorName'>" TemplatedParameters="Name">

 

<#Include Template="mailheader2.tpl" Name="<#ModelProperty ID=AuthorName>" TemplatedParameters=Name>

Incorrect:

 

<#Include Template="mailheader2.tpl" Name="<#ModelProperty ID="AuthorName">" TemplatedParameters="Name">

 

Using <#Include Template="mailheader2.tpl"> will include the header correctly, but with an empty link without any value to href parameter and therefore not visible to the user.

 

NOTE: If the Feedback Email Address is not defined for the model, the link will not work.