Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12284
Latest: arthurheller99
New This Month: 11
New This Week: 5
New Today: 0
Stats
Total Posts: 39488
Total Topics: 6961
Most Online Today: 134
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 63
Total: 64

Author Topic: custom menu detecting the current action  (Read 987 times)

0 Members and 1 Guest are viewing this topic.

Offline exit

  • Badge Awards Customer
  • Jr. Member
  • *****
  • Posts: 92
    • View Profile
custom menu detecting the current action
« on: February 04, 2018, 12:34:04 pm »
So, I'm trying to build a menu, not using smf menus. Basically I'm trying to get the active action, but with no luck. What am I doing wrong?

Code: [Select]
<li>
<a class="' , $current_action == 'SPortal' ? 'active' : 'not-active' , '" href="' , $scripturl , '">Home</a>
</li>
<li>
<a class="' , $current_action == 'classifieds' ? 'active' : 'not-active' , '"href="' , $scripturl , '?action=classifieds">Marketplace</a>
</li>

In this example, I'm trying to get the current actions for simpleportal and for the classifieds mod.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14769
    • View Profile
Re: custom menu detecting the current action
« Reply #1 on: February 04, 2018, 12:54:44 pm »
Is  $current_action a global set in the same function you are in?
You can also do with $_REQUEST['action']  to check the action name.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline exit

  • Badge Awards Customer
  • Jr. Member
  • *****
  • Posts: 92
    • View Profile
Re: custom menu detecting the current action
« Reply #2 on: February 04, 2018, 01:07:48 pm »
Is  $current_action a global set in the same function you are in?
You can also do with $_REQUEST['action']  to check the action name.

I added $current_action to the global set, now it identifies the action :)

Code: [Select]
' , $current_action == 'classifieds' ? 'current' : 'not' , '
this is not retrieving 'current' though, anything wrong here?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14769
    • View Profile
Re: custom menu detecting the current action
« Reply #3 on: February 04, 2018, 01:13:17 pm »
I would echo the output of $current_action  to see what it is returning.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline exit

  • Badge Awards Customer
  • Jr. Member
  • *****
  • Posts: 92
    • View Profile
Re: custom menu detecting the current action
« Reply #4 on: February 04, 2018, 01:14:34 pm »
I would echo the output of $current_action  to see what it is returning.

How can I do that?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14769
    • View Profile
Re: custom menu detecting the current action
« Reply #5 on: February 04, 2018, 01:31:32 pm »
on it's own line
echo  $current_action;
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

emilyturner

  • Guest
Re: custom menu detecting the current action
« Reply #6 on: March 17, 2018, 04:25:33 am »
Thanks a lot for this reply, it has helped me too

 

Related Topics

  Subject / Started by Replies Last post
8 Replies
4348 Views
Last post March 10, 2010, 02:50:38 pm
by expedive
1 Replies
1896 Views
Last post April 15, 2011, 02:31:43 pm
by SMFHacks
6 Replies
2198 Views
Last post August 06, 2011, 07:46:03 pm
by simibill
0 Replies
1587 Views
Last post March 13, 2016, 10:08:25 pm
by SMFHacks
1 Replies
1690 Views
Last post April 26, 2017, 10:29:51 am
by nend

+- Recent Topics

SMF 2.1 RCI & SMF Gallery Pro 8.04 500 Errors by SMFHacks
Today at 11:43:22 am

Bulk upload image problem by SMFHacks
February 14, 2019, 11:09:20 pm

Can the old store mod work on SMF 2.1? by SMFHacks
February 13, 2019, 08:58:13 pm

Is it possible for an admin user to upload photos to a nonadmin user's gallery? by 10341mouse
February 13, 2019, 11:15:56 am

SMF Gallery Pro and AD Seller Pro now for SMF 2.1.x by SMFHacks
February 11, 2019, 07:23:56 pm

[Mod]Push Notifications by shuban
February 06, 2019, 09:18:16 pm

Tinyportal and Mkportal.Which is better? by Oldiesmann
February 06, 2019, 07:23:16 pm

SMF 2.1 RC 1 Released by SMFHacks
February 04, 2019, 06:52:36 pm

Customer can't find what to do... by SMFHacks
February 04, 2019, 04:47:38 pm

"Undefined Index" errors by SMFHacks
January 30, 2019, 05:50:42 pm

Powered by EzPortal