We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12584
    • 208 Posts
    I have this code now

    echo <a href=\".$modx->makeUrl(32,’’,’year=members2007’\")>2007 Members</a>’;

    I know it’s wrong have played with it for ages cant find anything the in documentation about the makeurl function but I am sure it’s there somewhere,

    This is the working code I have from the site I hope to convert over to MODx

    echo "<a href=\"{$_SERVER[’PHP_SELF’]}?year=members2007\">2007 Members</a>
    ";

    Can anyone please point me in the right direction

    Cheers

    Ian
      • 10487 MODX Staff
      • 1,535 Posts
      Garry Nutting Reply #2, 19 years ago
      Check your quote usage, that’s the only thing I can see wrong with that. It should be:
      echo '<a href="'.$modx->makeUrl(32,'','year=members2007').'">2007 Members</a>';
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 12584
        • 208 Posts
        Many thanks for that this is now refreshing the page with the correct variables being sent which is great, ok I thought now I have a working example to can apply this to some other links laugh but not so,

        I had this
        <a href=\"{$_SERVER['PHP_SELF']}?search=membershipnumber&year={$year}\">Membership Number</a>


        and changed it to this
        <a href="'.$modx->makeUrl(32,'','search=membershipnumber&year={$year}').'">Membership Number</a>


        of which the url string of this last code example is index.php?id=32&search=membershipnumber&year=$year

        I have tried everything to get this bit sorted but for now it’s beaten me, is there a way to get this working with the 2 variables.

        Thankyou very much for the help so far.

        Cheers

        Ian
          • 10487 MODX Staff
          • 1,535 Posts
          Garry Nutting Reply #4, 19 years ago
          The key to getting the variables working correctly is down to how you include them in the statement (back to quotes again wink )

          Try this:
          <a href="'.$modx->makeUrl(32,'','search=membershipnumber&year='.$year).'">Membership Number</a>
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 12584
            • 208 Posts
            Garry

            Cheers for that now I have a working example I can see my errors huh

            The query string now sends the correct variable names so that part is good, now have another issue which i dont get on the non MODx site but I will try and work on that myself and post a new topic if I end up throwing the towel in.

            Thanks very much for your time and help.

            Cheers

            Ian