News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Change url of "new topic" button in theme

Started by tdguchi, August 21, 2014, 01:40:39 PM

Previous topic - Next topic

tdguchi

Board: smf 2.0.8
URL: worldmega.org
Theme: The gray ( modified by me)


I dont know if I should post this here... because is a template modification... but not strict a graphic change....

I have created and action, and I want to change the "new topic" button on some boards to point to that action, instead of the action=post, in the rest of boards, the original action will be kept

Which file, and lines I need to modify, and add to get that effect?

thanks

Sir Osis of Liver

MessageIndex.template.php -



// Create the button set...
$normal_buttons = array(
'new_topic' => array('test' => 'can_post_new', 'text' => 'new_topic', 'image' => 'new_topic.gif', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0', 'active' => true),


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Burke ♞ Knight

However, that will change it for all boards.
I do not believe there is a way to change it for some, and not all.

Sir Osis of Liver

Needs an if statement containing board numbers for one action or the other.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

tdguchi

Im not at home now... but that is what i need, the button list

yes, as krash said, an if statement fits there

Sir Osis of Liver

Like this -



if ($context['current_board'] == 15)
$postopt = 'register';
else
$postopt = 'post';

// Create the button set...
$normal_buttons = array(

'new_topic' => array('test' => 'can_post_new', 'text' => 'new_topic', 'image' => 'new_topic.gif', 'lang' => true, 'url' => $scripturl . '?action=' . $postopt . ';board=' . $context['current_board'] . '.0', 'active' => true),


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

tdguchi

Quote from: Krash on August 21, 2014, 03:53:48 PM
Like this -



if ($context['current_board'] == 15)
$postopt = 'register';
else
$postopt = 'post';

// Create the button set...
$normal_buttons = array(

'new_topic' => array('test' => 'can_post_new', 'text' => 'new_topic', 'image' => 'new_topic.gif', 'lang' => true, 'url' => $scripturl . '?action=' . $postopt . ';board=' . $context['current_board'] . '.0', 'active' => true),



Yes xd thanks krash xd when I come back at home i will try it, and tell you the results

tdguchi

Sorry for double post

Krash, the code works and does what I need, thanks a lot

Advertisement: