Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#85 2005-01-15 01:52:06

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

zem, I hate to keep complaining, but I’m still having escaping issues. the zem_permlink tag is generating URLs with the slashes escaped as ‘%2F’, which breaks everything.

update: Fiddling with the various bits which call url_encode doesn’t seem to be helping, either, so I’m not sure what the problem is exactly.

updated again: I’ve got it working now, with the following edit. In the function zem_format_url, I’ve changed the line return $pfr.$uri; to return urldecode($pfr.$uri); and it seems to be working fine.

Last edited by ubernostrum (2005-01-15 01:59:00)


You cooin’ with my bird?

Offline

#86 2005-01-15 01:56:35

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Wilshire,

The zem_rewrite 404 handler only deals with URLs that don’t match a defined scheme.


Alex

Offline

#87 2005-01-15 02:01:25

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Ubernostrum,

I can’t reproduce the %2F issue here. Can you show me a URL that demonstrates the problem?


Alex

Offline

#88 2005-01-15 02:03:34

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Using urldecode() in zem_format_url will break if you have categories with spaces or other unusual characters.


Alex

Offline

#89 2005-01-15 02:09:01

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

zem, unfortunately I don’t have a live URL; my test server runs on a local machine here and isn’t publicly accessible. I can describe the setup, though, if that’ll help. In zem_rewrite I’ve got the following URL schemes in the following order:

$uri_scheme['weblog'] = '{section}/{date}/{article}/{title}';
$uri_scheme['article_urltitle'] = '{section}/{url_title}/';
$uri_scheme['category'] = '{section}/{category}/';
$uri_scheme['article_alt'] = '{section}/{article}/';
$uri_scheme['section'] = '{section}/';

Then I’ve got a ‘weblog_article’ form which has this:

<h2><txp:zem_permlink scheme="weblog"><txp:title /></txp:zem_permlink></h2>

What I’m getting from that is the following (actual URL it’s generating):

<h2><a href="/weblog/2005%2F01%2F06/9/blah-blah-update">Blah blah update.</a></h2>

Instead of

<h2><a href="/weblog/2005/01/06/9/blah-blah-update">Blah blah update.</a></h2>

And I know urldecode will break on some stuff, but thankfully I don’t use any funky category or section names ;)

Last edited by ubernostrum (2005-01-15 02:11:29)


You cooin’ with my bird?

Offline

#90 2005-01-15 02:28:47

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Ah, I see now.

Here’s a change that should fix it, I think. In zem_format_url, replace this:

$uri = str_replace('{'.$k.'}', urlencode($v), $uri);

with this:

$uri = str_replace('{'.$k.'}', ($k == 'date' ? $v : urlencode($v)), $uri);


Alex

Offline

#91 2005-01-15 02:31:36

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

That did the trick. Thanks for the quick response.


You cooin’ with my bird?

Offline

#92 2005-01-15 02:47:06

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

While we’re at it, zem_nav is misbehaving still… when it calls zem_permlink it’s getting bak a date-based URL, but the dates never change; it’s always ‘/1969/12/31/’. I’ve been looking over both plugins for about an hour now and can’t figure out why this is happening.


You cooin’ with my bird?

Offline

#93 2005-01-15 02:50:21

wilshire
Plugin Author
From: Akron, Ohio
Registered: 2004-08-27
Posts: 656
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

zem – how do you suggest dealing with a URL that matches a scheme yet is still invalid?

I assume that since the rewrite rule is sending everything through the index.php an Error Document Rule won’t do anything. Is there any way around this?

Thanks for the help…

Offline

#94 2005-01-15 03:21:49

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Curious. Date based permlinks work fine here. I’d suggest putting var_dump($thisarticle); at the beginning of the zem_permlink() function. See if there’s anything odd about the ‘posted’ value.


Alex

Offline

#95 2005-01-15 03:23:55

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Wiltshire,

That’s a job for another plugin, or some improvements to Textpattern itself. zem_redirect used to do the job, but it hasn’t been updated to work with zem_rewrite.


Alex

Offline

#96 2005-01-15 03:35:31

tmacwrig
Archived Plugin Author
Registered: 2004-03-06
Posts: 204
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

I’m not getting categories to work… my rewrite rules are standard, I think
<pre>$uri_scheme[‘article’] = ‘{section}/{article}/{title}’;
$uri_scheme[‘article_alt’] = ‘{section}/{article}/’;
$uri_scheme[‘category’] = ‘{section}/{category}/’;
$uri_scheme[‘section’] = ‘{section}/’;</pre>

And the URL http://workingidea.com/parallel/project/txp2txt does not end up setting the category to txp2txt (oh, and /parallel is just a subdirectory that txp is in). I’m not using url_titles

I’ve tried disabling $uri_scheme[“article_alt”] in hopes that it was the problem, but that did no good.

Offline

Board footer

Powered by FluxBB