adding more buttons

Started by Justjoolzs, June 17, 2004, 07:32:31 AM

Previous topic - Next topic

Justjoolzs


Hi,

Can someone tell me how to add more buttons, sorry but I am very new to this  :-[

Grudge

To the menu?

Open index.template.php and find this:

function template_menu()


Basically, whereever you want it add this:

echo '
<a href="YOUR SITE HERE">', ($settings['use_image_buttons'] ? '<img src="IMAGE PATH HERE" alt="DESCRIPTION OF LINK HERE" style="margin: 2px 0;" border="0" />' : DESCRIPTION OF LINK HERE), '</a>';


Replacing the caps with - well - the stuff!

Things like this will eventually be made easier hopefully :)
I'm only a half geek really...

Justjoolzs

Many thanks for that, what a friendly bunch you are  :D

Justjoolzs


Hi me again  :)

I am now in urgent need of two extra buttons, same design as those on the "extra default buttons thread"
One saying "links" and one "dating"

Anyone out there that could help a maiden in distress!

Tomer

Quote from: Justjoolzs on June 17, 2004, 05:00:29 PM

Hi me again  :)

I am now in urgent need of two extra buttons, same design as those on the "extra default buttons thread"
One saying "links" and one "dating"

Anyone out there that could help a maiden in distress!

I believe you are looking for this thread:

http://www.simplemachines.org/community/index.php?topic=11938.0

Justjoolzs

Quote from: Lamper on June 18, 2004, 08:08:11 AM
Quote from: Justjoolzs on June 17, 2004, 05:00:29 PM

Hi me again  :)

I am now in urgent need of two extra buttons, same design as those on the "extra default buttons thread"
One saying "links" and one "dating"

Anyone out there that could help a maiden in distress!

I believe you are looking for this thread:

http://www.simplemachines.org/community/index.php?topic=11938.0
The buttons are correct but I'm looking for one saying Links and one Dating of which neither are listed on that thread

Tomer


GiNi3D

I made the 2 buttons that Justjoolzs needs so much!
But I don't know what to do!
Do I bug Babylonking to tell him to ad it in is extra buttons that he made.
Or send it to Justjoolzs directly? But I want everybody that wants it to have it too!
Hmmm! choices! choices!
Plus i can't post attachements  ???

Tomer

Upload it to your server and post the link here.

GiNi3D

Quote from: Lamper
Upload it to your server and post the link here.

That's exactly what I don't want to do, I don't use SMF, I'm still evaluating it,
I have only 2 members, Me and Test.
Tomorrow I can wake up and decide to use another board for my site,
if I do change, do you think I will leave all links linked back here, no!
afterwards this post would be without Buttons, and it's not fair for others in the future.
When the time comes and I found my product, and make myself at home in the respective community of that product, then I can start linking back stuff, but not now sorry!  :-\

Powerbob

Hi Grudge, thanks for the tip, I tried it and got the error message unexpected t string in line 515  :o

This is what I added;

echo '
<a href="http://www.ofbboard.com/cgi-bin/album_63/album.pl">', ($settings['use_image_buttons'] ? '<img src="http://www.ofbboard.com/smf/Themes/default/images/english/gallery.gif" alt="Ofbboard Gallery" style="margin: 2px 0;" border="0" />' : Ofbboard Gallery), '</a>';

er I admit I'm kinda new to all this :-[

Powerbob



My SMF 2.1 Beta test site; http://www.pplb.net/smf21/index.php

Nachtrafe

Quote from: Grudge on June 17, 2004, 07:36:02 AM
To the menu?

Open index.template.php and find this:

function template_menu()


Basically, whereever you want it add this:

echo '
<a href="YOUR SITE HERE">', ($settings['use_image_buttons'] ? '<img src="IMAGE PATH HERE" alt="DESCRIPTION OF LINK HERE" style="margin: 2px 0;" border="0" />' : DESCRIPTION OF LINK HERE), '</a>';


Replacing the caps with - well - the stuff!

Things like this will eventually be made easier hopefully :)
Thanks for this Grudge!!  I was having a hard time figuring this out on my own.  Kept adding the wrong code and crashing my board.  :P
Here's to the Army and Navy
And the battles they have won;
Here's to America's colors, the colors that never run.
May the wings of liberty never lose a feather!

Chadgqx

so is this correct to add a chat button??

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
   global $context, $settings, $options, $scripturl, $txt;

   // Show the [home] and [help] buttons.
   echo '
            <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'], '
            <a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];
            echo '
<a href="http://discusasahobby.com/chat.htm">', ($settings['use_image_buttons'] ? '<img src="http://discusasahobby.com/forum/Themes/default/images/chat.gif" alt="chat" style="margin: 2px 0;" border="0" />' : DESCRIPTION OF LINK HERE), '</a>';

Chadgqx

this gave me errors!!!!!!!!!!!!!!!!


Chad

Cypher7

Don't know if this helps, as I'm using Beta5 so the code may be different...

but what I did was find

function template_menu()

then say you want to add a button between HELP and SEARCH.

find

// Show the [help] button.
echo '
<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];


// How about the [search] button?
if ($context['allow_search'])
echo '
<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];


and then copy the code for the help button to just below itself... like so
// Show the [help] button.
echo '
<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

// Show the [help] button.
echo '
<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];


// How about the [search] button?
if ($context['allow_search'])
echo '
<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];


That would add a second HELP button.

Next, just edit the added code to what ever you want... eg...

// Show the [help] button.
echo '
<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

// Show the [messages] button.
echo '
<a href="', $scripturl, '?action=pm">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/messages.gif" alt="Messages" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];


// How about the [search] button?
if ($context['allow_search'])
echo '
<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];


Worked for me anyway ;)

Vinoth

Quote from: Justjoolzs on June 17, 2004, 07:44:04 AM
Many thanks for that, what a friendly bunch you are :D

grudge is nice guy, he helps out everyone here,

that is why i like SMF,
Vinoth And Sachin ( SpecHackers Team )
The Best  Way to Help Poor Is not Becoming One Of Them.

DoW Kid Rock

ok I tried the last suggestion of copying a button info and changing it.  i got an error that said Parse error: parse error, unexpected T_FOR in /home/disciple/public_html/test/Themes/default/index.template.php on line 440

this is that section it refers to:

// Show the [topspotz] button.
echo '
<a href="http://www.topspotz.com/in.php?site=1044479199" target="_blank">', ($settings['use_image_buttons'] ? '<img src="http://www.disciplesofwrestling.ca/pic/top/black.gif" alt="Vote for us here" style="margin: 2px 0;" border="0" />' : vote for us here, '</a>', $context['menu_separator'];


and this is the whole section

// Show the [home] and [help] buttons.
echo '
<a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'], '
<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

// Show the [topspotz] button.
echo '
<a href="http://www.topspotz.com/in.php?site=1044479199" target="_blank">', ($settings['use_image_buttons'] ? '<img src="http://www.disciplesofwrestling.ca/pic/top/black.gif" alt="Vote for us here" style="margin: 2px 0;" border="0" />' : vote for us here, '</a>', $context['menu_separator'];

// How about the [search] button?
if ($context['allow_search'])
echo '
<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];

A.M.A

try this:
echo '
<a href="http://www.topspotz.com/in.php?site=1044479199" target="_blank"><img src="http://www.disciplesofwrestling.ca/pic/top/black.gif" alt="Vote for us here" style="margin: 2px 0;" border="0" /></a>', $context['menu_separator'];
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

DoW Kid Rock

thank you that worked perfectly.  am able to add any buttons now

gerrymore

I'm having some difficulties with this as well. The code below is what I have, but I dont seem to be able to change it for the button to show. Basically I want to add gallery.gif next to the row of buttons that come woith SMF, and link it to my coppermine gallery (opening in a new window). I've tried a few things, but no joy. Any ideas?

function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;

// Show the [home] and [help] buttons.
echo '
<a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'], '
<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

// How about the [search] button?
if ($context['allow_search'])
echo '
<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '
<a href="', $scripturl, '?action=admin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin.gif" alt="' . $txt[2] . '" style="margin: 2px 0;" border="0" />' : $txt[2]), '</a>', $context['menu_separator'];

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '
<a href="', $scripturl, '?action=profile">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>', $context['menu_separator'];

// The [calendar]!
if ($context['allow_calendar'])
echo '
<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];

// If the user is a guest, show [login] and [register] buttons.
if ($context['user']['is_guest'])
{
echo '
<a href="', $scripturl, '?action=login">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/login.gif" alt="' . $txt[34] . '" style="margin: 2px 0;" border="0" />' : $txt[34]), '</a>', $context['menu_separator'], '
<a href="', $scripturl, '?action=register">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/register.gif" alt="' . $txt[97] . '" style="margin: 2px 0;" border="0" />' : $txt[97]), '</a>';
}
// Otherwise, they might want to [logout]...
else
echo '
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
}


Thanks
SMF RC1, Tiny Portal 0.75, Coppermine 1.3.3, Flashchat.

Advertisement: