Support Forums

Old 08-09-2007, 04:44 AM   #1
Senior Member
 
Join Date: Sep 2006
Posts: 226
Rep Power: 15
Tim_A is on a distinguished road
Default 'Active' state on menu

Can anyone explain the php needed to make the top buttons stay on there 'active' state once clicked?

I've found a few scripts but they won't seem to work because of all the variables after the category.php

e.g. i've now got a custom button at the top linked to category.php?cat=charities so i'd like the button to stay in the active/hover state when it's clicked.

as always any help appreciated.
__________________
V4.0.9 Developer

Last edited by Tim_A; 08-09-2007 at 05:06 AM.
Tim_A is offline   Reply With Quote
Old 08-09-2007, 08:54 AM   #2
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,700
Rep Power: 109
Eric Barnes is a jewel in the rough
Default

You could do some thing like this:
Code:
<a href="#" {if $smarty.get.cat == 'charities'}class="active"{/if}></a>
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules
Eric Barnes is online now   Reply With Quote
Old 08-09-2007, 10:02 AM   #3
Senior Member
 
Join Date: Sep 2006
Posts: 226
Rep Power: 15
Tim_A is on a distinguished road
Default

Thanks Eric...

that works,

but.... (there's always a but with me!!)

it won't work if you go into child categories.

Is there a solution?

Cheers
__________________
V4.0.9 Developer
Tim_A is offline   Reply With Quote
Old 08-09-2007, 10:17 AM   #4
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,700
Rep Power: 109
Eric Barnes is a jewel in the rough
Default

How many sub categories do you have? You could always list out each one in the if statement:
Code:
{if $smarty.get.cat == 'charities' || $smarty.get.cat =='charitiessubcat'}
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules
Eric Barnes is online now   Reply With Quote
Old 08-09-2007, 10:20 AM   #5
Senior Member
 
Join Date: Sep 2006
Posts: 226
Rep Power: 15
Tim_A is on a distinguished road
Default

over 25 in some places

i've worked out how to do it for my pages which end in .php
__________________
V4.0.9 Developer
Tim_A is offline   Reply With Quote
Old 08-09-2007, 10:35 AM   #6
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,700
Rep Power: 109
Eric Barnes is a jewel in the rough
Default

Will you post how you are doing it with the php pages and maybe that give me a better idea.
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules
Eric Barnes is online now   Reply With Quote
Old 08-09-2007, 10:39 AM   #7
Senior Member
 
Join Date: Sep 2006
Posts: 226
Rep Power: 15
Tim_A is on a distinguished road
Default

At the top of the .php page i've got this:

PHP Code:
<?php $thispage "cardiff";?>
Then the navigation has this:

PHP Code:
<li class="cardiff"><a class="<?php if($thispage=="cardiff"){echo"active";} ?>" href="cardiff.php">Cardiff</a></li>
__________________
V4.0.9 Developer
Tim_A is offline   Reply With Quote
Old 08-09-2007, 11:25 AM   #8
Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,282
Rep Power: 37
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

Can you just make an "a:link, hover, active" the same in your stylesheet?

Just a thought,
-Mike
__________________
Mike-N-Tosh
v3.1.10 Developer IndianaPC.org - A community website
Sandbox v4.0.9, 4.1
Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds.
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 08-09-2007, 12:08 PM   #9
Staff
 
Join Date: Mar 2006
Posts: 395
Rep Power: 20
Blair will become famous soon enough
Default

Quote:
Originally Posted by Tim_A View Post
At the top of the .php page i've got this:

PHP Code:
<?php $thispage "cardiff";?>
Then the navigation has this:

PHP Code:
<li class="cardiff"><a class="<?php if($thispage=="cardiff"){echo"active";} ?>" href="cardiff.php">Cardiff</a></li>
If you assign a php variable and then check to see if it exists later in the page, it will always be true. I don't think you need the
PHP Code:
<?php $thispage "cardiff";?>
If you want a tab to appear in some other 'state' than the other tabs (and each tab represents a parent category), you're going to have to figure out some way of finding out the top category from the category name (appended as a query string) in the address.
__________________
Blair
68C Staff

68C Downloads | Report a Bug | Knowledge Base
Blair is offline   Reply With Quote
Old 08-09-2007, 01:17 PM   #10
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,700
Rep Power: 109
Eric Barnes is a jewel in the rough
Default

Mike.

Try this.

Open the category.php file and below the require_once statements add this function:

PHP Code:
function getAbsoluteParent($id)
    {
        global 
$db;
        
$arr = array();
        
$sSQL="SELECT id,parent_id FROM ".PREFIX."categories WHERE id=".$id." AND display<>'N' AND cLink='' ORDER BY cORDER DESC, name ASC";
        
$result=$db->query($sSQL);
        
$row $result->fetch();
        
        if (
$row['parent_id']!=0
        {
            
$path getAbsoluteParent($row['parent_id']);
        } 
        else
        {
            
$path $row['id'];
        }
        return 
$path;
    } 
Then inside the if statement:
PHP Code:
if($cat)
            {
                
$keywords$cat['cKeywords'];
                
$description=$cat['description'];
                
$promo $cat['cPromo'];
//add this line:
                
$class_tpl->assign('parent'getAbsoluteParent($cat['id'])); 
Then in your template file:
{if $parent == 1} change 1 to the actual parent id.
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules
Eric Barnes is online now   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting a default State manilaboy v3.1 Questions & Support 2 10-17-2006 12:40 PM
Wrong status (active, inactive) for renewed ads with options pat01 v3.1 Questions & Support 0 07-29-2006 04:05 AM
Ads Listed By State garysmith v3.0 Questions & Support 10 04-25-2006 05:50 PM
State field quickbiz v3.0 Questions & Support 6 04-25-2006 12:03 PM
Memberships - not active Chaslie v3.1 Questions & Support 4 04-11-2006 08:57 PM


All times are GMT -4. The time now is 10:42 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0