1 (edited by KeyDog 2008-12-17 13:26)

Topic: Adding Image(s) To Navlinks

17-12-2008
http://punbb.informer.com/forums/topic/ … inks-beta/
is where the extension I made (with help from garciat obviously) can be found to download.


************************************

I'd like to add an image to navlinks either next to or replacing text login (as example - then I can do the rest hopefully)

in include/functions.php   1.3.2 line 436

    $links['login'] = '<li id="navlogin"'.((FORUM_PAGE == 'login') ? ' class="isactive"' : '').'><a href="'.forum_link($forum_url['login']).'"><span>'.$lang_common['Login'].'</span></a></li>';
    }

how must I do that?

how would I use the hook fn_generate_navlinks_start [line 417]  to echo the image [assuming location img/navlogon.png] if I were to write an extension (which I'd like to]

My intentions:
1. To be able to click the image as a link [login in this example] instead of having text  and/or
2. Have an image next to text (say an image of a key next to login text)

Re: Adding Image(s) To Navlinks

<hook id="fn_generate_navlinks_end">
    if ($forum_user['is_guest'])
    {
        $links['login'] = '<li id="navlogin"><a href="'.forum_link($forum_url['login']).'"><img src="'.$base_url.'img/navlogon.png" alt="Login" /></a></li>';
    }
</hook>

I guess that could do the trick...

Re: Adding Image(s) To Navlinks

text all the way dude smile
just kidding, good luck with your design

Re: Adding Image(s) To Navlinks

thx guys. trying that one....

5 (edited by KeyDog 2008-12-15 20:58)

Re: Adding Image(s) To Navlinks

Notice: Undefined variable: base_url in   .../include/functions.php(466) : eval()'d code on line 43 

image does show when logged out , and doesnt show when logged in - so thats cool.

any ideas why I'm getting that error when logged out? (no error when logged in)

Re: Adding Image(s) To Navlinks

Add

global $base_url;

to the top of that hook.

7 (edited by KeyDog 2008-12-15 22:39)

Re: Adding Image(s) To Navlinks

            <hook id="fn_generate_navlinks_end"><![CDATA[
        
            global $base_url;
            
                if ($forum_user['is_guest'])
                {
                $links['login'] = '<li id="navlogin"><a href="'.forum_link($forum_url['login']).'"><img src="'.$base_url.'img/blink.png" alt="Login" /></a></li>';
                }
            ]]></hook>

Is anything evidently wrong up there? because it shows no image anywhere....
if  I take global $base_url; away it shows the image when it should, but always with that error.....

Re: Adding Image(s) To Navlinks

It was missing a slash. Sorry.

            <hook id="fn_generate_navlinks_end"><![CDATA[
            global $base_url;
                if ($forum_user['is_guest'])
                {
                $links['login'] = '<li id="navlogin"><a href="'.forum_link($forum_url['login']).'"><img src="'.$base_url.'/img/blink.png" alt="Login" /></a></li>';
                }
            ]]></hook>

Re: Adding Image(s) To Navlinks

Brilliant. That works! Many thanks.

10

Re: Adding Image(s) To Navlinks

http://punbb.informer.com/forums/topic/ … inks-beta/

maybe you can help me with two issues I have with the beta extension I just made....