Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#196 2005-06-23 16:58:57

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

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

Andreas, the mod doesn’t work for you on a fresh install of the latest rev ?

On the latest rev but it didn’t work back when we were still in the 200s revision numbers. Perhaps I’m missing something:

I compared the two functions in the two files (txp_prefs.php and taghandlers.php) that sgb changed and inserted only the lines that related to section_category_title; I didn’t change the lang file but that shouldn’t make a difference, should it?

Last edited by andreas (2005-06-23 16:59:19)

Offline

#197 2005-06-24 04:11:24

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

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

It may be an undefined index, but that shouldn’t stop it to work. No errors in your apache|php error log ?

Offline

#198 2005-06-24 09:18:58

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

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

No errors in your apache|php error log ?

I don’t know. How do I check these on a shared hosting account?

Offline

#199 2005-06-28 15:52:26

rob_roy
Archived Plugin Author
Registered: 2005-02-28
Posts: 18

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

“Feeds are generated based on the URL scheme set in the preferences and there it’s not possible to get section/category/title — so all URLs that are generated by TXP instead of by a plugin tag come out as section/title; ideally, sgb_url_handler would translate all these into the proper ones on the fly. It does this in theory but I can’t get it to work for all of my site.”

You should be able to define a custom URL scheme that will be used by the permlink tag, and therefor appear in feeds, by setting a custom_url_func. That way you’d be able to avoid editing the txp source. So you could set custom_url_func to run a custom function that generates section/category/title urls to appear in feeds, but continue to use mic_permlink anywhere you don’t want section/category/title. Unless, of course, I’m misunderstanding what you want, in which case I could be completely wrong. ;)

Last edited by rob_roy (2005-06-28 15:52:50)

Offline

#200 2005-06-28 16:18:58

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

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

rob_roy, that’s what I want but I don’t know much PHP so I don’t have a clue where to start with this.

Offline

#201 2005-06-28 16:21:04

starzabove
Member
Registered: 2004-04-13
Posts: 76

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

< bUmP >

Hi,
First off, sgb, THANK YOU- this solves so many problems for me!

Second, am I missing something? I did peruse pages of posts, but with this new version, should date-based urls also be working now in current versions of rc3?

Thanks!

Last edited by starzabove (2005-06-28 16:21:16)


90+ Textpattern installs and still going…

Offline

#202 2005-06-28 17:17:12

rob_roy
Archived Plugin Author
Registered: 2005-02-28
Posts: 18

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

> andreas wrote:

> rob_roy, that’s what I want but I don’t know much PHP so I don’t have a clue where to start with this.

Okay. So I have a little bit about this written up at Autonomous. That’s the beginning, at least. The only things that HOWTO doesn’t cover are mic_permlink, which you shouldn’t have to change, really, and the section/category/title link. So, where I talk about writing a plugin function called function “rtr_permlinkurl($article_array)” you would instead use a function that looked like

<pre><code>
function and_permlinkurl($article_array)
{ global $permlink_mode, $txpac;

extract($article_array); if (!isset($title)) $title = $Title; if (empty($url_title)) $url_title = stripSpace($title); if (empty($section)) $section = $Section; // lame, huh? if (empty($thisid)) $thisid = $ID; if (empty($category)) { $Category1 = (!empty($Category1)) ? $Category1 : $category1; $Category2 = (!empty($Category2)) ? $Category2 : $category2; $category = (!empty($Category1)) ? $Category1 : $Category2; } $category = (!empty($category)) ? $category.’/’ : ‘’; return hu.”$section/{$category}{$url_title}”; } </code></pre>

I really hope that code comes out readable. Anyway, you’ll put something that looks like the above into one of the many plugin forms that are out there and create your very own plugin. OR, there’s a method Mary (I think) mentioned lately where-in you just put it in a file and save it.

So you have your custom function, and you’ve set Textpattern to use your custom function whenever it calls permlink. So in feeds, you should get section/category/title permalinks. But elsewhere in txp, where ever you use mic_permlink, you’ll get whatever you’ve been getting already.

Offline

#203 2005-06-28 17:46:33

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

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

rob, thanks for that. I’ve tried it but without success. I’m a bit short on time at the moment so I’ll leave it at that. Thanks, again, for your help.

Offline

#204 2005-06-28 20:19:54

rob_roy
Archived Plugin Author
Registered: 2005-02-28
Posts: 18

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

When you have the time, let me know what does or doesn’t work. I’ll look into things.

Offline

#205 2005-06-28 20:46:10

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

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

What I did was: I took your code, pasted it into zem’s plugin template, compiled it, inserted the variable into admin_config and installed my plugin.

That didn’t have any result. Permlink just remained at section/title.

I have to say I did it in a hurry, so I might have made a mistake.

Offline

#206 2005-06-29 15:45:52

rob_roy
Archived Plugin Author
Registered: 2005-02-28
Posts: 18

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

Weird. I’m not sure what could be going on. The above function will default to section/title if there is no category assigned to the article, but it should work. I haven’t looked at the recent updates that moved admin_config variables into the db, so I don’t know if that’s changed anything.

My (messy) way to debug would be to go into the plugin and change
<code>return hu.”$section/{$category}{$url_title}”;</code>
to something like
<code>return “DEBUG”;</code>
just so I could see if the plugin was being successfully called. If it is, then after that change is made, feed permlinks would return something like “href=DEBUG” instead of anything useful. Obviously, you wouldn’t want to leave them that way, but then at least you’d be able to see that permlink was successfully calling and_permlinkurl. If and_permlinkurl is successfully being called, then I’ve flubbed up the code somewhere in it.

Last edited by rob_roy (2005-06-29 15:46:56)

Offline

#207 2005-07-01 02:47:03

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

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

Just updated to rev463 and now the following errors show up whenever sgb_url_handler is enabled:

Notice: Undefined index: PATH_INFO in /var/www/txprc3/textpattern/lib/txplib_misc.php(379) : eval()’d code on line 78
Notice: Undefined index: section_category in /var/www/txprc3/textpattern/lib/txplib_misc.php(379) : eval()’d code on line 136
Notice: Undefined index: section_title in /var/www/txprc3/textpattern/lib/txplib_misc.php(379) : eval()’d code on line 136

Do I have something misconfigured?

Last edited by ubernostrum (2005-07-01 02:47:23)


You cooin’ with my bird?

Offline

#208 2005-07-01 13:52:35

sungodbiff
Archived Plugin Author
Registered: 2004-03-23
Posts: 57
Website

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

ubernostrum -

They aren’t errors :) they’re notices. R463 changed the way errors, warnings and notices are displayed, it’s a simple fix, I’ll post an update once I update my install to 463.

Edit: Okie, dokie, it’s been updated on my site and the first post of this thread.

- sgb

Last edited by sungodbiff (2005-07-01 14:13:51)

Offline

#209 2005-07-01 14:13:13

sungodbiff
Archived Plugin Author
Registered: 2004-03-23
Posts: 57
Website

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

andreas & rob_roy -

&#60;txp:sgb_url_handler_permlink&#62; write URLs in whichever scheme you’ve defined in the config.

(If I’m understanding your questions correctly:)
The problem with RSS/Atom feeds is that they’re coded to use TxP’s built-in permlinkurl function which is based only on TxP’s Permlink Mode. So in order to use the plugin you’d need to go into textpattern/publish/rss.php and change references to <code>permlinkurl()</code> to <code>sgb_url_handler_permlinkurl()</code> — I think, I haven’t tested this though.

- sgb

Offline

#210 2005-07-01 16:17:55

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

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

I have a test install of 463 at dev.patetech.info/textpattern/ with production status set to production_debug and permlink mode set to /year/month/day/title. I just installed sgb_url_handler (0.1.8.4) and sgb_error_documents (0.1.2.2).

On the main index, http://dev.patetech.info/textpattern/, I am getting

  • Notice: Undefined index: PATH_INFO in /home/_/txplib_misc.php(379) : eval()’d code on line 79

On the entry page, http://dev.patetech.info/textpattern/2005/06/25/first-post, I get

  • Notice: Undefined index: PATH_INFO in /home/_/txplib_misc.php(379) : eval()’d code on line 79
  • Notice: Undefined variable: section in /home/_/txplib_misc.php(379) : eval()’d code on line 225
  • Notice: Undefined variable: category in /home/_/txplib_misc.php(379) : eval()’d code on line 225

Maybe this will help with further development.

Offline

Board footer

Powered by FluxBB