Jahia Template Forum > Add image to menu...

0 (0 Good)
0 (0 Bad)

Add image to menu item

by  bpironet »  2014/01/08 10:05

Hi all,

I would be interested you have your advice on the best way to add an image to a menu item (I'm building a mega menu). 

- Where to store the image related to the specific link (link that points to a node);
- How to adapt the navMenu module to show this image dynamically? 

 

Thank you in advance,

Regards

  • Add image to menu item
    2014/01/08 10:05

    bpironet <p> Hi all,</p> <p> I would be interested you have your advice on the best way to add an image to a menu item (I&#39;m building a mega menu).&nbsp;</p> <p> - Where to store the image related to the specific link (link that points to a node);<br /> - How to adapt the navMenu module to show this image dynamically?&nbsp;</p> <p> &nbsp;</p> <p> Thank you in advance,</p> <p> Regards</p>

  • Number of messages  5
    Registration date Jan 8, 2014
    0 (0 Good)
    0 (0 Bad)

    Re: Add image to menu item

    by  fabu »  2014/01/08 18:41

    Hi bpironet,
     
    Would you contribute your mega menu with several images (with an internal link for each) or dynamically generate your menu items to display with an optional image?
     
    My advice, I have experimented the second one and I  recommend you to not add this kind of definiton since it has an impact to all you jahia virtual sites. 
    [jnt:page] > nt:base, jmix:nodenameInfo, jmix:observable, jmix:basemetadata, mix:title, jmix:publication, jmix:tagged, jmix:navMenuItem, jmix:hasTemplateNode
     orderable
     - jcr:title (string) i18n mandatory boost=2.0
     - j:templateNode (weakreference,choicelist[templatesNode]) mandatory < jnt:template
     - j:isHomePage (boolean) hidden

     - thumbnail (weakreference, picker[type='image'])

     + * (nt:base) = nt:base version
     + * (jmix:navMenuItem)
    I prefer this way:
     
    [your_mixin_namespace:thumbnail] mixin
     extends = jnt:page, jnt:nodeLink, jnt:externalLink
     itemtype = metadata
     - thumbnail (weakreference, picker[type='image'])
    In this case, mixin is considered like an option when you contribute a new page.
    Just test if menu item has mixin with
    <c:if test="${ jcr:isNodeType( menuItem, 'your_mixin_namespace:thumbnail') }" >
    You could also create a dynamic area that is next to your menu item then drop an image inside.
    It's depends on what you want to do.
    I hope that could be helpful.
    Regards,

     

  • Re: Add image to menu item
    2014/01/08 18:41

    fabu <div> Hi bpironet,</div> <div> &nbsp;</div> <div> Would you contribute your mega menu with several images (with an internal link for each) or dynamically generate your menu items to display with an optional image?</div> <div> &nbsp;</div> <div> My advice, I have experimented the second one and I &nbsp;recommend you to not add this kind of definiton since it has an impact to all you jahia virtual sites.&nbsp;</div> <blockquote> <div> [jnt:page] &gt; nt:base, jmix:nodenameInfo, jmix:observable, jmix:basemetadata, mix:title, jmix:publication, jmix:tagged, jmix:navMenuItem, jmix:hasTemplateNode</div> <div> &nbsp;orderable</div> <div> &nbsp;- jcr:title (string) i18n mandatory boost=2.0</div> <div> &nbsp;- j:templateNode (weakreference,choicelist[templatesNode]) mandatory &lt; jnt:template</div> <div> &nbsp;- j:isHomePage (boolean) hidden</div> <p> <strong>&nbsp;- thumbnail (weakreference, picker[type=&#39;image&#39;])</strong></p> <div> &nbsp;+ * (nt:base) = nt:base version</div> <div> &nbsp;+ * (jmix:navMenuItem)</div> </blockquote> <div> <div> I prefer this way:</div> <div> &nbsp;</div> <div> <blockquote> <div> [<strong>your_mixin_namespace</strong>:thumbnail] mixin</div> <div> &nbsp;extends = jnt:page, jnt:nodeLink, jnt:externalLink</div> <div> &nbsp;itemtype = metadata</div> <div> &nbsp;- thumbnail (weakreference, picker[type=&#39;image&#39;])</div> </blockquote> </div> <div> In this case, mixin is considered like an option when you contribute a new page.</div> <div> Just test if menu item has mixin with</div> <blockquote> <div> &lt;c:if test=&quot;${ jcr:isNodeType( menuItem, &#39;<strong>your_mixin_namespace</strong>:thumbnail&#39;) }&quot; &gt;</div> </blockquote> <div> You could also create a dynamic area that is next to your menu item then drop an image inside.</div> <div> It&#39;s depends on what you want to do.</div> <div> I hope that could be helpful.</div> <div> Regards,</div> </div> <p> &nbsp;</p>

  • Number of messages  28
    Registration date Jan 8, 2014
    0 (0 Good)
    0 (0 Bad)

    Re : Re: Add image to menu item

    by  faissah »  2014/01/15 22:12

    Thanks for your help fabu!

    Fabrice  (faissah)

    Number of messages  264
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re : Re: Add image to menu item

    by  bpironet »  2014/01/16 10:53

    Thank you very much Fabu! It works correctly!

    Regards,
    Benoit

  • Re : Re: Add image to menu item
    2014/01/16 10:53

    bpironet <p> Thank you very much Fabu! It works correctly!</p> <p> Regards,<br /> Benoit</p>

  • Number of messages  5
    Registration date Jan 16, 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