Hi alik,
Thanks for that. I have sorted the php version issue but the snippet still does not seem to work. There is no error now.
I have created the snippet with your latest version:-
<?php
/*
SelfReference - returns current url preserving all query variables
Copyright (c) 2009-2010 Aleksander Maksymiuk,
http://setpro.net.pl/
You can check latest release at
http://setpro.net.pl/software/self-reference#attachments
Revision: January 9, 2009
*/
define(’SITE_START’, ’’);
parse_str(htmlspecialchars_decode($_SERVER[’QUERY_STRING’]), $query_vars);
if (isset($query_vars[’q’])) {
# we are within MODx
$retscript = $query_vars[’q’];
unset($query_vars[’q’]);
} else {
# not MODx (or we are on site’s start), but it has to work anyway
$retscript = $_SERVER[’PHP_SELF’]; /* 1 - it can be resolved in this way or... */
####$retscript = SITE_START; /* 2 - ... in this */
}
if (count($query_vars)) {
$retqstr = ’’;
foreach ($query_vars as $var => $value) {
$retqstr .= ’&’ . $var . ’=’ . htmlspecialchars($value);
}
$retqstr = preg_replace(’/^&/i’, ’’, $retqstr);
return $retscript . ’?’ . $retqstr;
} else {
return $retscript;
}
?>
The page code is as follows:-
<strong>Local Issues</strong>
[[Ditto? &startID=`8` &summarize=`4`&tpl=`news_format` &paginate=`1` &paginateAlwaysShowLinks=`1` SelfReference? &redir=`[+alias+]`]]
Showing <strong>[+start+]</strong> -
<strong>[+stop+]</strong> of <strong>[+total+]</strong> Articles | Page
<strong>[+currentPage+]</strong> of <strong>[+totalPages+]</strong>
<div id="ditto_pages"> [+previous+] [+pages+] [+next+] </div>
As you can probably tell I have very limited knowledge on modx and php etc. I still have the same problem in that when I click on a link in the second page it returns the correct page content but with the first page links.
You can see the issue at
http://icomlocal.com/index.php?id=8
I am using friendly urls.
I am sure I have not implemented your solution incorrectly but I do not have the knowledge to figure out what I have done wrong.
Cheers
iCOM