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;
enabling the permalink plugin to pass on url variables
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: enabling the permalink plugin to pass on url variables
Hi!
That is a very useful patch, many thanks for sharing it! I also committed it to the plugin now!
Regards,
Garvin
That is a very useful patch, many thanks for sharing it! I also committed it to the plugin now!
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/