We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17477
    • 12 Posts

    I have the same requirement as was discussed here http://modxcms.com/forums/index.php/topic,503.msg6481.html#msg6481 but only got half of what I needed from the final solution.

    I’ve combed the forums for a better solution that what is outline here.

    I have a sidebar menu generating from a DropMenu snippet call and in that menu I have both ordinary documents and some external links. For the external links I need:

    1) to launch in a new window and,

    2) to have an "external" CSS class applied so I can hook-up an icon to the items signaling that they are off-site.

    The hack provided here will get me halfway there (though it take a long time to launch the external link as it is), but what can I do about getting class code injected in the generated DropMenu link?

    What I’d love is a PlugIn / OnWebPagePrerender event parser which just automatically magically identified any/all external links an added a specified CSS class to them. . . but that’s crazy talk. I don’t have time to build such a thing.

    Here is the site I need this for:

    http://www.fn-group.com/clients/diopa/modx/index.php?id=88

    Thoughts?

    Thanks,

    Loren Johnson
      • 4041
      • 788 Posts
      I had success in modifying the DropMenu to allow weblinks, and you can also add a class atttribute... I just retested it and it works fine for me. The code (dropmenu_weblinkNW626_1156pmest.txt) is attached to the 5th post in this thread:

      http://modxcms.com/forums/index.php/topic,5341.0.html

      Create a snippet with the provided code, then in the manager while editing or creating a weblink, put the target and class in the longtitle field like so:

      target="_blank" class="weblink"

      (change class name to whatever you like) and here is an example of the class I use for weblinks:

      a.weblink, a.weblink:visited {
         text-decoration: underline;
         color : #104D83;
         padding: 0px 15px 0px 5px;
         margin-left: -5px;
         background:  url(images/weblink_icon.gif) center right no-repeat;
      }
      
      a.weblink:hover {
         text-decoration: none;
         color : #1A81DD;
         background-color:#E8E8E8;
      }
        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 17477
        • 12 Posts
        breezer,

        Thanks! this was exactly what I was needing and it worked like a charm. cool

        Cheers,

        Loren