Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4253
Latest: Ineedsmfhelp
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43242
Total Topics: 7516
Most Online Today: 118
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 99
Total: 99

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

0 Members and 1 Guest are viewing this topic.

Offline exit

  • 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: 16428
    • 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

  • 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: 16428
    • 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

  • 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: 16428
    • 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
7265 Views
Last post March 10, 2010, 02:50:38 pm
by expedive
1 Replies
3930 Views
Last post April 15, 2011, 02:31:43 pm
by SMFHacks
6 Replies
4510 Views
Last post August 06, 2011, 07:46:03 pm
by simibill
0 Replies
3696 Views
Last post March 13, 2016, 10:08:25 pm
by SMFHacks
1 Replies
3660 Views
Last post April 26, 2017, 10:29:51 am
by nend

+- Recent Topics

is it possible to add support for odysee.com by SMFHacks
March 13, 2024, 10:53:28 pm

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

User Gallery Feature: move / bulk move images by SMFHacks
January 30, 2024, 05:48:25 pm

In the future it may be for smf 2.1.x? by smithloo
January 30, 2024, 12:55:34 am

Powered by EzPortal