We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3559
    • 57 Posts
    TV called "campus". Values are "south" and "downtown"

    Calling in a chunk called {{2010_Address}}:
    [+phx:if=`[*campus*]`:is=`south`:then=`{{2010_Address_South}}`:else=`{{2010_Address_Downtown}}`+]

    http://2010.fbcjax.com/south = TV is "south"
    http://2010.fbcjax.com = TV is "downtown"

    The call should change the Campus Address correctly, but it’s not.

    I also have a dynamic css with the following:
    #ip_Campus {background:url(/img/campus/[+phx:if=`[*campus*]`:is=`south`:then=`south`:else=`downtown`+]/logo.png) no-repeat left;}

    It is not working either. Should be switching the color scheme/images on the page. Any ideas? I’m also have the GetField snippet installed (worked well for the CSS stuff), but not using currently.
      • 16278
      • 928 Posts
      With PHx conditionals I always end up going back to the Wiki page, copying an example and modifying it for my own variables. Try this with your chunk names in place of "one" and "other":
      [*campus:is=`south`:then=`one`:else=`other`*]

      wink KP
        • 3559
        • 57 Posts
        Thanks KP. The wiki is what I used for the code syntax (http://wiki.modxcms.com/index.php/PHx#Advanced_usage). I should have looked further down, though.

        I put the code in, and it still is not switching, though. Even tried with string (’this’, ’that’) - no go.

        EDIT: Works now...I had to clear the cache and duplicate the page I was working on. Not sure which was the issue...but thanks smiley
          • 3559
          • 57 Posts
          ok, this is ridiculous. >:(

          The dynamic css file (uncached) is using "#ip_Campus {background:url(/img/campus/[*campus:is=`south`:then=`south`:else=`downtown`*]/logo.png) no-repeat left;}", and is always showing the downtown logo. I checked the .css page on both south and dt pages (2010.fbcjax.com/dynamic.css), and it only shows "#ip_Campus {background:url(/img/campus/downtown/logo.png) no-repeat left;}" .

          I have installed phx as noted on the wiki, and and using the correct syntax. I have the css page as uncached, and have cleared the cache (just in case) after ever edit of it...any ideas on what is causing this?

          EDIT: I placed the phx-formatted css on the page itself, rather than using an external file. Not what I want, but it works, at least. Is phx not able to be used in css files?
          • PHx is a plugin, and works on the MODx document being parsed. Your css files are totally separate files that are loaded in by your browser when it sees the links to them in your page head. MODx has nothing at all to do with them.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org