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 spent many hours on this and give up. My following script works fine outside MODx but as soon as I put it into a snippet it wont work.

    Here the problem, I have a list of data which is pulled out the database no problem, there is then a link at the top of each column which when clicked will sort the data in order of the clicked column or others that will change to another table, I have used the $modx->makeUrl on the lniks which outputs the variables in the query string and this show ok, however for some reason the script no longer reads these variables, the only added thing in the string is the id=1 or whatever the page is on,

    for example I would have a link like this
    echo ’<a href="’.$modx->makeUrl(32,’’,’year=members2006’).’">2006 Members</a>
    ’;
    in the url I see this would see this
    http://mysite.co.uk/index.php?id=32&year=members2006

    and the first bit of code to deal with this looks like this

    // set variables so things work when page 1st loads
    			$year=$_GET['year'];
    			$search=$_GET['search'];
    			
    			if($search == ''){
    				$search = membershipnumber;
    			}
    			
    			if($year == ''){
    				$year = members2007;
    			}
    			
    			
    		$result = @mysql_query('SELECT membershipnumber, title, firstname, surname FROM ' . $year .  ' ORDER BY ' . $search .' ASC' );


    Here is a working example on the site I wish to change over to MODx click here

    And here is the exact same script with MODx make url addition which wont work here click here

    I am at a loss to see why this wont work, the variables can be seen in the string but for some reason they dont get read, what I dont understand is this works perfect locally but not in the MODx environment as a snippet, can anyone put me out my misery on this.

    Cheers

    Ian
      • 32982
      • 674 Posts
      i think it go ok now... it order and filter..?
        Jabiertxof (formerly XYZVISUAL)
        My bussines: http://marker.es
        https://www.youtube.com/user/jabiertxof/videos
        • 5261
        • 7 Posts
        Use uncached snippet call [!MySnippet?myParam=`param`!] wink
          • 12584
          • 208 Posts
          oh wow I added the ! and now it works, snippet call now looks like [!ClubMembers!] and all is well.

          I cant believe it was that simple, once again these forums have proved invaluable for me.

          Many thanks again for that. grin laugh