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
index.template.php in the theme's directory.
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*
http://www.simplemachines.org/community/index.php?topic=5720.msg56852#msg56852
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 ;)
Modify the function "template_menu()" which you find at the bottom of the theme file "index.template.php".
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. :)
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?
You probably forgot a semicolon or used a ' inside the quotes... can you quote what you added?
-[Unknown]
I had placed a forward slash in, thanks Unknown. :-[
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?
Add style="margin: 2px 0;" in the img element ;).
-[Unknown]
:) thanks again, *cough* although I have a purple border somehow *walks away thinkin Unknown is shakin his head*
Find:
style="margin: 2px 0; border="0
Replace:
style="margin: 2px 0;" border="0"
-[Unknown]
:) 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
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]
Thank you about this easy tutorial. Now i'm just wondering how can i make my "chat" button to open in a new window?
target="blank_" ?
from <a href="http://www.yourdomain.net/gallery"> to <a href="http://www.yourdomain.net/gallery" target="blank_">
Add target="_blank" in the <a href=""> part of the link.
...and Owdy got there first :P
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'];
<a href="http://www.sadevuo.net/chat" target="blank_">', ($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'];
Thank you again :D I have totally forget about my HTML skills
I am very new to php so bear with me
after a bit of searching on the forum this subject answers my question exactley but I just wanted to know what the varable txt is for ? and what the number means
also if I add the code below :
// How about the [gallery] button?
echo '
<a href="', $scripturl, '?action=gallery" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/gallery.gif" alt="' . $txt[801] . '" border="0" />' : $txt[801]), '</a>', $context['menu_separator'];
where would I define the action=gallery
The variable $txt is for internationalization; it makes it possible to show "ja" in German but "yes" in English.
The number or string referenced inside the [] refers to which phrase/word/string is being used.
-[Unknown]
I need help with making a button so users can click off the main menu, to the paid subscription.
I have looked over the code and it baffles me completely can anyone help me?
The button URL would be
http://www.sellyourholiday.com/forum/index.php?action=profile;sa=subscriptions
I will make a small custom button but its the code to put it into my website which confuses the hell out of me..
// Show the [home] and [help] buttons.
This code is not in index.template.php so where do i put my code?
anyone know?
Quote from: Owdy on March 20, 2004, 12:31:53 PM
in Themes/default/Languages/Modifications.english.php
search for:
?>
add before:
$txt[chat] = 'chat';
I want to add a Who's Online button to my template which is based off the YaBB classic theme and there is no Modifications.english.php file with that theme. Do I have to do this step on a different file or is it not necessary? I am using version 1.1 RC2
Quotein 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. :)
Is this information all still correct? I did try something similar to this and got a big ol' template error. :(
Quote from: Owdy on March 20, 2004, 12:31:53 PM
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';
I
really need help with this piece of the code. My theme is based on the YaBB theme and I don't have a Modification.english.php file. Pardon me if I'm not using the correct terminology, but I just slapped in the 2nd part of this code (not quoted) and since $txt[chat] isn't defined my error log is filling with errors. Can someone tell me how where I define (if that's the right word) $txt[chat]?
Thanks.
Okay, in default/languages I found ModSettings.english.php that appeared to have a bunch of these constant defined, so I added the above there (except "chat" is now "who" as I'm trying to add a who's online button (less the apostrophe of course) instead of a chat button and I'm still getting an error log full of errors. All the errors are pointing to where I call the Who's Online in index.template.php. Here's my code:
echo '
<a href="http://www.sprechereast.com/forum/index.php?action=who">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/who.gif" alt="' . $txt['who'] . '" border="0" />' : $txt['who']), '</a>', $context['menu_separator'];
And here is my definition in ModSettings.english.php (if that's even the right place to define it):
$txt['who'] = 'Whos Online';
Any help is appreciated! I'm at the end of my rope with this one!
I think I figured it out. The constant needed to be defined in index.english.php. That one just about killed me... time to go to bed.
Ok, I followed the directions, and I still don't have a chat button. using Smf 1.07 put the chat image in english file, chmoded the folder, still no button. placed the code after the home settings.
// 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'];
Is this right? I am new to code, so any help appreciated!
// How about the [chat] button?
echo '
<a href="http://www.karl-urban.com/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'];
ok I got this to work, now to go back and move the button up a bit. Thank you for the tutorial! :D
ok, still can't move the button and now when they log in, it makes you re enter your log in details. Any ideas on what I did wrong? :(
Quote from: RobinSlig on June 05, 2006, 12:07:08 PM
now to go back and move the button up a bit.
http://www.simplemachines.org/community/index.php?topic=7854.msg75344#msg75344 ;)
i have this
// How about the [Shop] button?
echo '
<a href="http://switchfoot.cknetworx.com/smf/index.php?action=shop">', ($settings['use_image_buttons'] ? '<img src="' . $settings['/'] . '/' . $context['user']['language'] . '/shop.gif" alt="' . $txt[Shop] . '" border="0" />' : $txt[Shop]), '</a>', $context['menu_separator'];
yet the image qon't show all that is coming up is text.
http://switchfoot.cknetworx.com/smf/index.php
anyone?
anyone at all?
Image url is wrong.
i've tried 3 image url's (all leading to the image)
Quote from: randomdood on June 16, 2006, 10:41:04 PM
i've tried 3 image url's (all leading to the image)
If you right click that missing image and watch properties, you see what i mean. Code is wrong. Try this:
// How about the [Shop] button?
echo '
<a href="http://switchfoot.cknetworx.com/smf/index.php?action=shop">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif" alt="' . $txt[Shop] . '" border="0" />' : $txt[Shop]), '</a>', $context['menu_separator'];
have to wait for my hosts ftp server to come online again
thnx a bunch
I tried to get a net Link Button. I inserted ervery Line like the examples. But now i get some errors:
Notice: Use of undefined constant homepage - assumed 'homepage' in /home/www/web78/html/llc/forum/Sources/Load.php(1702) : eval()'d code on line 4
Here are the Code of the modification.language.php
<?php
// Version: 1.1 RC3; Modifications
$txt[homepage] = 'homepage';
?>
Have somebody a solution?
Change
<?php
// Version: 1.1 RC3; Modifications
$txt[homepage] = 'homepage';
?>
to
<?php
// Version: 1.1 RC3; Modifications
$txt['homepage'] = 'homepage';
?>
..and remember to use $txt['homepage'] in the template as well.
Wow, why have they not just added a way in the software to simply add a button? This post is a mess of jumbled code. Obviously this is a major issue for many people so why not fix it and be done with it already?
Here is a simple explanation on how to change the home button into a link to your main website page. Look for the code below in this file Themes/default/index.template.php or whatever theme you are using:
// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
------------------------------------
Change the part of the code that says:
-- <a href="', $scripturl, '"> -- into this: -- <a href="http://www.YourWebsite.com"> --
change only that short part of the code nothing more and the home button will go to your main area of your site(as it should anyway).
-Rob-
Well, in some themes you CAN add buttons through the software..but its just for those themes only.
Okay, so - This is perfect.
// 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'];
Is there anyway i can make it look like my theme buttons? (Well they are just orange text...) Also, how i can allign it with the other buttons rather than sit on top of them?
Thanks
I found the URL of your board in another thread, checked the source and you have a different class defined to "Chat" than you do the rest of your text buttons. For Chat you are using maintab_back and for the others you are using mainNav. Once you choose one of the other, they should be consistent. :)
How do I go about adding a Chat to the menu bar?
(http://img.photobucket.com/albums/v510/visionking/buttons3.jpg)
Or is it not possible?
I too would love to be able to easily add a "CHATROOM" button to my main index page. I'm using 1.1.2 with the Babylon theme. The url of my chatroom is http://www.mysite.com/chat.html and I would like it to open in a new page.
Is there a facility within this them to automatically add this button please?
I'm not very good at all editing files and nearly always make a mess of it...... ideally I'd like to add the new button immediately before the "LOGOUT" button. I've read most of the above posts and to be honest, the coding changes needed scare me to death and look far to advanced for my abilities.....
Hope some kind soul out there can rescue me please?
No one wants to help? What kind of support place is this? ::)
I emailed the creator of the Website Button mod and he very kindly created the mod to add a Chat Button for me. He's uploaded it and just as soon as it's been checked/approved it'll be available for downloading.
It's fantastic - does all I wanted - and for that I'm very grateful to him for all his hard work :) :) :) :)
Care to share where this info can be found?
The best thing is to email the creator and ask if he'll send it to you. I know he's submitted it for inclusion on the MODS board. All I can say is it's brilliant and does exactly what I wanted. He's called Jake and his email is
[email protected]
Hi Adrian.
Yes, logged on users can already download it from http://custom.simplemachines.org/mods/index.php?mod=827
Page says that it's waiting for approval but yes, it can be downloaded from there..
Also, if someone's interested, I made a similar MOD that features also a full chat, similar to integrated chat, as mine also uses IRC networks, but this one is MUCH faster as applet is not so heavy and also this doesn't add a commercial to your forum and is very nice and customizable in many ways, it has not been approved yet either, moderators propably have a lot of work in approving of MODs as I have lately uploaded already many pretty complicated new MODs so it will take time, but check my mkpchat MOD also if you are interested in adding a chat to your site.
It can be found from http://custom.simplemachines.org/mods/index.php?mod=841
Un-approved MODs propably are shown ONLY to logged on users.. afaik..
EDIT:
Sorry, I was mistaken, it was not allowed for download of members of this community until it's approved, but anyway, it's approval has now been success and it's there if anyone still needing it. It's v1.01 because there was a small issue with uninstallation in first version, 1.0 accidentally removed english icons used by websiteButton MOD on themes default and babylon.. or was it classic..? Well anyway, bugs been fixed for v1.01
MKPChat is still waiting it's approval..
Hello people :)
firstly i want to say that IMO there are too much generic names topics that can confuse the new users(like me) that don't understand a line of PHP. It could be better that there are more topics but with more detailed names. For me it's a must for a community! :) I know it's a mess but i suggest to rename the topics names. It's a mess i really know but in future people will find what they need more easier. I suggest too to discourage cancelling the posts of the users that post generic topics, undetailed ones, asking to them to repost the post re-writing it better. Consider these just suggestion to run a better and functional forum. I have also to say that without SMF community and support i really cannot be able to run the community i manage about growing mushrooms.
Every user in his little
MUST make the possible for the community.
I quote a part of the Rob's post.
Quote// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
------------------------------------
Change the part of the code that says:
-- <a href="', $scripturl, '"> -- into this: -- <a href="http://www.YourWebsite.com"> --
change only that short part of the code nothing more and the home button will go to your main area of your site(as it should anyway).
I really don't know anything about php! So here my question, i'm using SMF 1.1.3, with a custom theme, based on the default "Core Theme". The structure is that the colours are different. However i'm trying to add a new button editing the index.template.php of my custom theme. I use Mozilla Firefox 2.0.0.5 but i believe this isn't important.
I want to add a button to the maintab that points to another website home and that will be opened in a new page. It must appear to guest and registered users.
I add this code and it works, but the button appears always selected:
// the [Not Edibles] list button
if ($context['allow_memberlist'])
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="http://www.fsre.nl" target="blank">' , $txt[116] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
// the [Not Edibles] list button
if ($context['user']['is_guest'])
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="http://www.fsre.nl" target="blank">' , $txt[116] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
The problem should be the variable $current_action == 'home', because, i'm supposing, PHP interpretate that variable like it's in the home, so will highlight also the butto i added. What can i do? Have i to create another action? Where..and how?!
Thak you all mates,
F.