I've added some of those tabbed navigation bars (Amazon-style) in page_top
and while this script below works for the moment it's very laborious. I
don't like the fact that it needs to replicate some of the screen processes,
i.e. database calls, also I've not yet added support for subcategories.
It basically checks to see if there is a department or item variable, if not
this must be in the "welcome-ish" area -->Show the Welcome Tab as active and
the others as inactive. If yes and its a dept and the dept Parent is root
fine it's that department tab active...etc, etc...Oh and I'm only showing
the top level dept's...
My question is how has anyone else approached this?
I had a look at www.RestorationHardware.com, which I think is Leon's
handiwork (nice work), and I noticed that there are subdepartments which is
one way of getting round having to trace through varying dept levels to get
back to the main depts. But any other suggestions would be welcome because
this seems a very long-winded way to do it...
Thanks in advance,
Nick
--------------- here it is ------------------------------
if(!isset($department) AND !isset($item))
{
print("<A HREF=\"" . ScreenURL("shop_welcome") . "\">");
print("<IMG SRC=\"images/navigation/tab-welcome-active.gif\"
border=\"0\" width=\"94\" height=\"40\">");
print("</A>");
//show departments
$Query = "SELECT ID, Name ";
$Query .= "FROM department ";
$Query .= "WHERE Parent = '0' ";
$Query .= "ORDER BY DisplayPrecedence, Name ";
$DatabaseResult = mysql_query($Query, $DatabaseLink);
while($DatabaseRow = mysql_fetch_object($DatabaseResult))
{
print("<A HREF=\"" . ScreenURL("department") .
"&department=$DatabaseRow->ID\">");
print("<IMG SRC=\"images/navigation/tab-" .
strtolower($DatabaseRow->Name) . "-inactive.gif\" border=\"0\" width=\"94\"
height=\"40\">");
print("</A>");
}
}
elseif(isset($department) AND !isset($item))
{
$department = intval($department);
print("<A HREF=\"" . ScreenURL("shop_welcome") . "\">");
print("<IMG SRC=\"images/navigation/tab-welcome-inactive.gif\"
border=\"0\" width=\"94\" height=\"40\">");
print("</A>");
//show departments
$Query = "SELECT ID, Name ";
$Query .= "FROM department ";
$Query .= "WHERE Parent = '0' ";
$Query .= "ORDER BY DisplayPrecedence, Name ";
$DatabaseResult = mysql_query($Query, $DatabaseLink);
while($DatabaseRow = mysql_fetch_object($DatabaseResult))
{
if($DatabaseRow->ID == $department)
{
print("<A HREF=\"" . ScreenURL("department") .
"&department=$DatabaseRow->ID\">");
print("<IMG SRC=\"images/navigation/tab-" .
strtolower($DatabaseRow->Name) . "-active.gif\" border=\"0\" width=\"94\"
height=\"40\">");
print("</A>");
}
else
{
print("<A HREF=\"" . ScreenURL("department") .
"&department=$DatabaseRow->ID\">");
print("<IMG SRC=\"images/navigation/tab-" .
strtolower($DatabaseRow->Name) . "-inactive.gif\" border=\"0\" width=\"94\"
height=\"40\">");
print("</A>");
}
}
}
else
{
//show departments
$Query = "SELECT Department ";
$Query .= "FROM department_item ";
$Query .= "WHERE Item = $item ";
$DatabaseResult = mysql_query($Query, $DatabaseLink);
while($DatabaseRow = mysql_fetch_object($DatabaseResult))
{
$itemDept = $DatabaseRow->Department;
print("<A HREF=\"" . ScreenURL("shop_welcome") . "\">");
print("<IMG SRC=\"images/navigation/tab-welcome-inactive.gif\"
border=\"0\" width=\"94\" height=\"40\">");
print("</A>");
//show departments
$Query = "SELECT ID, Name ";
$Query .= "FROM department ";
$Query .= "WHERE Parent = '0' ";
$Query .= "ORDER BY DisplayPrecedence, Name ";
$DatabaseResult = mysql_query($Query, $DatabaseLink);
while($DatabaseRow = mysql_fetch_object($DatabaseResult))
{
if($DatabaseRow->ID == $itemDept)
{
print("<A HREF=\"" . ScreenURL("department") .
"&department=$DatabaseRow->ID\">");
print("<IMG SRC=\"images/navigation/tab-" .
strtolower($DatabaseRow->Name) . "-active.gif\" border=\"0\" width=\"94\"
height=\"40\">");
print("</A>");
}
else
{
print("<A HREF=\"" . ScreenURL("department") .
"&department=$DatabaseRow->ID\">");
print("<IMG SRC=\"images/navigation/tab-" .
strtolower($DatabaseRow->Name) . "-inactive.gif\" border=\"0\" width=\"94\"
height=\"40\">");
print("</A>");
}
}
}
}
--------------------------------------------------------------
----------------------
Lab2 Design-Unit
URL: http://www.lab2.com.au
e-mail: [EMAIL PROTECTED]
----------------------
_______________________________________________
FreeTrade-dev mailing list
[EMAIL PROTECTED]
http://share.whichever.com/mailman/listinfo/freetrade-dev