PDA

View Full Version : DD Tab Menu Question



jblack199
03-15-2010, 11:38 PM
1) Script Title: DD Tab Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/ddtabmenu.htm

3) Describe problem:

Okay so I am building a custom CMS to use as the base of my website, as well as any client sites that I build.

I've been using this script for a while, and when I reloaded the page on every click things worked perfectly.

However, now I am doing all the admin stuff via Ajax to cut down on some of the bandwidth usage. I am also using the smarty template engine. so I have my constructor.tpl which contains the actual design of the administration panel.

my constructor.tpl will not reload at all during the entire session being logged into the administration panel, which is where my issue comes in.

So say I have a link in my constructor.tpl called like so:


<li><a href="#" onclick="changeNavigation('index.php', 'admin');" rel="admin"><span>Admin</span></a></li>

This is obviously one of the tabs I have added into my website. But elsewhere on my page I also have this link:


<a href="#" onclick="changeNavigation('index.php', 'admin');" class="top_link">My Account</a>

This is not a tab, but does go to the same page to update the account information for the logged in administrator.

Clicking these loads my javascript function ChangeNavigation which looks like:



function changeNavigation(url, query) {
req1=AjaxObjectCreateGeneral();
if(req1) {
var myRand = parseInt(Math.random()*99999999);
var query = query;
var url = url;
var srcs = url+"?pg="+query+"&rand="+myRand;
$('TransMsgDisplay').innerHTML='<img src="../templates/admin/img/indicator.gif" align="center">';
req1.onreadystatechange = processNavigation;
req1.open("GET",srcs,true);
req1.send(null);
}
}

function processNavigation()
{
if(req1.readyState == 4)
{
if(req1.status == 200)
{
var responseTextTrim=trim(req1.responseText);
$('TransMsgDisplay').innerHTML=responseTextTrim;
}
}

}


The question is, once the new page has been queried and displays how can I tell DD Tab Menu, which tab to select? Can't wrap my head around this...

Any help is appreciated.