Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2004-12-10 06:16:51

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

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

I’m having a problem with the dca_mailto_form and this plugin. The mailto form posts to <code>$_SERVER[‘PHP_SELF’]</code> which of course gets routed through index.php and the form never actually posts.

I fixed this by changing the plugin to post to the write URL, but is there another way around this?

Offline

#17 2004-12-10 07:15:50

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

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

zem_contact works fine with the rewrite plugin. You could use that, or change dca_mailto to use $_SERVER[‘REQUEST_URI’] instead.


Alex

Offline

#18 2004-12-10 16:36:07

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

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

OK, thanks zem. I’ll give both a try. I’ve been meaning to take zem_contact for a spin anyway.

Offline

#19 2004-12-10 23:18:30

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

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

Version 0.5

Should fix the bogus ‘/default/’ in article links with the zem_permlink tag.

Also adds a simple 404 handler for URLs that don’t match one of the defined schemes.

This version includes a check of the script filename that might fail if there’s something wrong with your doc_root or subdirectory settings. It should work fine on a properly configured install, but I’ve kept a link to the previous version just in case.


Alex

Offline

#20 2004-12-10 23:45:59

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

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

That Seems to have done it, no more default section showing up.

The 404 Handler doesn’t seem to do anything for me, but we already have zem_redirect for that.

Thanks for all the great work with this.


Shoving is the answer – pusher robot

Offline

#21 2004-12-11 01:15:37

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

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

The 404 handler only deals with URLs that don’t match one of the defined schemes. It doesn’t check whether the articles, sections, categories, etc actually exist. That’s a job for something like zem_redirect, as you say.

Try something like http://example.com/ajsdjasdf.txt or http://example.com/blah/blah/blah/blah/blah and you should see it kick in.


Alex

Offline

#22 2004-12-12 03:20:11

JamiLSDD
New Member
From: Massachusetts
Registered: 2004-07-02
Posts: 2

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

I possibly found a bug with the plugin. Prior to installing it (works great so far!), I was using my default page to make my main page display the excerpts, then the full article called a seperate form that isn’t the default to display what I wanted. The default page has this:

<code>
<txp:article form=“art_full” listform=“art_excerpt” limit=“5” />
</code>

After installing the plugin, I noticed that once I clicked on the perm link , the article was no longer using the art_full form I specified, but the default form. I changed the perm link to the new tag (sem_permlink), but it had no affect, it’s still using the default form. Has anyone had this problem, and if so, how did you fix it? If not, any suggestions?

TIA.

Jami


If at first you don’t succeed, try, try again.
And if it still doesn’t work, shoot it and find something new!

Offline

#23 2004-12-13 00:19:10

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

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

> After installing the plugin, I noticed that once I clicked on the perm link , the article was no longer using the art_full form I specified, but the default form. I changed the perm link to the new tag (sem_permlink), but it had no affect, it’s still using the default form. Has anyone had this problem, and if so, how did you fix it? If not, any suggestions?

I’m a bit puzzled by this. zem_rewrite and txp:article are independent.

Are you certain that the correct page template is being displayed? It’s not using a different template that contains a different txp:article tag?

Easiest way to check is to put something like <!-- mytemplatename --> in each of your page templates.


Alex

Offline

#24 2004-12-13 22:11:46

jimb
Archived Plugin Author
From: Chicago, IL, USA
Registered: 2004-07-22
Posts: 27
Website

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

I have a few suggestions for future versions. I’ve hacked these features into my copy of your plugin like so:

Side note: here are my url-schemes:
$uri_scheme[‘article_urltitle’] = ‘{section}/{category}/{url_title}’;
$uri_scheme[‘section’] = ‘{section}/’;
$uri_scheme[‘category’] = ‘{section}/{category}’;

The first thing I changed was the URL generation code to add a category to a link only if one was set. I have my site set up like this:

About
Work: *Web *Print *Identity
Contact

I’m using sections for the main areas, and categoriess for the subsections of Work. The problem is that when I specify for zem_permalink to create link to an article that is not in a category, such as the ones in the About and Contact sectioons, it inserts “{category}” even thought none of the articles in that section have one.

Here is the code:

if ($url_mode 1) { $uri = $uri_scheme[$type]; foreach ($components as $k=>$v) { if (!empty($v)) $uri = str_replace(‘{‘.$k.’}’, $v, $uri); if ((empty($v)) && $k = “category”) { $uri = str_replace(‘{category}/’, ‘’, $uri); } } }
==

The second change was to the id retreval code. I added a little logic to detect whether a category was included in the url, and if so, adds that to the id retreval criteria. The problem I was having is that I have done both web and print work for some clients, giving uris such as /work/web/clienta and /work/print/clienta. the problem is that since they both have the same url_title, only one article is showing up in both places. Here is my fix:

== if (!empty($url_title) and empty($id)) { if($c) { $rs = safe_column(‘ID’, ‘textpattern’, “section=’”.doSlash($s).”’ and category1=’”.doSlash($c).”’ and url_title=’”.doSlash($url_title).”’ and Status=4 and Posted < now()”); } else { $rs = safe_column(‘ID’, ‘textpattern’, “section=’”.doSlash($s).”’ and url_title=’”.doSlash($url_title).”’ and Status=4 and Posted < now()”); } if ($rs and is_array($rs)) { $id = array_pop($rs); $_GET[‘id’] = “$id”; $GLOBALS[‘id’] = “$id”; } }

There are still a few drawbacks, such as categories being unable to share a title with an article, but I think it’s an ok restriction.

Overall, an excellent plugin. It’s made me much happier with my site, and especially its uris.

Last edited by jimb (2004-12-13 22:15:24)

Offline

#25 2004-12-13 22:21:19

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

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

> The problem is that when I specify for zem_permalink to create link to an article that is not in a category, such as the ones in the About and Contact sectioons, it inserts “{category}” even thought none of the articles in that section have one.

Good point. I’ve added a more general fix for this kind of problem. It’ll appear in the next release.

> The second change was to the id retreval code. I added a little logic to detect whether a category was included in the url, and if so, adds that to the id retreval criteria.

I’m working on a new plugin that does the job of retrieving articles. I’ll incorporate the idea.

Thanks,
z.


Alex

Offline

#26 2004-12-14 22:31:04

andreas
Member
Registered: 2004-02-28
Posts: 453
Website

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

I can’t seem to get this to work. I installed v0.5 and replaced my old permling tags with <txp:zem_permlink>.

I edited the plugin code to eliminate the ID and the permlinks appear on my front page but if I call an article I get a 404.

I also get one if I don’t modify the default permling structure of the plugin.

My TXP install runs on a subdomain (notes.andreas-kalt.de) if that is of any importance.

Any suggestions are appreciated. This is a cool plugin and I’ve been waiting for something like this for ages. Thanks zem!

Last edited by andreas (2004-12-14 22:32:11)

Offline

#27 2004-12-14 23:06:24

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

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

Did you install the Rewrite stuff in .htaccess?


Alex

Offline

#28 2004-12-15 04:29:52

babeskidoodle
New Member
Registered: 2004-11-22
Posts: 4
Website

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

I’ve got this installed and working great except for categories. how do I replace the txp:category_list?

also should I convert from zem_link to zem_permlink? zem_link seems to work find but just thought I’d check.

thanks

Last edited by babeskidoodle (2004-12-15 04:30:12)


charlie

Offline

#29 2004-12-15 11:05:05

andreas
Member
Registered: 2004-02-28
Posts: 453
Website

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

zem, I did replace my .htaccess entries with the code that comes with the plugin.

Offline

#30 2004-12-15 12:16:10

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

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

Andreas,

It looks like the rewriterules are being ignored for some reason. It’s possible the subdomain has something to do with it. Is your subdomain set up as a subdirectory in your main site’s document root? Is there a .htaccess file for your main site as well as for the subdomain?


Alex

Offline

Board footer

Powered by FluxBB