Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#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
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
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
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
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
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
Offline