Every time that I do a submittal in the admin section on a tab that isn't the default tab, I get sent back to the first (default) tab!!
I'm using:
$active_tab = (isset($params['active_tab'])) ? $params['active_tab'] : 'states';
But nothing seems to be getting passed in to get us back to the same tab once a submit button has been pressed from a different tab!
Thanks,
Brett
How do you return to the same tab in the admin section?
Re: How do you return to the same tab in the admin section?
genepilot,
I use the following in a back end program (in this case action.addcategory.php):
In the action.defaultadmin.php the following is done:
Hope this helps,
Duketown
I use the following in a back end program (in this case action.addcategory.php):
Code: Select all
$params = array('active_tab'=>'categories');
$this->Redirect( $id, 'defaultadmin', $returnid, $params );
Code: Select all
$active_tab = 'categories';
if( isset( $params['active_tab'] ) ) {
$active_tab = $params['active_tab'];
}
Duketown
Re: How do you return to the same tab in the admin section?
The first trick is that you need to fill the variable $params['active_tab'] by yourself in that script that will be processed when submitting something and put this $params array into that function that redirects to the adminpanel after the action is completed.
(like the duke already told you).
The second trick is to tell the CMS API in the script that shows the adminpanel (usually action.defaultadmin.php) what to do if we have an active tab.
(like the duke also already told)
The last thing is to use that variable $active_tab when creating the tabs for the adminpanel.
Usually tabs are created liek this one (look where the variable $active_tab is used):
In your module template you now can create the tabs via smarty:
(like the duke already told you).
The second trick is to tell the CMS API in the script that shows the adminpanel (usually action.defaultadmin.php) what to do if we have an active tab.
(like the duke also already told)
The last thing is to use that variable $active_tab when creating the tabs for the adminpanel.
Usually tabs are created liek this one (look where the variable $active_tab is used):
Code: Select all
// TabHeaders
$this->smarty->assign('startTabHeaders',$this->StartTabHeaders());
$this->smarty->assign('endTabHeaders',$this->EndTabHeaders());
$this->smarty->assign('tab1',$this->SetTabHeader('tab1',$this->lang('tab1'), ($active_tab=='tab1'?true:'')));
$this->smarty->assign('tab1',$this->SetTabHeader('tab2',$this->lang('tab2'), ($active_tab=='tab2'?true:'')));
$this->smarty->assign('tab1',$this->SetTabHeader('tab3',$this->lang('tab3'), ($active_tab=='tab3'?true:'')));
$this->smarty->assign('tab1',$this->SetTabHeader('tab4',$this->lang('tab4'), ($active_tab=='tab4'?true:'')));
$this->smarty->assign('tab1',$this->SetTabHeader('tab5',$this->lang('tab5'), ($active_tab=='tab5'?true:'')));
// the tabs
$this->smarty->assign('startTab1',$this->StartTab('tab1'));
$this->smarty->assign('startTab2',$this->StartTab('tab2'));
$this->smarty->assign('startTab3',$this->StartTab('tab3'));
$this->smarty->assign('startTab4',$this->StartTab('tab4'));
$this->smarty->assign('startTab5',$this->StartTab('tab5'));
$this->smarty->assign('startTabContent',$this->StartTabContent());
$this->smarty->assign('endTabContent',$this->EndTabContent());
$this->smarty->assign('endTab',$this->EndTab());
In your module template you now can create the tabs via smarty:
Code: Select all
{$startTabHeaders}
{$tab1}
{$tab2}
{$tab3}
{$tab4}
{$tab5}
{$endTabHeaders}
{$startTabContent}
{$startTab1}
...
{$endTab}
{$startTab2}
...
{$endTab}
{$startTab3}
...
{$endTab}
{$startTab4}
...
{$endTab}
{$startTab5}
...
{$endTab}
{endTabContent}
Last edited by NaN on Thu Oct 30, 2008 1:03 am, edited 1 time in total.
Re: How do you return to the same tab in the admin section?
Thanks guys!
I actually went a bit of a different route with this. Since I was using forms to carry information back and forth between lists and edit/add forms, I used the following code:
$lPath = $_SERVER['SCRIPT_NAME'].'?module=Topics&active_tab=assets';
This is what I plugged into the action for the form.
Then I used:
$active_tab = (isset($params['active_tab'])) ? $params['active_tab'] : ((isset($_GET['active_tab'])) ? $_GET['active_tab'] : 'states');
To get the current active tab.
Not a perfect solution but it works just the way I need.
I was wondering how much discussion has been going on in regards to the implementation of the admin tabs. It is ingenious in how it's implemented but it does create some circumstances that are a bit of a pain-in-the-butt to deal with as well.
I actually went a bit of a different route with this. Since I was using forms to carry information back and forth between lists and edit/add forms, I used the following code:
$lPath = $_SERVER['SCRIPT_NAME'].'?module=Topics&active_tab=assets';
This is what I plugged into the action for the form.
Then I used:
$active_tab = (isset($params['active_tab'])) ? $params['active_tab'] : ((isset($_GET['active_tab'])) ? $_GET['active_tab'] : 'states');
To get the current active tab.
Not a perfect solution but it works just the way I need.
I was wondering how much discussion has been going on in regards to the implementation of the admin tabs. It is ingenious in how it's implemented but it does create some circumstances that are a bit of a pain-in-the-butt to deal with as well.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: How do you return to the same tab in the admin section?
Don't do that..... or your module probably won't work with 1.5
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.