Recent Topics

1 Aug 23, 2005 21:40    

Hey Guys,

Well you haven't banned me from posting yet, so here's another bug (or at least undesireable behavior).

It seems that under certain circumstances (namely mine ;-)) a lot of the generated links are broken. I've found a workaround (listed below) but i think this needs to be adressed in a more systematic way. There's somethign fundamentally weird about how links are generated when the blog's domain is different than the server's domain.

Most our blogs have their own domains that are different than the domain of the server as given in $baseurl. e.g.:
$baseurl = ‘http://www.mainservername.com/scripts/blogs/’

The blog’s domain is http://www.blogname.com

Any links generated with a direct or indirect call to regenerate_url() such as posts_nav_link() are broken.

regenerate_url() creates a relative link – i.e.
‘/?blog=8&page=1&paged=2’

but the browser interprets this link as:
‘http://www.mainservername.com/?blog=8&page=1&paged=2’
(a broken link)

instead of:
'http://www.blogname.com/?blog=8&page=1&paged=2’

The reason this happens is due to a base tag in the blog skin.
<base href="<?php skinbase(); ?>" /> that tag outputs the following
<base href="http://www.mainservername.com/scripts/blogs/skins/skinname/" />
the browser interprets a relative link beginning with a / to begin at http://www.mainservername.com/ - hence the broken link.

The way I work around this is by calling functions such as posts_nav_link() with vars to override the default behavior. e.g.:

old way:
<?
posts_nav_link();
?>

new way:
<?
$blogURL = $Blog->get( 'siteurl' );
posts_nav_link(' :: ','#','#', $blogURL);
?>

Though this work around seems to work for now it doesn’t seem like a good solution and I wonder how far I’ll be able to take it before it all goes to pot.

Let me know if this sense. I've been staring at this stuff for awhile.

Take care,
- Matt

2 Aug 23, 2005 22:19

Here's another instance of this (with workaround). In the same environment (blog with diff domain than server), if a user leaves a comment they are redirected improperly after submitting it.

The code responsible is /skins/_feedback.php:160
<input type="hidden" name="redirect_to" value="<?php echo regenerate_url() ?>" />

Changing it to this fixes the problem:
<?
$blogURL = $Blog->get( 'siteurl' );
$redirectURL = regenerate_url('', '', $blogURL);
echo "\t\t\t<input type=\"hidden\" name=\"redirect_to\" value=\"$redirectURL\" />\n";
?>

just in case anyone else suffers from this...

- M

3 Aug 23, 2005 22:42

As you've found out, the current version of b2evolution doesn't support having blogs on seperate domains or subdomains. The new version (due out within a month) will support this fully.

4 Aug 23, 2005 22:56

I think matthius is playing with the CVS version based on his theoretical $baseurl having a trailing slash. IF that's the case then this might be a "bug" (and I use quotation marks to indicate that I use the term *extremely* loosely) in the CVS version. The problem with calling it a bug is that CVS is, by design, not ready for prime time. Rather than calling it a bug, assuming this is CVS that matthius is refering to, call it a "less than ideal situation". That's fair eh?

So matthius: are you playing with CVS or are you expecting the latest production release to work with different domains and/or subdomains? In the first case I reckon the-powers-that-be will see this and take note. In the second case, well, search for solutions based on using .htaccess to solve the problem. I think Isaac handled all this very well, but I could be very wrong.

5 Aug 24, 2005 22:02

Hey Guys, I'm sorry I forgot to put my version info in that post.

I am indeed using the CVS version - downloaded 2005.08.15.

I have been running hacked CVS versions for around 6 months now. I have 5 blogs all with different domains. I'm aware of the inherent issues with using CVS versions in production environments but I've been fairly successful thus far. I like to contribute to the development effort by writing up my problems and the workarounds I find (if any).

Take care,
- Matt

6 Aug 24, 2005 22:19

I'm not on the dev team but I'm pretty sure they appreciate the feedback. It's possible the issue was known about and is already fixed, but I can't say with any certainty. All I do is tinker around the edges...

I've been looking at the latest CVS a lot lately. You probably already know this, but it changes daily. I saw a feature show up that I thought was way cool only to see it go byebye the next day. I hope it comes back!

7 Aug 24, 2005 23:13

Ah yes I know of the temporal nature of CVS. Typically I find a relatively stable version and then hack it myself or apply patches from the newer versions manually if i need them. This is only the third CVS version I've deployed, until now I was just hacking a version from January.


Form is loading...