Topic: Please Add Support For Absolute URLs

First of all, let me say that I am very impressed with your product. It is great!

I have one feature request that I consider very important.

I have just gone through my entire punBB installation searching for every href, src, and action element and I added a simple variable to the front.

Meaning: In common.php added (I realize I could have used $pun_config['o_base_url'] but I wanted to keep the two separate in case one needed to change while the other didn't):

$link_base = 'http://mysite.com/forum/';

Then for each href, src, and action element, I added the following code to the entire site:

<?php
echo '<a href="' . $link_base . 'page.php?var=1">';
?>

or

<a href="<?php echo $link_base; ?>page.php?var=1">

depending on where the variable needed to be placed.

I can tell you that it was a huge pain for something that should be included by default into the package.

Absolute urls provide many advantages (as do relative urls). It seems to me that absolute and relative often depends on the developer/designer's preference. This would be an easy addition to 1.3 and it would definitely make life much better for me.

As a final reason to help encourage the addition of absolute URLs, I will leave you with a quote from GoogleGuy (a Google employee who visits web developer message boards and sometimes gives advice about how to develop a site).

Googleguy wrote:

absolute links have less potential for getting messed up. Even though it shouldn't make a difference, I recommend absolute links.

Original Post: http://www.webmasterworld.com/forum3/21364-3-10.htm
Other Documentation :: GoogleGuySays Website: http://www.markcarey.com/googleguy-says … donts.html

If it's good enough for GoogleGuy, it's good enough for me. Hopefully you will consider the advantages of adding absolute URLs to the package (if nothing else it may help to get PunBB higher in the search engines resulting in making it even more popular).

As you can see, I am trying to do everything I can to convice you (Adding absolute URLs to Mods makes me even more desperate for this feature). Hope I convinced you. Let me know.

Re: Please Add Support For Absolute URLs

(if nothing else it may help to get PunBB higher in the search engines resulting in making it even more popular)

PunBB is already very high in the search engines: just check out how many pages are indexed on this forum alone smile

And absolute URLs have the disadvantage that if you, say, change the folder it's in, all the stuff dies
Or if you have 2 URLs it's possible to access it from

3 (edited by agraddy 2006-01-25 12:11)

Re: Please Add Support For Absolute URLs

The first disadvantage you mentioned is easily dealt with with my code. If the forum changes folders, you just change the $link_base variable and everything is immediately updated.

As for 2 URLs, I guess one of my main focuses is SEO, so having 2 URLs in the first place is a very bad idea.

I agree with you that there are also advantages to having relative URLs, but there are also advantages to have absolute URLs. For instance, Apache's mod_rewrite plays much nicer with absolute URLs than it does with relative URLs.

I realize that some people prefer absolute URLs and some prefer relative, I'm justing asking that those of us who prefer absolute URLs to be able to have that option without going through tons of time updating the code (especially since it would be a real easy fix).

With my above code, if someone wants relative URLs, you just set $base_link = ''.

Re: Please Add Support For Absolute URLs

You could always just try adding somthing like following to the <head> of the main.tpl:

<base href="http://www.domain.com/somefolder/" />

Then all relative URI's will use the above URL as a base. Quick & simple, though I think I can see a few situations where this could case a few problems (mainly the referer checks).

5

Re: Please Add Support For Absolute URLs

If base_href always points to the index page then there is one problem in that it stops page anchors from working. You click on on internal page link anywhere on the board and you end up back at the index page. We are having this problem with 1.3 and skip links. This could potentially cause a problem with site integration where the sites pages use a lot of page anchors.

Re: Please Add Support For Absolute URLs

That's one more reason why it needs to be included in the coding package itself.

Re: Please Add Support For Absolute URLs

agraddy wrote:

That's one more reason why it needs to be included in the coding package itself.

No, the fact that it hurts integration is a reason why it shouldn't tongue

8

Re: Please Add Support For Absolute URLs

Smartys: I think the point agraddy was making was that the url should be available via a variable because unlike base_href it doesn't have any knock on effects.

Re: Please Add Support For Absolute URLs

Ah, my bad smile

Re: Please Add Support For Absolute URLs

Switching to absolute URLs should be very easy in 1.3. At least for the non-admin part of the forums.

http://dev.punbb.org/file/branches/punb … ewrite.php

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Please Add Support For Absolute URLs

Switching to absolute URLs should be very easy in 1.3. At least for the non-admin part of the forums.

http://dev.punbb.org/file/branches/punb ? ewrite.php

Can I use this on Punbb 1.2.11?

Will I be able to update from 1.2.11 to 1.3 with not too much pain?

Thanks

Re: Please Add Support For Absolute URLs

No, you can't use it with 1.2.* and yes, you will be able to update rather easily. You will probably lose any mods you've applied though.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Please Add Support For Absolute URLs

could you pull a dev version archive of that so we dont have to download each file individually over your web viewer?

Re: Please Add Support For Absolute URLs

Hrmm, I'd rather have all relative URLs with PUN_ROOT.

15 (edited by MadHatter 2006-07-02 19:34)

Re: Please Add Support For Absolute URLs

I'd rather have built-in absolute urls (as is in 1.3) then have to replace the entire output buffer with static urls.  then again, I thought thats what this topic was about.