TinyPortal

Development => Support => Topic started by: cralor on April 25, 2010, 07:55:27 PM

Title: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: cralor on April 25, 2010, 07:55:27 PM
Hi.

I know the old index.template.php editing process, but with the new updates, I no longer understand how to add a custom button to the navigation menu/strip.

Could anyone assist?

Thanks!!
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: bloc on April 25, 2010, 08:07:09 PM
The buttons in SMF2.0 are now inside an array, which you will find in Sources/Subs.php. Search for "menu_buttons".
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: cralor on April 25, 2010, 08:31:29 PM
Sweet. Thanks.

Now, where can I define "actions"? When I visit the "Chat" page, it believes the current action is Home. This is because I am linking to a ?page file instead of an ?action file. How can I go about fixing this?

I can either:
1) Define the "action" for Home. And make "Chat" the default.
2) Define the "action for "Chat".

Thanks.
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: robbie93 on April 25, 2010, 08:38:00 PM
What about this?

http://www.simplemachines.org/community/index.php?topic=261880.0
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: cralor on April 25, 2010, 08:43:45 PM
Quote from: robbie93 on April 25, 2010, 08:38:00 PM
What about this?

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

Thanks :) I should've searched there the first time around, but Bloc already answered that for me :P

I just need to figure out how to make my new button an "action".
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: Crip on April 25, 2010, 09:05:21 PM
easy way , copy + paste [Home] tab and then add your [name] + URL
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: cralor on April 25, 2010, 09:11:34 PM
Quote from: Crip on April 25, 2010, 09:05:21 PM
easy way , copy + paste [Home] tab and then add your [name] + URL

Problem: my URL is a 'page' not an 'action'. So TinyPortal does not register it as the 'current_action', so when I access my new "Chat" page, it highlights the "Home" button as the 'current_action'.

To fix this, I must make '?action=chat' defined. How can I do this?

Thanks!
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: Crip on April 25, 2010, 09:44:07 PM
direct URL==> echo '<a href="http://www.yoursite.com" title="" '?action=chat">Chat</a>';
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: cralor on April 25, 2010, 09:49:24 PM
Quote from: Crip on April 25, 2010, 09:44:07 PM
direct URL==> echo '<a href="http://www.yoursite.com" title="" '?action=chat">Chat</a>';

My problem is that the "action" 'chat' is not defined. Putting that in my URL just brings me to the forums.

How do I make '?action=chat' go to the "chat page".

Thanks! :)
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: Crip on April 25, 2010, 10:57:20 PM
can U show a link to theme + [chat] ?

...you can PM link if you wanna.
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: cralor on April 25, 2010, 11:13:23 PM
www.dbgc.tk/forums

If you click "Chat", it thinks you're visiting "Home". I'd like to fix that :)
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: robbie93 on April 25, 2010, 11:22:28 PM
cralor what chat are you using?  it would be easy to show us the url of the chat itself
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: cralor on April 25, 2010, 11:27:23 PM
http://dbgc.tk/forums/index.php?page=2

There is the direct link, although the problem has nothing to do with the actual chat software.
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: IchBin on April 25, 2010, 11:29:06 PM
You add it the same way you would in SMF1, only in Subs.php. There is a section right beneath the buttons that shows you how to set actions. You'll need to add some custom code to make your button highlight.

if (isset($_GET['page']) && $_GET['page'] == 2)
    $current_action = 'chat';
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: Crip on April 25, 2010, 11:31:43 PM
Try ::

'chat' => array(
'title' => $txt['chat'],
'href' => $scripturl . '?page=2',
'show' => true,
'sub_buttons' => array(
),
),


Or :



'chat' => array(
'title' => $txt['chat'],
'href' => $scripturl . 'http://dbgc.tk/forums/index.php?page=2',
'show' => true,
'sub_buttons' => array(
),
),


?  ?  ÷
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: Crip on April 25, 2010, 11:37:57 PM
Hi B0ss  :P  :D
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: cralor on April 25, 2010, 11:41:05 PM
Quote from: IchBinâ„¢ on April 25, 2010, 11:29:06 PM
You add it the same way you would in SMF1, only in Subs.php. There is a section right beneath the buttons that shows you how to set actions. You'll need to add some custom code to make your button highlight.

if (isset($_GET['page']) && $_GET['page'] == 2)
    $current_action = 'chat';

That's what I was looking for :) Thanks!

Sorry Crip... I guess I wasn't that descriptive :) Thanks for your help though!!
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: Crip on April 25, 2010, 11:42:21 PM
yep ,
B0ss .. = 'codemonkey' :P
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: IchBin on April 26, 2010, 05:36:13 PM
hehe, getting there slowly Crip. :) It's hard to articulate what one needs some times. Sooner or later one of us will get it. :D
Title: Re: Creating Buttons with TP 1.0 5-1 & SMF 2.0RC3
Post by: lurkalot on April 27, 2010, 06:47:24 PM
Quote from: Crip on April 25, 2010, 09:05:21 PM
easy way , copy + paste [Home] tab and then add your [name] + URL

Easiest way I've found is to use these two mods,

Custom site menu (http://custom.simplemachines.org/mods/index.php?mod=2259) Compatible With: 2.0 RC1.2, 2.0 RC2.  You'll need to install it in emulate mode.  Runs fine on my RC3 install.

And this one to adjust the order of your menu buttons,  Menu order (http://custom.simplemachines.org/mods/index.php?mod=2348)  Compatible With: 2.0 RC2, 2.0 RC3

Couldn't be much easier than this. ;)

Thanks to ozzie for pointing these out to me. ;)  http://www.smfarcade.info/forum/index.php?topic=6941.0