We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8755
    • 4 Posts
    First off, I am new to MODx and Wayfinder. I created a website with two page templates, homepage and subpage. They have the same basic design, except there is no side menu on the homepage. Got everything looking fine, but my boss said that I should try to do it in one template. I don’t know how. I don’t know if there’s a way to do it in the template or the Wayfinder code or what. I have attached JPGs of the layout to make it a little easier to show you what I’m talking about. I’m content to leave it as it is now, but I also want to keep the boss happy. Please help!
      • 3749
      • 24,544 Posts
      There may be an easier way, but you could certainly do it with a snippet placed where the menu goes.

      [!MenuSnippet!]

      You’d put the Wayfinder menu in a chunk and, in your MenuSnippet snippet, just check to see if it’s the home page (looking at the document ID).

      If yes:
      return "";

      if no:
      return(getChunk("name_of_the_wayfinder_chunk"));


      I think you could also do it with a TV set to the chunk mentioned above for every page but the home page and left empty there.

      There might also be a way to do it with PHX.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 16183
        • 1,390 Posts
        I read somewhere how this can be achieved using PHx, some chunks, css-display none etc....problem is...can’t seem to find it now! Anyway, here’s some links to similar(?) logic applied using PHx..

        http://modxcms.com/forums/index.php/topic,30180.msg183189.html#msg183189
        http://modxcms.com/forums/index.php/topic,29031.msg176269.html#msg176269
        http://modxcms.com/forums/index.php/topic,23132.0.html

        And a link to the PHx wiki
        http://wiki.modxcms.com/index.php/PHx

        cheers/k smiley
          • 3707
          • 241 Posts
          [+phx:if=`[*id*]`:is=`1`:then=``:else=`{{menuChunk}}`+]

          Where `1` is the ID of your home page and {{menuChunk}} contains your Wayfinder call.
            • 16183
            • 1,390 Posts
            I knew I had seen bob1000 write code like that! laugh. I’ll keep this for my reference...
              • 27330
              • 884 Posts
              phx is a life saver for the coder wannabe smiley
                • 8755
                • 4 Posts
                I tried your if statement, bob1000, but it didn’t display right. I made the changes and then previewed the homepage (which shouldn’t have a menu). Everything is on the page correctly, but where my menu is not supposed to display, it says:


                [+phx:if=`5`:is=`5`:then=``:else=`

                * SideMenu1
                * SideMenu2
                * SideMenu3
                `+]


                I have pasted my html code to see if I did something wrong. My homepage’s id is 5 and I created a chunk called "sidemenu" that says: [!Wayfinder? &startId=`0` &level=`1`!]. Please help! It seems like it should work, but it obviously doesn’t.

                <body>
                <div id="body">
                
                <div id="header">
                <div id="topmenu">[!Wayfinder? &startId=`0` &level=`1`!] </div>
                </div>
                
                <div id="address">{{address}}</div>
                
                <div id="curve">
                <div id="centerimage"><img src="[*bannerimage*]" /></div><div id="curvemask"></div>
                <div id="mainmenu">[!Wayfinder? &startId=`0` &level=`1`!] </div>
                <br />
                
                <div id="contentarea">
                <!-- if statement to display sidemenu chunk if not the homepage: [!Wayfinder? &startId=`0` &level=`1`!]  -->
                <div id="sidemenu"> [+phx:if=`[*id*]`:is=`5`:then=``:else=`{{sidemenu}}`+] </div>
                <div id="content"> <h2 class="style1">[*longtitle*]</h3>
                <p>[*content*]</p></div>
                </div>
                
                </div>
                
                </div>
                
                </body>
                  • 27330
                  • 884 Posts
                  did u install phx yet?
                    • 8755
                    • 4 Posts
                    Actually, I hadn’t. I assumed that it came already installed. My boss usually sets it up and I just go in there and edit the pages. I figured since I already had Wayfinder that PHx would be in there too. Anyway, I followed the directions on http://modxcms.com/PHx-1006.html and I get the following error any time I try to preview the pages:

                    « MODx Parse Error »
                    MODx encountered the following error while attempting to parse the requested resource:
                    « PHP Parse Error »

                    PHP error debug
                    Error: include_once(assets/plugins/phx/phx.parser.class.inc.php) [function.include-once]: failed to open stream: No such file or directory
                    Error type/ Nr.: Warning - 2
                    File: /home/woodmart/public_html/manager/includes/document.parser.class.inc.php(745) : eval()’d code
                    Line: 10

                    Parser timing
                    MySQL: 0.0008 s (3 Requests)
                    PHP: 0.0141 s
                    Total: 0.0150 s
                      • 27330
                      • 884 Posts
                      modx can’t find the phx file. did u upload the files? make sure you have it on the server.
                      IIRC the zip ship with the folder name in caps, ie Phx and you wanna rename it to phx in lower case.