enabling the permalink plugin to pass on url variables
Posted: Sat Apr 29, 2006 8:50 am
I thought I'd share this small mod I made to the permalink plugin. Basically, it now allows you to pass variables on a permalink url whereas before it would get confused. This is useful if you're trying to pass along certain variables such as http://www.domain.com/podcast/mypost.html?format=mp3
Now the permalink plugin will totally ignore any variables and just focus in on the base url - note this works for posts, but still doesn't seem to quite work for other permalinks (such as a static page, for example):
The added lines are:
//my special code to allow for permalink vars
$myi = strpos($nice_url,'?');
if ($myi != 0) $nice_url = substr($nice_url,0,$myi);
and fit into "serendipity_event_custom_permalinks.php" as shown below:
case 'genpage':
$args = implode('/', serendipity_getUriArguments($eventDat
if ($serendipity['rewrite'] != 'none') {
$nice_url = $serendipity['serendipityHTTPPath'] . $arg
} else {
$nice_url = $serendipity['serendipityHTTPPath'] . $ser
}
//my special code to allow for permalink vars
$myi = strpos($nice_url,'?');
if ($myi != 0) $nice_url = substr($nice_url,0,$myi);
$query = "SELECT entryid FROM {$serendipity['dbPrefix']}en
$retid = serendipity_db_query($query);
if (is_array($retid) && !empty($retid[0]['entryid'])) {
$this->show($retid[0]['entryid']);
}
break;
Now the permalink plugin will totally ignore any variables and just focus in on the base url - note this works for posts, but still doesn't seem to quite work for other permalinks (such as a static page, for example):
The added lines are:
//my special code to allow for permalink vars
$myi = strpos($nice_url,'?');
if ($myi != 0) $nice_url = substr($nice_url,0,$myi);
and fit into "serendipity_event_custom_permalinks.php" as shown below:
case 'genpage':
$args = implode('/', serendipity_getUriArguments($eventDat
if ($serendipity['rewrite'] != 'none') {
$nice_url = $serendipity['serendipityHTTPPath'] . $arg
} else {
$nice_url = $serendipity['serendipityHTTPPath'] . $ser
}
//my special code to allow for permalink vars
$myi = strpos($nice_url,'?');
if ($myi != 0) $nice_url = substr($nice_url,0,$myi);
$query = "SELECT entryid FROM {$serendipity['dbPrefix']}en
$retid = serendipity_db_query($query);
if (is_array($retid) && !empty($retid[0]['entryid'])) {
$this->show($retid[0]['entryid']);
}
break;