Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Other permlink mode
Hello,
I needed for a project a more “optimized url structure” (I already mentioned it here and here) and so I hacked a new permlink mode into the core, but it would be nicer to get is as a plugin.
So I added in include/txp_prefs.php in function permlinkmodes
'title_id' => gTxt('title_id'),
publish/taghandlers.php got in switch($permlink_mode) {
the case
case 'title_id':
if ($prefs['attach_titles_to_permalinks'])
{
$out = hu."$url_title-$thisid;
}else{
$out = hu."$thisid/";
}
break;
and publish.php got a new case in her switch($permlink_mode) {
case 'title_id':
if (is_numeric($u2) && ckExID($u2))
{
$rs = lookupByID($u2);
$out['id'] = (!empty($rs['ID'])) ? $rs['ID'] : '';
$out['s'] = (!empty($rs['Section'])) ? $rs['Section'] : '';
$is_404 = (empty($out['s']) or empty($out['id']));
}else{
# We don't want to miss the /section/ pages
$out['s']= ckEx('section',$u1)? $u1 : '';
$is_404 = empty($out['s']);
}
break;
and function chopUrl
got a $req = preg_replace('/-/', '/', $req);
after $req = preg_replace('/index\.php$/', '', $req);
Is it possible to get this all in a plugin??
Last edited by whocarez (2011-04-12 13:43:20)
Offline
Re: Other permlink mode
switch($permlink_mode) {
in publish/taghandlers.php should be better like that:
case ‘title_id’: if ($prefs[‘attach_titles_to_permalinks’]) { $out = hu.”$url_title”.”_”.”$thisid”; }else{ $out = hu.”$thisid/”; } break;
and the function chopUrl
should have a $req = preg_replace('/_/', '/', $req);
Offline
Pages: 1