Jahia Dev Forum > 2 virtual sites

0 (0 Good)
0 (0 Bad)

2 virtual sites

by  Flynn »  2011/06/07 20:41

 

Hey all,

I have 2 virtual sites and i need to test if i am on site A or site B.

What's the code to test that ?

 

<c:if test="${requestScope.currentSite.??? == 'siteA'}">

...

</c:if>

<c:if test="${requestScope.currentSite.??? == 'siteB'}">

...

</c:if>

Thanks for your help.

  • 2 virtual sites
    2011/07/08 15:09

    Flynn <p> &nbsp;</p> <p> <title></title> </p> <p> Hey all,</p> <p> I have 2 virtual sites and i need to test if i am on site A or site B.</p> <p> What&#39;s the code to test that ?</p> <p> &nbsp;</p> <blockquote> <p> &lt;c:if test=&quot;${requestScope.currentSite.??? == &#39;siteA&#39;}&quot;&gt;</p> <p> ...</p> <p> &lt;/c:if&gt;</p> <p> &lt;c:if test=&quot;${requestScope.currentSite.??? == &#39;siteB&#39;}&quot;&gt;</p> <p> ...</p> <p> &lt;/c:if&gt;</p> </blockquote> <p> Thanks for your help.</p>

  • Number of messages  32
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: 2 virtual sites

    by  cflond »  2011/06/07 20:41

    Hi Flynn,

    It is very easy to test if you are on your site A or B.

    For that you have several solutions :

    - Test on the name of the site : <c:if test="${requestScope.currentSite.title eq 'siteA'}">

    - Test on the ID of the site (recommended) : <c:if test="${requestScope.currentSite.ID eq 4}">

    - Test on others criteria ... (not relevant)

    I hope it will be helpful.

    Regards.

    Charles

  • Re: 2 virtual sites
    2011/07/08 15:11

    cflond <p> Hi Flynn,<br /> <br /> It is very easy to test if you are on your site A or B.<br /> <br /> For that you have several solutions :<br /> <br /> - Test on the name of the site : &lt;c:if test=&quot;${requestScope.currentSite.title eq &#39;siteA&#39;}&quot;&gt;<br /> <br /> - Test on the ID of the site (recommended) : &lt;c:if test=&quot;${requestScope.currentSite.ID eq 4}&quot;&gt;<br /> <br /> - Test on others criteria ... (not relevant)<br /> <br /> I hope it will be helpful.<br /> <br /> Regards.<br /> <br /> Charles</p>

  • Number of messages  42
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: 2 virtual sites

    by  shyrkov »  2011/06/07 20:41

    Hi Flynn/Charles,

    I would suggest to use site key instead (it is more stable compared to the ID), i.e.:

    ${currentSite.siteKey}

    Kind regards

    Sergiy

  • Re: 2 virtual sites
    2011/07/08 15:12

    shyrkov <p> Hi Flynn/Charles,<br /> <br /> I would suggest to use site key instead (it is more stable compared to the ID), i.e.:</p> <pre> ${currentSite.siteKey}</pre> <p> Kind regards</p> <p> Sergiy</p>

  • Number of messages  407
    Registration date Jun 7, 2011
    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