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