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

    in my non-modxcms-website I have a PHP-script, which does (simplified) the following with linktitles:

    1 explode() them at a given point (contact will be devided into con & tact
    2 attending a CSS-class to each of the two new parts (the two classes give each part a new color: con & tact)
    3 Giving this two parts to a variable $link
    4 echoing this variable as link in the navigationbar:
    <a href="link.html"><?php echo $link; ?></a>


    Well... until now I can’t find a way to do this via wayfinder. Somehow I need to give each wf.linktitle to a snippet which does the color-changing-work, but I honestly don’t have a clue how to do this. I already read "The almost complete guide to constructing Menus in MODx using Wayfinder".

    Maybe someone here has some suggestions or new food for my thoughts?

    Thx in advance,
    calvagh
      • 16183
      • 1,390 Posts
      A very wild guess here.....tried implementing your php code as a snippet? or using PHx? Maybe these are an overkill? Like I said, very wild (and quick) guess.

      /k
        • 4522
        • 3 Posts
        Well, that’s what I thought of, too - but I don’t know how / where. For example I don’t know how to pass the linktitle to the snippet. Maybe I’m just not seeing the simplest solution while thinking about it...
          • 16183
          • 1,390 Posts
          I’ll let the gurus weigh in here....meanwhile, have you had a look at the modx api? In WF, the link text (or text of links) can come from a number of fields, the default being the menu title. The values of these fields can be accessed via the modx api, have a look at these links:

          http://svn.modxcms.com/docs/display/MODx096/Document+Object
          http://svn.modxcms.com/docs/display/MODx096/Developer%27s+Guide

          Hope this helps

          /k