Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs
That did the trick. Thanks for the quick response.
You cooin’ with my bird?
Offline
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
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
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
Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs
As always, Zem you are the man :)
I’m sure this is a stupid question, but I can’t find the answer.
How do you handle navigation (as in rendering hypertext lists of sections, nested categories, breadcrumb and so on) with the rewrite engine ?
Offline
#98 2005-01-15 07:28:13
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs
tmac,
I’m not sure what’s going on there. Everything else looks like it works. If the subdirectory was causing a problem it would also break other kinds of links.
I just double checked, and categories with numbers in their names work fine here.
Try this in your page template, and see what it outputs on the category page:
<?php echo "category=".gps('c'); ?>
Alex
Offline
#99 2005-01-15 07:36:21
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs
Jeremie,
You’d need plugins to do that kind of thing.
It’s easy enough to write a plugin that works with zem_rewrite. It has two functions for generating links: zem_format_link($scheme, $text, $components), which returns a complete <a href> tag, and zem_format_url($scheme, $components), which returns just the URL.
$scheme is the name of the URL scheme (i.e. ‘article’, ‘category’, etc). $components is an array containing all the necessary parts, e.g. array(‘section’=>‘mysection’, ‘category’=>‘mycategory’). Check zem_permlink() etc for more detailed examples.
Alex
Offline
#100 2005-01-15 19:15:37
Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs
Zem, if possible, could we have a version of <txp:comments_invite /> using your plugin? :)
Justin
Offline
#101 2005-01-15 21:45:24
Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs
zem, I figured it out (finally!)
also, let this be a note to other people having trouble with categories: if you had been using textpattern’s usual rewrites before, with the holder files and all, you need to delete those files (the text files with no extension), or your install will still use them and it wouln’t recognize the cat name.
Offline
#102 2005-01-15 22:17:52
Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs
And you need to set the URL scheme to “clean”. I lost 41 minutes (I counted :p) yesterday hammering my server and the rewrites rules, before I figure that out :-/
Offline
#103 2005-01-16 14:48:13
Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs
I’m trying out the plugin at the moment and I want my URLs to look like this:
(1) www.domain.de/section/category/url-only-title/
or, if no category is set
(2) www.domain.de/section/url-only-title/
The first version works fine, the second one causes problems: no articles appear.
Is there a way to use this without having to give each article a category?
This is the URI scheme I use in the plugin:
<code>
$uri_scheme[‘article_urltitle’] = ‘{section}/{category}/{url_title}/’;
$uri_scheme[‘category’] = ‘{section}/{category}/’;
$uri_scheme[‘article’] = ‘{section}/{url_title}/’;
$uri_scheme[‘section’] = ‘{section}/’;
</code>
I noticed that I can get (2) to work if I swap lines 2 and 3 but then, of course, (1) doesn’t work anymore.
I should add that I use this together with the swf_if_empty plugin and my article form looks like this:
<code>
<pre>
<txp:swf_if_empty field=“category1”>
<h2>
<txp:zem_permlink scheme=“article”>
<txp:title />
</txp:zem_permlink>
</h2>
</txp:swf_if_empty>
<txp:swf_if_not_empty field=“category1”>
<h2>
<txp:zem_permlink scheme=“article_urltitle”>
<txp:title />
</txp:zem_permlink></h2>
</txp:swf_if_not_empty>
<p><txp:excerpt /></p>
</pre></code>
Any solution to this? Thanks.
Last edited by andreas (2005-01-16 14:53:10)
Offline
#104 2005-01-16 20:40:47
Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs
Sorry, me again.
I love this plugin, but two things are left to be cleared up.
One is the category problem (see my post immediately above this one), the other is that my search doesn’t work .
I doesn’t matter if I use the built in search input form or my own that calls its own section like so /search/index.php, I get a 404.
I even tried putting an old-style placeholder file for just this section in the root plus an addition to .htaccess. This way, I got the right page template but not results in it .
Last edited by andreas (2005-01-16 20:44:27)
Offline
#105 2005-01-17 00:34:27
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs
Andreas,
I use “/search/” as the input form action. Easiest way to do that is by putting this into a txp form:
<form action="/search/" method="get"><input type="text" name="q" value="" size="12" /></form>
..and use <txp:output form form="mysearchform" /> to display it.
As for categories: One way around the problem would be to add something extra to one of the two URL schemes, so that they are no longer ambiguous. For example:
$uri_scheme[‘category’] = ‘{section}/cat/{category}/’;
..or:
$uri_scheme[‘article’] = ‘{section}/article/{url_title}/’;
You could use any string in place of ‘cat’ or ‘article’, provided it doesn’t clash with anything else.
Alex
Offline