Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2006-05-05 15:11: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?

Sootah wrote:

Also the fact that even with the above line of code in the lang file it still doesn’t display properly kinda irks me.

Are you sure you re-installed the file? Admin > preferences > manage languages > install from file (bottom of page)

Offline

#14 2006-05-05 15:16:35

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

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

Oh, yep, that did it. I didn’t realise you actually had to make TxP reload the file. I figured it was pulling the language bit out of the file every time.

Thanks.

Any thoughts on the other bit?

Like I say, it’s working now, but only if the plugin is active.

Just for kicks, here’s a link: Home Computer Networking

Keep in mind I’m only beginning to understand this Txp stuff before you make fun. :) Eventually I’ll have the old articles migrated over to this.

Offline

#15 2006-05-05 16:45:34

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?

Sootah wrote:

I figured it was pulling the language bit out of the file every time.

No, it’s pulling it out of the db, so the file must be loaded into the db first.

Any thoughts on the other bit?

Sorry, I’m not a coder. There are others who can help you better with this. Hopefully one of them will come by…

Offline

#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