Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
Andreas –
Sorry for the confusion, I want to make the instructions clearer, so any suggestions you have will definitely help. Here goes:
function sgb_error_documents_config() // array
{
// 404 File Not Found
$sgb_config[‘error_documents’][‘404’][‘id’] = null;
$sgb_config[‘error_documents’][‘404’][‘url’] = null;
$sgb_config[‘error_documents’][‘404’][‘file’] = null;
$sgb_config[‘error_documents’][‘404’][‘text’] = null;
// 403 Forbidden
$sgb_config[‘error_documents’][‘403’][‘id’] = null;
$sgb_config[‘error_documents’][‘403’][‘url’] = null;
$sgb_config[‘error_documents’][‘403’][‘file’] = null;
$sgb_config[‘error_documents’][‘403’][‘text’] = null;
return $sgb_config;
}
Just change null to the value you wish to configure, I think examples might help:
If I want to have 404 errors point to a post on my site (the post is id 40):
$sgb_config[‘error_documents’][‘404’][‘id’] = 40;
$sgb_config[‘error_documents’][‘404’][‘url’] = null;
$sgb_config[‘error_documents’][‘404’][‘file’] = null;
$sgb_config[‘error_documents’][‘404’][‘text’] = null;
If I want to have 404 errors redirect to another page on my site:
$sgb_config[‘error_documents’][‘404’][‘id’] = null;
$sgb_config[‘error_documents’][‘404’][‘url’] = ‘http://example.com/404.html’;
$sgb_config[‘error_documents’][‘404’][‘file’] = null;
$sgb_config[‘error_documents’][‘404’][‘text’] = null;
If I want to have them include a file from my site (realitive to the main index.php file):
$sgb_config[‘error_documents’][‘404’][‘id’] = null;
$sgb_config[‘error_documents’][‘404’][‘url’] = null;
$sgb_config[‘error_documents’][‘404’][‘file’] = ‘path/to/some/file.php’;
$sgb_config[‘error_documents’][‘404’][‘text’] = null;
If I want to display an different bit of text from the default message:
$sgb_config[‘error_documents’][‘404’][‘id’] = null;
$sgb_config[‘error_documents’][‘404’][‘url’] = null;
$sgb_config[‘error_documents’][‘404’][‘file’] = null;
$sgb_config[‘error_documents’][‘404’][‘text’] = ‘The file wasn\‘t found.’;
Basically you only configure the setting you want to use. If multiple settings are configured, the plugin uses the first setting in the order ID, URL, File, Text.
I hope that helps clear things up.
- sgb
Offline
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
Ok, I see. That makes it clearer. Works now.
Perhaps you should include the above examples in the help document of the plugin. For example, I wouldn’t have known that I need to put quotation marks around the URL and the paths.
Offline
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
I noticed another thing:
I use zem_rewrite for permalinks and use a different URL scheme for my blog than for the rest of the site (I only noticed that that was possible when mic_permlink didn’t work for me).
The scheme for most of the site is /section/category/title
for the blog it’s /section/year/month/day/title
in the TXP preferences I have /section/title (although other schemes don’t make a difference)
Now, when I have sgb_error_document enabled, it shows the error page when I try to call a URL from the blog.
Any ideas?
Offline
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
Andreas -
/section/year/month/day/title isn’t supported by sgb_url_handler, it’s supported by zem_rewrite. However when sgb_url_handler is opperating in proper mode it sees the URL as invalid and generates a 404.
I’m thinking this could be avoided if there was a way to control the order in which plugins are executed but unfortuately we can’t do that (yet — hopefully this will be added to TXP at some point).
I’ve got a fix in mind 0.1.6 will be released in the next few days, in the mean time I think you’ll need to disable the 404.
- sgb
Offline
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
The problem is, for some reason zem_rewrite stopped working just an hour ago. It just doesn’t parse the urltitle anymore. So I switched to mic_permlink and modified it to support /section/year/month/day/title.
Any chance that your verion 1.6 might support that? I would love you for it ;-)
Offline
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
sgb, on your site you explain a manual hack to TXP (taghandlers.php, mostly) to get section/category/title to work natively.
I tried it but it doesn’t work. The feeds and comment_invite etc. all put out section/title instead.
Does it work for you? I’d be glad about a clarification. Some of my URLs break when they’re called from a feedreader because of this.
Offline
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
Andreas -
Check out http://mighthitgold.net/atom and http://mighthitgold.net/rss
I haven’t noticed any inconsistencies with the links, I don’t have comments enabled on any of my posts but I’ll look into it and see if I can figure out what’s going on.
- sgb
Offline
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
sgb, I think I was unclear:
I edited taghandlers.php and txp_prefs.php as you described and chose section/category/title as the URL scheme in the prefs.
But in the feeds, TXP doesn’t send the links with this scheme. Instead, the links there have section/title as their scheme. The feeds themselves are ok, just the URLs in them do not correspond to the choice in the prefs.
Another thing, I’d find it wonderful ir sgb_error_documents could work with rss_suparchive. I’ve got an archive made with rss_suparchive that has the URL scheme /year/month and sgb_error_documents redirects to the error page when I call it, so I can’t use your plugin at the moment.
Just an idea. Thanks.
Offline
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
For some reason my qDT does not work with the latest RC3 and sgb_url_hanler 0.1.5. 0.1.4 does not work either. 0.1.3 works just fine. Oddly enough I have a very similarly architected TXP site and it works just fine with 0.1.5 and the latest TXP RC3.
Here are the plugins that I have installed on the site that does not work with 0.1.4 or 0.1.5:
- mdm_if_category 0.4
- ob1_changecase 0.2
- ob1_if_section 0.2
- ob1_title 1.4
- sgb_error_documents 0.1.1
- zem_contact 0.6
I’m using one template page with if_section and if_category conditions. I also have a few if_articlelist and if_individual_article conditions here and there.
When I install 0.1.4 or 0.1.5 all of my pages work fine (category lists, article lists) except for the individual article pages. They just come up blank. I have a feeling that this new plugin is interfering with the way I have my if_individual_article conditions. I tried disabling the if_category plugin but it works exactly the same.
Right now my site is running 0.1.3 so that my users can still get at the info that they need.
Any ideas?
Offline
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
sungodbiff, thanks for the plugin!
I’m testing it on a server without Mod_Rewrite and it works fine. 0.1.5 plugin and latest RC3.
It’s great to be flexible with ones links.
Remains all the other relative references, like image urls..
I inserted nearly all images in the site relative to index.php. They all work in messy mode.
The images inserted on the page templates and on the CSS are fine with different permlink-modes. So are the ones with absolute paths of course. They adapt to the changes – (like the urls in your plugin).
But if I change the url to anything else than messy, relative image paths in forms and articles are broken! Even TXP images.
I know this has’nt been the goal for your plugin but it would be great if something could make ALL paths work in different modes -not just links..
It might be an obvious mistake I make, I appologize if this has been mentioned earlier, (search has been down). In that case, I would mutch appreciate if someone who knows of a fix to the problem would point me in the right direction – thanks.
Offline
#83 2005-04-09 14:06:07
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
That would happen even if you used static pages. Use a url relative to root instead.
Example:
absolute
http://yoursite.com/folder/file
relative, will only work inside “folder”
file
relative to root (notice starting slash)
/folder/file
Offline
Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time
I have done some testing now.
earlier i posted that i couldnt get my conditonals to work on my dev machine (windows XP), but they where working just fine on my other machine (Linux).
This is what i have come up with.
when requesting the url http://example.com/section/urltitle
then when i do <code>print_r($parts);</code> i get this on my Windows machine
<code>
Array
(
[0] => ection
[1] => urltitle
)
</code>
and this on my linux machine
<code>
Array
(
[0] => section
[1] => urltitle
)
</code>
so on my windows machine this plugin never gets the right section name.
But when iam changing this line
<code>
$script_path = trim(dirname($_SERVER[‘SCRIPT_NAME’]), ‘/’);
</code>
to this instead (changed to a backslash instead)
<code>
$script_path = trim(dirname($_SERVER[‘SCRIPT_NAME’]), ‘\’);
</code>
then everything is working fine on my windows machie too.
Just a note to others that having problems with their conditionals with this plugin.
Johan Nilsson
Offline