Jahia Dev Forum > can i sent params...

0 (0 Good)
0 (0 Bad)

can i sent params to template?

by  obayok »  2012/10/04 06:57

Hi all, i have a lot similar nodes and i should create templates for them but for every template use defferent nodeType of components list. Now i have a lot similir templates where i change just 1 variable.

Is it possible ti sent to template variable when we create page? If yes can you tell me how?

 

Thanks

  • can i sent params to template?
    2012/10/04 06:57

    obayok <p> Hi all, i have a lot similar nodes and i should create templates for them but for every template use defferent nodeType of components list. Now i have a lot similir templates where i change just 1 variable.</p> <p> Is it possible ti sent to template variable when we create page? If yes can you tell me how?</p> <p> &nbsp;</p> <p> Thanks</p>

  • Number of messages  11
    Registration date Oct 4, 2012
    0 (0 Good)
    0 (0 Bad)

    Re: can i sent params to template?

    by  shyrkov »  2014/01/02 10:30

    Hello,

    if I correctly understood the requirement it can be achieved using options (a special mixin type which can be added to the page during creation).

    Similar to how the site map option is working (it adds some "additional" info to the page when creating).

     

    Kind regards

    Sergiy

  • Re: can i sent params to template?
    2014/01/02 10:30

    shyrkov <p> Hello,</p> <p> if I correctly understood the requirement it can be achieved using options (a special mixin type which can be added to the page during creation).</p> <p> Similar to how the site map option is working (it adds some &quot;additional&quot; info to the page when creating).</p> <p> &nbsp;</p> <p> Kind regards</p> <p> Sergiy</p>

  • Number of messages  407
    Registration date Jan 2, 2014
    0 (0 Good)
    0 (0 Bad)

    Re : can i sent params to template?

    by  fabu »  2014/01/07 23:13

    Hi,

    Assume that, 

    [mix:superType] mixin

    [nt:nodeTypeA] > mix:superType

    [nt:nodeTypeB] > mix:superType

    Use this piece of code for your specific node type (e.g. nodeTypeA.jsp):

    <template:module node="${yourSpecificNode}" view="common">

      <template:param name="yourParamName" value="yourParamValueA" />

    </template:module>

    And retrieve it into your mixin view like that (superType.common.jsp):

    <c:if test="${not empty yourParamName and yourParamName eq 'yourParamValueA' }" >

      <%-- Do specific cool stuff for node type A--%>

    </c:if>

    I hope this is what you were looking for and that it might still be useful to you.

    Regards,

  • Re : can i sent params to template?
    2014/01/07 23:15

    fabu <p> Hi,</p> <p> Assume that,&nbsp;</p> <blockquote> <p> [mix:superType] mixin</p> <p> [nt:nodeTypeA] &gt;&nbsp;mix:superType</p> <p> [nt:nodeTypeB] &gt;&nbsp;mix:superType</p> </blockquote> <p> Use this piece of code for your specific node type (e.g. nodeTypeA.jsp):</p> <blockquote> <p> &lt;template:module node=&quot;${yourSpecificNode}&quot; view=&quot;common&quot;&gt;</p> <p> &nbsp; &lt;template:param name=&quot;yourParamName&quot; value=&quot;yourParamValueA&quot; /&gt;</p> <p> &lt;/template:module&gt;</p> </blockquote> <p> And retrieve it into your mixin view like that (superType.common.jsp):</p> <blockquote> <p> &lt;c:if test=&quot;${not empty yourParamName and yourParamName eq &#39;yourParamValueA&#39;&nbsp;}&quot; &gt;</p> <p> &nbsp; &lt;%-- Do specific cool stuff for node type A--%&gt;</p> <p> &lt;/c:if&gt;</p> </blockquote> <p> I hope this is what you were looking for and that it might still be useful to you.</p> <p> Regards,</p>

  • Number of messages  28
    Registration date Jan 7, 2014
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page