Only fill this in if you're a spammer huh? Your name :
Your email :
Your message :
Jan
21st
2007

Relative links with B2evolution

Posted in : Plugins & Widgets

I don't know about you lot, but one of the things that I dislike about b2evolution is the fact that you have to use absolute urls in your posts. This is great if your blog always remains on the same (sub)domain, but if you ever want to move it then you're screwed! Up until now your only recourse was to either hit the database and change all of the affected urls in your posts or to manually edit each of your affected posts in admin. Not exactly user-friendly and it pretty much goes against the grain of how a website should be coded in the real world.

I've always coded my websites with relative links as it makes them truly "portable" and it's a habbit that I've continued with my blogs by hacking the bbcode plugin to allow me to use http://site/ to point to my blogs $baseurl ..... which worked right up to the moment when I merged two of my blogs that reside on two totally seperate domain names ( InnerVisions and WafflesOn ). Rather than piss about with the bbcode plugin (and have to reapply the hacks on every upgrade) I created a shiny new plugin to cope with my current needs. Basically this plugin adds 3 "special urls" that I can use for my posts to keep my links as relative as possible

http://site/
This gets converted into the posts blog url, so I can now make links relative to the individual blogs folder
http://base/
This gets converted into the $baseurl, so now I can make links relative to my install folder, which in my case is the same folder, but on a less trick install these could be different.
http://media/
Spookily enough, this gets converted into $media_url, just to make it a smidge simpler for me to move my media folder if ever the occasion arises.

Hopefully a certain unamed yank will get the time before the next ice-age to do a full write-up on AstonishMe, but if you want to have a play with this plugin in the meantime then you can find it here. You can't help but notice that I've dumped it in my media folder in a demonstative kind of way ;)

Have fun
¥

*edit*

Cured a minor bug in admin, zip file updated 31st Jan

Trackback URL (right click and copy shortcut/link location)

Trackback url for this post
Note : This trackback url is time limited so use it within 30 minutes or the SpamHound will snarl at you.

http://waffleson.co.uk/z/?k=36262602633103238043755f43af15c5f8d4886994299cda0

Leave a comment

Your email address will not be displayed on this site.
Your URL will be displayed.
About you

Just fill in the bits you want, none of it is required



Your email address will only be used to send you adverts for viagra and rolex watches.



(Line breaks become <br />)
Leave a comment
Code:
=> :!: :?: :idea: :) :D :p B) ;) :> :roll: :oops: :| :-/ :( >:( :'( |-| :>> ;D :)) 88| :lalala: :crazy: >:XX :o