1 (edited by Strofanto 2006-04-20 13:59)

Topic: Add PUN_ROOT to all the links

Not really a feature request, just a syntax change.

I ask if it's possible for Rickard to add the PUN_ROOT string before of every link

like this:

$links[] = '<li id="navuserlist"><a href="'.PUN_ROOT.'userlist.php">'.$lang_common['User list'].'</a>';

Purpose of this is making easier for modders to include new pages changing PUN_ROOT.

PUN_ROOT should be added to all the links into functions.php and in the stylesheet link syntax in the header.php and the functions.php, like this:

<link rel="stylesheet" type="text/css" href="<?php echo PUN_ROOT; ?>style/<?php echo $pun_user['style'].'.css' ?>" />

I know I've been messy, I hope you got it.

Thanks in advance.

2

Re: Add PUN_ROOT to all the links

Strofanto wrote:

Purpose of this is making easier for modders to include new pages changing PUN_ROOT.

That doesn't make sense.

Re: Add PUN_ROOT to all the links

He's right though. If you do integration and you put a file into another folder, none of the links work wink

Re: Add PUN_ROOT to all the links

elbekko wrote:

He's right though. If you do integration and you put a file into another folder, none of the links work wink

Bless you elbekko, you found the words I missed.

Re: Add PUN_ROOT to all the links

Yes, I agree. I have done this manually on all my boards.

6

Re: Add PUN_ROOT to all the links

I'm not sure this is really relevant anymore, for example the links to the menu items now look like this

<li id="navuserlist"><a href="'.pun_link($pun_url['users']).'"><span>'.$lang_common['User list'].'</span></a>'

Re: Add PUN_ROOT to all the links

Paul wrote:

I'm not sure this is really relevant anymore, for example the links to the menu items now look like this

<li id="navuserlist"><a href="'.pun_link($pun_url['users']).'"><span>'.$lang_common['User list'].'</span></a>'

I take it $pun_url contains all the URLs, but what is pun_link() doing?

8

Re: Add PUN_ROOT to all the links

function pun_link($link, $args = null)
{
    global $pun_config;

    if ($args == null)
        return $pun_config['o_base_url'].'/'.$link;
    else if (!is_array($args))
        $link = $pun_config['o_base_url'].'/'.str_replace('$1', $args, $link);
    else
    {
        for ($i = 0; isset($args[$i]); ++$i)
            $link = $pun_config['o_base_url'].'/'.str_replace('$'.($i+1), $args[$i], $link);
    }

    return $link;
}

There is actually a bug in it which I will have to remember to tell Rickard about.