News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Adding a Chat Button?

Started by Zippo, March 20, 2004, 08:44:00 AM

Previous topic - Next topic

Zippo

Could someone tell me where and how to add a new button and the link please?  I have duplicated the default  theme and want to add the "chat" button.

Thanks

Chris Cromer

index.template.php in the theme's directory.
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

Zippo

Thanks Chris but the all important "how" is a missin there ;) Or maybe I am just not very good at explaining myself more likely.

So...., the button I want to place between the existing"home" and help"is chat.gif (placed in the images folder) and the url will be http://mysite/chat/chat.html.

So the code I am looking for is where, and the code I place is what?

Thanks *scratched head*



andrea

Modify the function "template_menu()" which you find at the bottom of the theme file "index.template.php".

Andrea Hubacher
Ex Lead Support Specialist
www.simplemachines.org

Personal Signature:
Most recent work:
10 Aqua Themes for SMF



Owdy

#6
Quote from: Zippo on March 20, 2004, 11:13:47 AM
Quote from: babylonking on March 20, 2004, 10:06:41 AM
http://www.simplemachines.org/community/index.php?topic=5720.msg56852#msg56852

Off limits to a mere mortal as I ;)



in Themes/default/Languages/Modifications.english.php

search for:
?>

add before:
$txt[chat] = 'chat';


in Themes/default/index.template.php

search for:
// 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] . '" 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] . '" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];


add after:
// How about the [chat] button?

echo '
<a href="http://www.yourdomain.net/index.php?action=chat">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/chat.gif" alt="' . $txt[chat] . '" border="0" />' : $txt[chat]), '</a>', $context['menu_separator'];


After that, upload your button to images/english or what ever language you use. :)
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Zippo

Something amiss here as I get a parse error:

http://www.ensigndesign.co.uk/body/index.php

Any suggestions as to where I went wrong?

[Unknown]

You probably forgot a semicolon or used a ' inside the quotes... can you quote what you added?

-[Unknown]

Zippo

I had placed a forward slash in, thanks Unknown.   :-[

Zippo

One small thing though, the new button seems a pixel "to low" if you see what I mean.

http://www.ensigndesign.co.uk/body/index.php

Is that easliy rectified?

[Unknown]

Add style="margin: 2px 0;" in the img element ;).

-[Unknown]

Zippo

:) thanks again, *cough* although I have a purple border somehow *walks away thinkin Unknown is shakin his head*

[Unknown]

Find:

style="margin: 2px 0; border="0

Replace:

style="margin: 2px 0;" border="0"

-[Unknown]

Zippo

 :) I have no idea how you guys stay so paitent while complete dorks (such as me) delve into your code like bulls in china shops.  I appriciate it though I really do.

;D

[Unknown]

Wait, patient?  Hmm, you must be thinking of someone else... patience is not my specialty :P.

Nah, easy mistakes to make.  It's easy to point out other people's mistakes - it's difficult to not make them yourself.

-[Unknown]

Villesa

Thank you about this easy tutorial. Now i'm just wondering how can i make my "chat" button to open in a new window?
You'll get the idea

I'm all ok.

Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

bostasp

Add target="_blank" in the <a href=""> part of the link.

...and Owdy got there first :P

Villesa

Thanks i knew that blank thing but i don't know that where in this line i should place it

<a href="http://www.sadevuo.net/chat">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/chat.gif" alt="' . $txt[801] . '" style="margin: 2px 0;" border="0" />' : $txt[801]), '</a>', $context['menu_separator'];
You'll get the idea

I'm all ok.

Advertisement: