Topic: Base forum url?

Which is the php variable in punBB that contains the base forum url?

I want to use it in parser.php to add ' target="blank" ' for external links.

2

Re: Base forum url?

$pun_config['o_base_url']

3 (edited by Lucas Malor 2007-10-04 14:44)

Re: Base forum url?

Thanks :-)

If someone is interested in my MOD, here is:

http://punbb.org/forums/viewtopic.php?p … 32#p101432

Re: Base forum url?

That breaks XHTML 1.1 strict validity, are you aware of that?

Re: Base forum url?

It will be on xhtml 2.0 . Furthermore, if I can do something without Javascript, I fell more happy ^____^

PS: please post any question on the proper thread, I wouldn't split the discussion :-)

http://punbb.org/forums/viewtopic.php?p … 32#p101432

6

Re: Base forum url?

JS keeps it compliant, however. smile Using Xhtml 2.0 as an argument is a bit moot, btw. smile

7 (edited by Lucas Malor 2007-10-05 09:43)

Re: Base forum url?

Actually I don't think I can use target as an attribute, and certainly IE6 can't interpret it.

When xhtml 2.0 will be interpreted by 99% of browsers (as xhtml 1.0 I think), I'll use target as attribute. Actually, I prefer to do a little incorrectness instead of using JS rubbish :-P

Re: Base forum url?

Out of curiosity, why don't you leave it up to users since opening in new window/tab is pretty easy?

Re: Base forum url?

in english:

It'is for visibility. Users than follows an external link could forget the original site! It sounds stupid, but very much people do "zapping" on internet. Furthermore very much people doesn't know what really means "internet"... just imagine how "pretty easy" is open links in a new window!

Unluckily this could cause some statistical problems, because the time on the forum could result very much higher than the real one. But I don't think it's a crucial problem ^___^''

in italian:

e' una questione di visibilita'. Gli utenti che vanno su un sito esterno possono dimenticarsi del sito originale! Sembra una stupidaggine, ma ci sono un sacco di persone che fanno "zapping" tra i siti internet. Tra l'altro, molti non sanno neanche che significhi esattamente "internet" o "browser", pensa quanto dev'essere semplice aprire un link in una nuova finestra per loro! :-P

Purtroppo un sito che funziona in questo modo puo' scombinare le statistiche del sito stesso, perche' risulterebbe che la permanenza media sul forum e' molto piu' lunga di quanto non sia in realta'. Comunque non mi pare un contro assurdo ^___^

10 (edited by CodeXP 2007-10-05 13:30)

Re: Base forum url?

Heh, I use a UserJS script in Opera to remove target=whatever from links. I absolutely hate it when websites tries to force me to open a link in a new tab/window. Using the javascript method mentioned in this thread is a better option than using the target attribute though, as you could just disable javascript for a specific site instead of being left with no alternative other than rewriting the pages client-side...

EDIT: I would also just like to add that if people are forgetting your site just because they didn't open a link in a new window, then your problem is the content and not the links.

11

Re: Base forum url?

Must admit, I am guilty of opening three links on the forum in new pages/tabs. big_smile The gallery, for uploading images for posting, and the two links to the articles/downloads sites. I use the JS method. Must admit, I'm not fond of the opening new windows/tabs concept myself, but trying to constantly explain to people that a right click and open in...... was all that was required ended up getting tedious after a while, so I digressed on those three. big_smile

If you are going to open links in new tabs/windows however, I would suggest using the title= part to list that fact in the <a tag/link. At least people will be advised when they hover over the link, that way.

Re: Base forum url?

MattF wrote:

If you are going to open links in new tabs/windows however, I would suggest using the title= part to list that fact in the <a tag/link. At least people will be advised when they hover over the link, that way.

It's a good idea :-) But I think it's more visible a " (New Window)" at the end of the displayed text of the link ;-)

CodeXP wrote:

Heh, I use a UserJS script in Opera to remove target=whatever from links.
[...]
Using the javascript method mentioned in this thread is a better option than using the target attribute though, as you could just disable javascript for a specific site instead of being left with no alternative other than rewriting the pages client-side...

With UserJs or GreaseMonkey (for Firefox) you can do it easily also for target="_blank" ;-) :

http://developer.mozilla.org/en/docs/DO … tAttribute
http://developer.mozilla.org/en/docs/DO … eAttribute

CodeXP wrote:

I absolutely hate it when websites tries to force me to open a link in a new tab/window.

Also me sometimes, I admit. But I must say as user I found very useful to open external links in new tabs. This is because it's more simple to have 4-5 tabs, without having to surf in the "back" menu. Furthermore in this way I could allow the memory cache of Firefox only for one previous opened page ;-)

CodeXP wrote:

if people are forgetting your site just because they didn't open a link in a new window, then your problem is the content and not the links.

No problem, my not yet existing forum will be full of sexy women ^_________^

13

Re: Base forum url?

Lucas Malor wrote:
MattF wrote:

If you are going to open links in new tabs/windows however, I would suggest using the title= part to list that fact in the <a tag/link. At least people will be advised when they hover over the link, that way.

It's a good idea :-) But I think it's more visible a " (New Window)" at the end of the displayed text of the link ;-)

That way is even better. smile Just mentioned it because many people never mention the new window bit anywhere. smile

Re: Base forum url?

Updated! :-)

http://punbb.org/forums/viewtopic.php?id=17187

15

Re: Base forum url?

Just whilst we're on the subject again, big_smile , noticed you use a vaguely similiar method to the parser for link truncation. It screws validity in Xmhtl 1.1. Altered my URI truncation to this to over come the problem:

        if ($link == '' || $link == $url)
        {
                $pos = strpos($url, '?');

                if ($pos != '')
                {
                        $link = pun_htmlspecialchars(substr($url, '?', $pos));
                }
                else
                {
                        $link = pun_htmlspecialchars($url);
                }
        }
        else
        {
                $link = stripslashes($link);
        }

The likes of links such as Google will be stripped back before the '?', so retain usable layout and validity. Anything which is just stupidly long is left as is. You could use a mix of your original code and the above to stop URI's with arguments supplied being truncated by the original parsing method, and truncate anything that doesn't have supplied arguments using your original code. It should retain XML validity in all scenarios that way. Just an idea. smile

16 (edited by Lucas Malor 2007-10-08 13:54)

Re: Base forum url?

Well, I have only rewritten the PunBB code in a readable look :-P and set the maximum text length for a link text from 55 to 70.

Furthermore, I have not understood what do you mean... the stripped string is the text of the link, not its url. Why this should be invalid for xthml 1.1? Maybe it's a question of printing result?

17

Re: Base forum url?

The problem occurs if a bare URI is posted in a post. For example, something along the lines of:

http://example.com?script&argument1&argument2

could end up being truncated part way through an &, which will, under normal validation in <Xhtml1.0, fail validation, but display the page. Running in Xhtml1.1, however, the XML parser would just print an error message on screen instead of displaying the page if that occured. Truncating at the ?, however, removes any entities from the printed link.

18 (edited by Lucas Malor 2007-10-08 18:23)

Re: Base forum url?

Aaaaaaah, now it's clear! ^___^'''

Well, I think it's more simple to substitute all & chars with & in $title :-)

EDIT: obviously if they are not followed by 'amp;' :-P

19 (edited by Lucas Malor 2007-10-08 19:47)

Re: Base forum url?

Mmmmhhhhh....... have you tried to do some test before? roll ^_____^

something&

20

Re: Base forum url?

In what regard, specifically?

21 (edited by Lucas Malor 2007-10-08 22:00)

Re: Base forum url?

Mmmmhhhhh..... I'm starting to be very confused :-P

You wrote the text of a link could be truncated at an &, invalidating an xhtml document.

For example if I have the link

somesite.org/somepath?etc&someotherqueries

the link could be posted as

<a href="somesite.org/somepath?etc&omeotherqueries">
somesite.org/somepath?etc&
</a>

BUT! If you notice, punBB already substitutes these characters with them entities. For example, in the link in my previous post, the exit code is:

<a href="http://www.noproblemswithpunbb.com/something&end">something&</a>

So the code is valid, I don't see any problems with the truncation of the text of a link at any offset :-)

22

Re: Base forum url?

I said it could be truncated at an entity, not a character. big_smile It's a scenario that may never arise, but is also a possibility. To make PunBB truly Xhtml1.1 compliant, certain alterations need to be made. Whether the same circumstances can arise in a standard setup, I honestly couldn't say. I've made that many alterations that I lost the plot some time ago regarding PunBB's original default semantics. (It's just so damned tempting to keep modifying it). big_smile
However, using the dual method would prevent the scenario ever occuring. It's better to design in too strict a fashion initially than have to adapt it later. (Learned the hard way). big_smile

23 (edited by Lucas Malor 2007-10-08 22:24)

Re: Base forum url?

It's not possible, because the truncation is before the entity conversion ;-)

in include/parser.php:

function parse_message($text, $hide_smilies)
{
    [...]
    // Convert applicable characters to HTML entities
    $text = pun_htmlspecialchars($text);

in viewtopic.php:

    // Perform the main parsing of the message (BBCode, smilies, censor words etc)
    $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);

On the contrary, handle_url_tag() is called in include/parser.php, not in vietopic.php :-)

24

Re: Base forum url?

My apologies then. smile It's a case which is self inflicted with I. big_smile