Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2006-05-05 18:09:53

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Why can't you (or better yet, how CAN you) add a custom permalink?

…why you can’t add your own custom permalink structure?

You can, via plugin, that’s why that functionality is there: to extend Textpattern when it doesn’t already do something you want it to.

Oh, more editing was done… Now if only I could get this to work without a plugin I’d be super happy.

You’re still missing a category check in there. Assuming you’re using Category1 to determine the url:

case 'section_category_title':

	$rs = lookupByTitleCategorySection($u1, $u2, $u3);

	$out['s'] = @$rs['Section'];
	$out['c'] = @$rs['Category1'];
	$out['id'] = @$rs['ID'];

	$is_404 = (empty($out['s']) or or empty($out['c']) or empty($out['id']));

break;

function lookupByTitleCategorySection($section, $category, $title, $debug = '') 
{
	return safe_row('Section, Category1, ID', 
		'textpattern', 
		"Section = '".doSlash($section)."' and Category1 = '".doslash($category)."' and url_title like '".doSlash($title)."' limit 1"
	, $debug);
}	

I still don’t see how modifying core files is easier to maintain than a plugin.

Offline

#17 2006-05-05 19:41:02

Sootah
Member
Registered: 2006-05-04
Posts: 27

Re: Why can't you (or better yet, how CAN you) add a custom permalink?

Awesome Mary, thanks.

I’ll look more into the plugin bit. The only reason that I’m kinda turned off to the permalink plugins is that all templates use the standard <txp:permlink> tag and I’d have to edit that every time.

Then again, that may be easier than having to redo all the mods every time I update…

If nothing else, at least I familiarised myself with the code a bit. :)

Offline

#18 2006-05-05 19:45:35

Sootah
Member
Registered: 2006-05-04
Posts: 27

Re: Why can't you (or better yet, how CAN you) add a custom permalink?

Actually, is there a way I could make my own plugin that would simply add my custom options to the standard permalink list? I think that’d be the very best way to handle it. Then I wouldn’t have to change all the tags in the templates and forms, and also wouldn’t have to re-mod the core files every time I update.

Sorry for being such a pest. Perhaps I can be useful after I get a hang of TxP’s code structure. :)

Offline

#19 2006-05-05 20:02:57

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Why can't you (or better yet, how CAN you) add a custom permalink?

ied_plugin_composer. Sorry, a plugin again… ;)

Offline

#20 2006-05-06 20:24:23

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Why can't you (or better yet, how CAN you) add a custom permalink?

You’ll likely want to study the permalink plugins mentioned (), as well as the default functions, to see how it’s done. :)

Offline

Board footer

Powered by FluxBB