Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-12 00:53:10

oCameLo
New Member
Registered: 2008-01-07
Posts: 7

permalink_title_format should tack effect with url_title

For non English users, we have to write “title-like-this” instead of “Title: Like this” in url_title.

I know that the permalink likes “/Title+Like+this” may be useful for somebody, but the 1st one is more nature.

Or add other option to control it?

Thanks.

Last edited by oCameLo (2008-01-12 03:05:40)

Offline

#2 2008-01-12 01:01:40

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: permalink_title_format should tack effect with url_title

err so you want a colon in the url?? and instead of plus signs you want what…%20’s?

Offline

#3 2008-01-12 01:12:02

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: permalink_title_format should tack effect with url_title

URL options are title-like-this or TitleLikeThis. You’re saying you want spaces in your URL? You do know you’ll end up with http://example.com/Title%20Like%20This.

Also, could you explain the colon? It seems like you’re using it to denote hierarchy, in which case a section would be more appropriate.

Offline

#4 2008-01-12 01:14:10

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: permalink_title_format should tack effect with url_title

oCameLo, ym what you’re asking? Plus sign-formating? Or more options for URL-title formating?

For non English users

What does this mean…

Yeah – It isn’t valid url style to have spaces nor special chars. + or - are usually used for spaces.

Cheers!

Last edited by Gocom (2008-01-12 01:16:15)

Offline

#5 2008-01-12 03:32:30

oCameLo
New Member
Registered: 2008-01-07
Posts: 7

Re: permalink_title_format should tack effect with url_title

Sorry, a slip of pen, I mean “title-like-this” is more nature.

If I write “Title: Like this” in title, TXP’ll auto generate url_title as “title-like-this”. But if I write “Title: Like this” in url_title, I’ll get “Title%3A+Like+this”.

Offline

#6 2008-01-12 03:47:14

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: permalink_title_format should tack effect with url_title

oCameLo wrote:

Sorry, a slip of pen, I mean “title-like-this” is more nature.
If I write “Title: Like this” in title, TXP’ll auto generate url_title as “title-like-this”. But if I write “Title: Like this” in url_title, I’ll get “Title%3A+Like+this”.

i think you may have typo’ed again..do you mean

If I write “Title Like this” in title, TXP’ll auto generate url_title as “title-like-this”. But if I write “Title: Like this” in url_title, I’ll get “Title%3A+Like+this”.

and are you saying you don’t want the %3A in there? (which is just the encoded colon and is what is supposed to happen if you want a colon in your url). nothing to do with textpattern as that is how the web works.

sorry if i misunderstand anything though. still not clear what you mean…what language do you speak? maybe someone with your native tongue might be of help in any of the international forums.

Offline

#7 2008-01-12 04:11:24

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: permalink_title_format should tack effect with url_title

maybe someone with your native tongue might be of help in any of the international forums.

Ocamelo is Portugese word/name, but it doesn’t tell nothin’ about the native language ;) But it’s also something Japanese (if I remember corretly), so maybe ocamelo is Japanese? :)

Cheers!

Offline

#8 2008-01-12 04:37:28

oCameLo
New Member
Registered: 2008-01-07
Posts: 7

Re: permalink_title_format should tack effect with url_title

faint.. how poor my en is…

I think “title-like-this” is more nature, even if I write “Title: Like this” in url_title, I still wanna “title-like-this”. Just like this:

function custom_permlinkurl($article_array)
{
	if (empty($article_array)) return;
	extract($article_array);
	$url_title = strtolower(sanitizeForUrl($url_title));
	list($y,$m,$d) = explode("-",date("Y-m-d",$posted));
	return hu."$y/$m/$d/$url_title";
}
$prefs['custom_url_func'] = 'custom_permlinkurl';

This function won’t work, because TXP use url_title to locate the record, so it can’t done by write a custom_url_func.

Anyway, thanks everyone.

Offline

#9 2008-01-12 04:51:04

oCameLo
New Member
Registered: 2008-01-07
Posts: 7

Re: permalink_title_format should tack effect with url_title

Actually, my nickname is “Camel” (cigarette), but “Camel” is registered in everywhere, and my domain is “oTnTh”, so I use “oCameLo”, it’s long and uncommon enough…

I’m Chinese, sorry for my poor en again.

BTW, it seems no “ca” in Japanese, only “cha” or “ka”. ;-p

Offline

#10 2008-01-12 06:38:16

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

Re: permalink_title_format should tack effect with url_title

If you leave your url title empty, Textpattern will fill it for you.

Offline

#11 2008-01-12 06:46:23

oCameLo
New Member
Registered: 2008-01-07
Posts: 7

Re: permalink_title_format should tack effect with url_title

Thanks Mary, but if the title includes non ascii chars, I have to take care the url_title by myself.

This one works, but it looks so stupid…

function ocamelo_url_title($event, $step) {
	$js = <<<EOF
		function ocamelo_onsubmit(e) {
			if (e && e.preventDefault) e.preventDefault();
			var s = document.getElementById('custom_8').value;
			s = s.replace(/^\s*(.*)\s*$/, '$1');
			if (s == '') return true;
			s = s.replace(/\s+/g, '-');
			s = encodeURIComponent(s);
			s = s.replace(/%\S{2}/g, '');
			s = s.toLowerCase();
			document.getElementById('url_title').value = s;
			return true;
		}
		document.article.onsubmit = ocamelo_onsubmit;
EOF;
	echo script_js($js);
}
register_callback('ocamelo_url_title', 'article');

Offline

#12 2008-01-12 16:11:22

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: permalink_title_format should tack effect with url_title

oCameLo wrote:

BTW, it seems no “ca” in Japanese, only “cha” or “ka”. ;-p

Damn, my poor Japanese :D

Cheers!

Offline

Board footer

Powered by FluxBB