Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2004-12-06 18:04:13

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

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

And to answer my own question, I added this to the top of my .htaccess file and when I go to mysite.com I’m back to getting my trusty old index.html.
<code>
AddType application/x-httpd-php .html .php
RewriteRule ^$ index.html [L]
</code>

Last edited by wilshire (2004-12-06 18:05:10)

Offline

#14 2004-12-10 03:47:56

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

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

When using zem_permlink it doesn’t seem to take into account what Section the article belongs to when clicking on it from the home page. I have a section called words that displays on the homepage and when I click on permalinks from there I get the Url of /default/article-id/article-title/ instead of /words/article-id/article-title/ The same article when clicked on from the words section page will give me the right section in the URL.

Do I have something setup wrong or is this a limitation of the system? I’m pretty much using everything in the default way. even if the section part is not totally fleshed out it is still very nice not to have to deal with section files.

Last edited by hakjoon (2004-12-10 03:48:59)


Shoving is the answer – pusher robot

Offline

#15 2004-12-10 05:15:32

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

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

It’s a bug. Working on a new releas.


Alex

Offline

#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

Board footer

Powered by FluxBB