1 (edited by KeyDog 2009-02-25 20:57)

Topic: [Extension] Adding Images To Navlinks 1.2

Navlinks Icons At Top Instead Of Index, Userlist ...
Instructions:
unpack & install

ADDED 25-02-2009:
Navlinks 1.5
now with hover over effect: see here


http://keydogbb.info/img/navlinks.jpg


old:
********************************************************
Navlinks 1.4 (using .gif)
Demo
Note: If you are using gifs instead of pngs this set will be for you as you only need to change set in folder img - and not change anything in manifest.xml
Navlinks 1.2
Demo
Navlinks 1.1
Demo


EDIT: Bug fixed that didnt show icon when user is logged in


If you're good with graphis editing / creation make files named: navadmin

navlogout
navprofile
navsearch
navregister
navuserlist
navindex
navrules
navlogin

.png      then upload them somewhere and post link here - it would be good to get lots of styles going!
old:

What It Does?
Replaces text links in navlinks bar with images from folder /img
i.e. this adds your graphic feel to website!
Problems I would like help with:
1. Assuming someone has installed extension (for arguments sake) PM - how can I add an individual image for that aswell?
2. Adding a function to extension which automatically places the images in img folder so that user can just download and one-click-install without moving images around // DONE!
3. Add Active Topics etc to be replaced by images instead of text when called for
4. Add Admin Userinterface to turn on/off certain images

Who's it for?
People wanting to add some customization fast and hassle free.
Guess target audience will be first time users who have knowledge with graphics creation or just plain simple novices.

Re: [Extension] Adding Images To Navlinks 1.2

    // Are there any additional navlinks we should insert into the array before imploding it?
    if ($forum_config['o_additional_navlinks'] != '' && preg_match_all('#([0-9]+)\s*=\s*(.*?)\n#s', $forum_config['o_additional_navlinks']."\n", $extra_links))
    {
        // Insert any additional links into the $links array (at the correct index)
        $num_links = count($extra_links[1]);
        for ($i = 0; $i < $num_links; ++$i)
            array_insert($links, (int)$extra_links[1][$i], '<li id="navextra'.($i + 1).'">'.$extra_links[2][$i].'</li>');
    }

this is my issue 2 mentioned... how do I get different images for extra links if someone has installed extensions PM, etc ?

3 (edited by User33 2008-12-16 20:40)

Re: [Extension] Adding Images To Navlinks 1.2

The 'o_additional_navlinks' config is where manually-entered links go.

Re: [Extension] Adding Images To Navlinks 1.2

@Garciat:
1. From a developer standpoint; do you think I should be changing the stylesheets instead of way I am trying? Is it wrong to be using the functions hooks?
2. Any ideas how to specifically use that info you gave me regarding o_additional_navlinks. If I had PM installed. How would I get an image navpm.png to show ?

Re: [Extension] Adding Images To Navlinks 1.2

1.- The way you're doing it seems fine to me.

2.- The PM link is added to the sub-navbar in a rather strange way due to a lack of a hook before line 208 in header.php. Because of that, I don't think there's a simple way to add an icon to it.

Re: [Extension] Adding Images To Navlinks 1.2

1. Good thanks smile
2.  So if they [developers] add hook it could be done easily? Any chance of that happening?  Do I need to add hook request?
3.  I want to add the images to my extension so that on install it's just one click. Where can I find info on how to do that? Or if you can tell me all the better!
thx.

Re: [Extension] Adding Images To Navlinks 1.2

2.- You would also have to get the pun_pm extension changed to work with the new hook. I say you just stick with default links.

3.- Just place the pictures somewhere on your extension's folder, then do something like:

<img src="<?php echo $ext_info['path'] ?>/extension_pictures/hello.png" />

8 (edited by KeyDog 2008-12-17 01:38)

Re: [Extension] Adding Images To Navlinks 1.2

Ok I added:

    $links['userlist'] = '<li id="navuserlist"'.((FORUM_PAGE == 
'userlist') ? '  class="isactive"' : '').'><a href="'.forum_link
($forum_url['users']).'">
<img src="<?php echo $ext_info['path'] ?>/img/navuserlist.png" alt="User list" 
/></a> </li>';

 

from:

$links['userlist'] = '<li id="navuserlist"'.((FORUM_PAGE ==
 'userlist') ? '  class="isactive"' : '').'><a  href="'.forum_link($forum_url['users']).'">
<img  src="'.$base_url.'/img/navuserlist.png" alt="User list" />
</a></li>';

which gave me:

Parse error: syntax error, unexpected T_STRING

what have I done wrong?

(am using same extension as one I posted here just with that change)

Re: [Extension] Adding Images To Navlinks 1.2

You might want to replace <?php and ?> with ' (apostrophes)...

10

Re: [Extension] Adding Images To Navlinks 1.2

Parse error: syntax error, unexpected T_ECHO

<img src="'echo .$ext_info['path'] '/img/navuserlist.png" alt="User list" />
<img src="'echo $ext_info['path'] '/img/navuserlist.png"/>  tried both

my code....

11

Re: [Extension] Adding Images To Navlinks 1.2

Sorry, I meant this...

<img src="'.$ext_info['path'].'/extension_pictures/hello.png" />

12

Re: [Extension] Adding Images To Navlinks 1.2

You really are a star. That worked! Thx!

13

Re: [Extension] Adding Images To Navlinks 1.2

Extensions don't use 'o_additional_navlinks' key in config table, but they can use the same method as for generating additional navlinks to add link to correct place at navbar.

Garciat wrote:

The PM link is added to the sub-navbar in a rather strange way...

Agree with you, we will discussed it.

KeyDog wrote:

If I had PM installed. How would I get an image navpm.png to show ?

If all installed extensions will use method like this in 'fn_generate_navlinks_end' hook:

array_insert($links, 'pm', '<li id="navextra"><a href="pm_link">pm_link</a></li>');

you can check up for navlinks of installed extension with this code:

if (isset($links['pm']))    

Also you need to change priority for your 'fn_generate_navlinks_end' hook.

14 (edited by KeyDog 2008-12-17 21:18)

Re: [Extension] Adding Images To Navlinks 1.2

@Slavok
Can you give me a bit more information on how to use that method? Assuming I want to change the code of your official pun_pm so that my code (extension) gets it properly

array_insert($links, 'pm', '<li id="navextra"><a href="pm_link">pm_link</a></li>');
where would above ^^ code go (file, line) , what would it replace

if (isset($links['pm']))
and where that one ^^  (file, line)

sorry if these are novice questions...

15

Re: [Extension] Adding Images To Navlinks 1.2

just noticed something; while everything shows as it should for admin and guests  for  user it does not

profile (profile.php?id=3)   for my test user shows normal text instead of profile icon.   
and also
the logout with  link  login.php?action=out&id ...csrf_token... etc  doesnt show icon   

what do I need to change?

16

Re: [Extension] Adding Images To Navlinks 1.2

If you really want to make extensions you can call your own, you should start figuring out what does what and learning more PHP. I say this because it'd be cool to have another extension developer to talk to and share ideas, not because I want to annoy you or be mean smile

17 (edited by KeyDog 2009-01-03 22:50)

Re: [Extension] Adding Images To Navlinks 1.2

IGNORE my question

$sorrry for wasting your time


sorted .... thx

18

Re: [Extension] Adding Images To Navlinks 1.2

Garciat wrote:

I say this because it'd be cool to have another extension developer to talk to and share ideas, not because I want to annoy you or be mean

I will be an extension developer at somepoint wink just need the time.

Sorry. Unactive due to personal life.

19

Re: [Extension] Adding Images To Navlinks 1.2

Adding A Download Link To Navlinks
======================================================================


            <hook id="fn_generate_navlinks_end"><![CDATA[
            global $base_url;   
           
                $links['navdl'] = '<li id="navdl"'.((FORUM_PAGE == 'dl') ? ' class="isactive"' : '').'><a href="http://www.keydogbb.info/dhtml/keydog-1/location/keydog/extstylelangmod.php"><img src="'.$ext_info['path'].'/img/dl.png" alt="Download" /></a></li>';
               
                $links['index'] = '<li id="navindex"'.((FORUM_PAGE == 'index') ? ' class="isactive"' : '').'><a href="'.forum_link($forum_url['index']).'"><img src="'.$ext_info['path'].'/img/navindex.png" alt="Index" /></a></li>';

=======================================================================


Instructions:
=======================================================================

1. Just add the green code above to the manifest.xml in navlinks extension
2. change your the download link to wherever yours is located
3. add a dl.png  image/icon to the img folder

and you're done

=======================================================================


Doc
=======================================================================
by KeyDog

Release Date
=======================================================================

31-01-2009


=======================================================================

feel free to add your input

20 (edited by KeyDog 2009-02-25 20:57)

Re: [Extension] Adding Images To Navlinks 1.2

HOVER EFFECT ADDED 25-02-2009:
Navlinks 1.5
see here

http://keydogbb.info/img/navlinks.jpg

Re: [Extension] Adding Images To Navlinks 1.2

is there any way to use this with the text, i mean.

[Button] Search [Button] Userlist

Thanks

MyFootballCafe.com  is Now Online!

22

Re: [Extension] Adding Images To Navlinks 1.2

Don't understand your question....

23 (edited by Stormeh 2009-03-06 05:26)

Re: [Extension] Adding Images To Navlinks 1.2

KeyDog wrote:

Don't understand your question....

my guess is, he means is it possible to do something like this:
http://img25.imageshack.us/img25/4493/lieikthis.png

edit:

does anyone know how to center the navbar icons?

http://img141.imageshack.us/img141/2271/howdoi.png

Re: [Extension] Adding Images To Navlinks 1.2

yes that way

MyFootballCafe.com  is Now Online!

25 (edited by KeyDog 2009-03-06 14:53)

Re: [Extension] Adding Images To Navlinks 1.2

ah ok - see what you mean
will look into it

regarding the center issue;
***********************
try changing these (original) lines to your needs which you find in   'yourstyle'.css

#brd-navlinks ul {
    margin: 0;
    padding: 0.5em 0;
    float: left;
    }

#brd-navlinks li {
    display: inline;
    margin-right: 1em;
    }

#brd-navlinks li a {
    font-size: 1.167em;
    text-decoration: none;
    }


regarding the 'supermag' question
****************************

one needs to add back

<span>'.$lang_common['Index'].'</span>
<span>'.$lang_common['Search'].'</span>
<span>'.$lang_common['Profile'].'</span>
<span>'.$lang_common['Admin'].'</span>
<span>'.$lang_common['Login'].'</span>
<span>'.$lang_common['Logout'].'</span>
<span>'.$lang_common['Userlist'].'</span>

to all the different places in manifest.xml

(.....).png"/>ABOVE RELEVANT LINE OF CODE</a></li>';

I believe... if you want to do that supermag....