Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#271 2005-08-16 15:22:32

boblet
Member
Registered: 2005-08-08
Posts: 53

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Hey Bauhouse,

one thing, you don’t have article names that have periods in them right? I’m actually trying to get about.en.php or about.en article titles going (for content negotiation), but get 404 errors. Using alphanumeric, – and _ works ok for me though. I think I need to edit one of the plugins huh.

I upgraded via SVN from RC4, and am running localhost on new versions of everything (apache2, php5) by the way – might not work for me either once I try to go live

peace – boblet

PS mmm, awabi sute-ki! ;-)

Offline

#272 2005-08-16 15:36:39

bauhouse
Archived Plugin Author
From: Abbotsford, BC Canada
Registered: 2004-06-29
Posts: 68
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

The other thing is that the hacks may not really be necessary, since you can get the plugin working for individual sections by editing the plugin with the following configuration for the home page only:

<pre>
$sections[‘default’] = ‘section_category_title’;
</pre>

So you could theoretically have a different url scheme for each section by editing the plugin and adding something like this:

<pre>
$sections[‘default’] = ‘section_category_title’;
$sections[‘articles] = ‘section_date_title’;
$sections[‘about’] = ‘title_only’;
$sections[‘downloads’] = ‘_file’;
</pre>

Hacking just makes it easier to choose the section/category/title permlink mode from the preferences tab.

Last edited by bauhouse (2005-08-16 15:37:28)

Offline

#273 2005-08-16 15:46:34

bauhouse
Archived Plugin Author
From: Abbotsford, BC Canada
Registered: 2004-06-29
Posts: 68
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

boblet, thanks for the tip. I don’t have periods in my article names. I am also running locally with the latest, except for apache2, and I can actually change the url scheme for the section to $sections['portfolio'] = 'section_date_title'; and $sections['portfolio'] = 'title_only'; and it works great! The only scheme that doesn’t appear to be working for me is the one I want: $sections['portfolio'] = 'section_category_title';.

Offline

#274 2005-08-26 13:59:29

tinyfly
Member
From: Dallas, Texas
Registered: 2004-05-10
Posts: 462
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

I have a weird problem. I am using rss_suparchive in my news section and have a years list. If I click on 2005 all 2005 articles should show but they don’t even though I have 32 2005 articles. (the url is www.mydomain.com/news/2005). If I click on 2004 all 39 2004 articles do apear. (the url is www.mydomain.com/news/2004). 2003 works also. If I disable sgb_url_handler 2005 works fine.

Any thoughts?

Last edited by tinyfly (2005-08-26 14:00:12)

Offline

#275 2005-08-27 05:38:10

boblet
Member
Registered: 2005-08-08
Posts: 53

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

After updating via SVN some of my changes to enable /section/category/title URLs (as per previously mentioned instructions) were removed, specifically in <code>taghandlers.php</code> this should appear after <code>if (empty($thisid)) $thisid = $ID;</code>:
<pre><code>if (empty($category)) { $Category1 = (!empty($Category1)) ? $Category1 : $category1; $Category2 = (!empty($Category2)) ? $Category2 : $category2; $category = (!empty($Category1)) ? $Category1 : $Category2;
}
</code></pre>

Next up, I’ve been trying to get language suffixes going so I can use Apache content negotiation. I discovered that with this plugin turned off that periods in “url-only title” work for most main clean URL modes. Hell, even slashes are accepted for modes with an ID number (<em><strong>!?</strong> arbitrary site structure plugin, anyone?</em> ;-) Unfortunately with this plugin on, any periods in the url-ony title will give 404s. So a quick scan of the plugin code and I found the function <code>sgb_url_handler_schemes_to_patterns</code>. I added a “\.” to the title array (first one) and we’re in business! It’s on line 122 or thereabouts.
<code>return str_replace(array(‘title’, ‘section’, ‘category’, ‘id’, ‘year’, ‘month’, ‘day’, ‘string’, ‘number’, ‘_author’, ‘_category’, ‘_section’, ‘_file’, ‘/’), array(‘([A-Za-z0-9-_\.])*’, ‘([A-Za-z0-9-_])*’, ‘([A-Za-z0-9-_\s])*’, ‘(\d)*’, ‘\d{4}’, ‘\d{2}’, ‘\d{2}’, ‘([A-Za-z0-9-_])*’, ‘(\d)*’, strtolower(gTxt(‘author’)), strtolower(gTxt(‘category’)), strtolower(gTxt(‘section’)), strtolower(gTxt(‘file_download’)), ‘\/’), $a);</code>

I now have /section/category/title.suffix clean URLs, eg /portfolio/print/sakura-flyer.en and /portfolio/print/sakura-flyer.jp. Cue the heavenly chorus!

<strong>Update</strong>: hrmm – it looks like the sgb_url_handler will 404 any titles lacking a language extension (rather than Apache taking over and redirecting to .en or .jp based on content negotiation), so I’m not there yet. Any ideas? I guess I’ll have to wait for Biff or someone who understands his code to offer a suggestion…

Last edited by boblet (2005-08-27 15:04:11)

Offline

#276 2005-08-27 16:37:35

bauhouse
Archived Plugin Author
From: Abbotsford, BC Canada
Registered: 2004-06-29
Posts: 68
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

boblet suggested I try turning on debug to see what’s happening with this plugin. I suppose I should have tried this before. It throws a lot of errors and warnings. Here are the top three:

<pre>
A problem occured while loading the plugin: sgb_url_handler -> Notice: Undefined index: PATH_INFO
A problem occured while loading the plugin: sgb_url_handler -> Notice: Undefined index: id
A problem occured while loading the plugin: sgb_url_handler -> Notice: Undefined index: category2
</pre>

And then there are warnings like this:

<pre>
Notice: Undefined index: mode in /Library/WebServer/Documents/dev/bauhouse.ca/public_html/textpattern/lib/txplib_misc.php(429) : eval()’d code on line 289
Notice: Undefined index: section in /Library/WebServer/Documents/dev/bauhouse.ca/public_html/textpattern/lib/txplib_misc.php(429) : eval()’d code on line 289
Notice: Undefined index: scheme in /Library/WebServer/Documents/dev/bauhouse.ca/public_html/textpattern/lib/txplib_misc.php(429) : eval()’d code on line 289
</pre>

…where these three errors are repeated several times (probably for each time the sgb_url_handler_permlink tag appears on the page).

With a clean install of Textpattern 4.0 (deanload), installing the sgb_url_handler plugin returns the following error in debug mode: A problem occured while loading the plugin: sgb_url_handler -> Notice: Undefined index: PATH_INFO

boblet, are you getting similar errors?

Last edited by bauhouse (2005-08-27 16:43:28)

Offline

#277 2005-08-28 01:59:18

boblet
Member
Registered: 2005-08-08
Posts: 53

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

<code>A problem occured while loading the plugin: sgb_url_handler -> Notice: Undefined index: PATH_INFO
A problem occured while loading the plugin: sgb_url_handler -> Notice: Undefined index: id
A problem occured while loading the plugin: sgb_url_handler -> Notice: Undefined index: category2
</code>

I think the PATH_INFO bit might refer to a change in the plugin code that Biff suggested. I had undefined index: category1 errors, and that led me to realise I needed to redo the taghandlers.php code changes. This plugin won’t work for section/category/title URLs on a default install without these changes, and there are more changes than indicated in the txt file (ie the category code I was missing above)

And then there are warnings like this:
<code>
Notice: Undefined index: mode in /Library/WebServer/Documents/dev/bauhouse.ca/public_html/textpattern/lib/txplib_misc.php(429) : eval()’d code on line 289
Notice: Undefined index: section in /Library/WebServer/Documents/dev/bauhouse.ca/public_html/textpattern/lib/txplib_misc.php(429) : eval()’d code on line 289
Notice: Undefined index: scheme in /Library/WebServer/Documents/dev/bauhouse.ca/public_html/textpattern/lib/txplib_misc.php(429) : eval()’d code on line 289
</code>

those look like errors loading the plugin, which is potentially a little more problematic

I’d suggest you:
  1. copy the settings you added to the sgb_url_handler plugin
  2. delete the plugin
  3. redownload, install and configure
  4. make the code changes to TxP, checking nothing is missed
  5. activate the plugin
  6. try again in debug mode, and report any errors back here

Here’s hoping Biff wasn’t crushed under a pile of legalese eh ;-)

Last edited by boblet (2005-08-28 01:59:48)

Offline

#278 2005-09-12 07:52:32

1beb
Plugin Author
From: Canada, Ontario, Toronto
Registered: 2004-11-22
Posts: 169
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Any word on this plug-in’s compatibility with Textpattern 4.01?

Offline

#279 2005-09-12 18:15:15

graeme
Plugin Author
Registered: 2004-06-21
Posts: 337
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

As sgb_url_handler isn’t txp 4.0.1 compatible and hasn’t been updated in a long time, I’m going to plug my new plugin where you can achieve the same result. It’s called gbp_faux_static and is txp 4.0.1 compatible.

Also sgb_url_handler is limited to certain url styles where as with gbp_faux_static you can use fully customisable urls which are defined in txp’s admin interface.

It works differently so it might not be what you’re looking for, but then again it might just be exactly what you’re looking for.

Offline

#280 2005-09-16 09:20:48

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Can you confirm that I can’t use sgb_url_handler anymore on 4.0.1?

I used it and had a problem with file download

I use also gbp_faux_static, but have to figure out how to set it… Now I’ll give it a real try.

Z-

Offline

#281 2005-09-16 16:57:40

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

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

I use sgb_url_handler 0.1.8.3 on TXP 4.0.1 and the file downloads work.I’ve set the matching mode to “best”.

Last edited by andreas (2005-09-16 16:58:07)

Offline

#282 2005-11-25 08:07:17

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

i didn’t find this elsewhere, but here’s a tip for all of you who are using stw_category_tree: change the line that says : hu.urlencode($sec)."/?"; to : hu.urlencode($sec)."/"; and then some lines down, change return tag(htmlspecialchars($title),'a',' href="'.$path.'c='.urlencode($cat).'"'); to return tag(htmlspecialchars($title),'a',' href="'.$path.urlencode($cat).'"');.

now you get nested categories in “clean” /section/category/ mode (as you would have expected if you were not using messy)

Offline

#283 2006-01-09 08:38:50

t1m
Member
From: Massachusetts, USA
Registered: 2004-09-11
Posts: 17
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Yeah so what about comments_invite? My comments invite link is still pointing to the last set permlink scheme set in the default txp preferences, and not the new scheme defined in sgb_url_handler .. I must be missing something .. ?


“You know you’ve achieved perfection in design, not
when you have nothing more to add, but when you have
nothing more to take away.” -Antoine de Saint-Exupery

Offline

#284 2006-01-09 13:01:09

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

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Yeah so what about comments_invite?

That link is generated by TXP and not by the plugin. The plugin only works where you can insert its tag. The TXP-generated links still adhere to the URL scheme set in the preferences.

Offline

#285 2006-01-09 13:18:04

t1m
Member
From: Massachusetts, USA
Registered: 2004-09-11
Posts: 17
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

That link is generated by TXP and not by the plugin.

So if you use this plugin you can’t have comments invite links that work?


“You know you’ve achieved perfection in design, not
when you have nothing more to add, but when you have
nothing more to take away.” -Antoine de Saint-Exupery

Offline

Board footer

Powered by FluxBB