Support Forums

How To: Vertical Menus (non JS)?

This is a discussion on How To: Vertical Menus (non JS)? within the Pre Sales Questions forums, part of the Pre-Sales & Testimonials category; Hello, I am considering purchasing 68 Classifieds, however, I need to know one last thing before I make my decision. ...


Go Back   68 Classifieds Forums > Pre-Sales & Testimonials > Pre Sales Questions

Reply
 
Thread Tools Display Modes
Old 01-17-2007, 04:16 PM   #1
Unregistered
Guest
 
Posts: n/a
Default How To: Vertical Menus (non JS)?

Hello,
I am considering purchasing 68 Classifieds, however, I need to know one last thing before I make my decision. In order to integrate an existing website into 68 Classifieds, I need to be able to make a vertical menu with both the Categories and Subcategories visible. I see there is one in the template examples, however it is a rather fancy Javascript one with icons and collapsibility. That's neat and all, but I want a non-JS version that I can apply my own styling to so that I can maintain the current site's appearance while upgrade it's functionality with 68C.
What template code/coding would I use in order to generate an output of the Category and Subcategories in such a fashion as this or something similar:

<ul>
<li>Main Category
<ul>
<li>Subcategory</li>
<li>Subcategory</li>
<li>Subcategory</li>
</ul>
</li>
<li>Main Category2
<ul>
<li>Subcategory</li>
<li>Subcategory</li>
<li>Subcategory</li>
</ul>
</li>
</ul>

Thank you for your assistance.

Dawn
  Reply With Quote
Old 01-17-2007, 05:01 PM   #2
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,493
Rep Power: 132
Eric Barnes is just really nice Eric Barnes is just really nice
Default

Hi Dawn,

That is very possible. The javascript menu was built with a custom Smarty plugin and I am sure one can be built into this.

Unfortunately right now I don't have time to custom build one but if you make the purchase I am sure I can post something here which would format a list in this manner.
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 01-17-2007, 05:06 PM   #3
Unregistered
Guest
 
Posts: n/a
Default

That's cool. Would it be possible to have it also show the number of ads in that category as well, like so:


<ul>
<li>Main Category
<ul>
<li>Subcategory (2)</li>
<li>Subcategory (0)</li>
<li>Subcategory (6)</li>
</ul>
</li>
</ul>

.... and so on?
Oh, and I would want that menu static on all the pages, meaning all the categories and subcategories are always visible and accessible?

Dawn
  Reply With Quote
Old 01-17-2007, 05:20 PM   #4
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,493
Rep Power: 132
Eric Barnes is just really nice Eric Barnes is just really nice
Default

I am sure that could be done as well. It would just require another query to get the number of listings.
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 01-17-2007, 06:06 PM   #5
Unregistered
Guest
 
Posts: n/a
Thumbs up

Cool. We'll be purchasing a license here shortly (Darrel Hendrix/MetroWeb Team) and look forward to seeing your solution for the menu. Thank you for answering my questions so promptly.
I think you have a great product.

Dawn

P.S. I love your avatar
  Reply With Quote
Old 01-17-2007, 06:30 PM   #6
Unregistered
Guest
 
Posts: n/a
Default

Okay, we've put a purchase through for the software, but there are two versions the regular and the upgrade. Which do we choose?

Dawn
  Reply With Quote
Old 01-17-2007, 08:11 PM   #7
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 1,999
Rep Power: 62
juven14 is a jewel in the rough
Default

Are you talking about the downloads in the members section?

If so then you do the install version the first time around and the upgrade version for newer releases after your initial install.
__________________
John Snyder
PHP Developer
juven14 is offline   Reply With Quote
Old 01-18-2007, 12:47 PM   #8
Unregistered
Guest
 
Posts: n/a
Default

Yes, when we went to download the software for the first time, there were two links present, one for a that had a version number download, then below it another one with the same version number download with the word upgrade after it.
Do we need both those, or only one? If only one, which one?

Dawn

Note to Eric: Any idea when you might have something on that menu code?
  Reply With Quote
Old 01-19-2007, 09:52 AM   #9
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,493
Rep Power: 132
Eric Barnes is just really nice Eric Barnes is just really nice
Default

Here is some code you can use. It may take a little tweaking but I believe it should work.

First create a new file named:
includes/classes/smarty/plugins/function.categories_ul.php
Then include this code:
PHP Code:
<?php
/**
 * smarty_function_categories_ul
 *
 * This function is useful for using your categories in the navigation.
 *
 * All source code & content (c) Copyright 2006, 68 Classifieds
 * unless specifically noted otherwise.
 *
 * @package 68classifieds
 * @author  Eric Barnes
 * @copyright 68 Classifieds
 * @link http://www.68classifieds.com
 * @$Revision: 1.1 $
 * @Updated: $Date: 2007/01/08 19:12:22 $
 */
 
function smarty_function_categories_ul($params, &$smarty)
{
    global 
$db;
    
    
$ul_attr '';
    
$li_attr '';
    
$show_total 'N';

    foreach (
$params as $_key=>$_value
    {
        switch (
$_key
        {
            case 
'depth':
                $
$_key = (int)$_value;
                break;

            case 
'ul_attr':
            case 
'li_attr':
            case 
'show_total':
                $
$_key = (string)$_value;
                break;
        }
    }
    
    
$sSQL="SELECT id,name,parent_id,cOrder,cLink FROM ".PREFIX."categories WHERE parent_id=0 AND display<>'N' ORDER BY cORDER DESC, name ASC";
    
$result=$db->query($sSQL);
    
$output="<ul ".$ul_attr.">\n";
    while(
$row $result->fetch())
    {
        
$id=$row['id'];
        
$parent=$row['parent_id'];
        if(
$row['cLink']<>'')
        {
            
$link=$row['cLink'];    
        }
        else
        {
            
$link='category.php?type='.$id;    
        }
        
$output .= "<li ".$li_attr."><a href=\"".$link."\">".$row['name']."</a>\n";
        if(
$show_total=='Y') {
            
$output.="( "getTotal($id) .")";
        }
        
//get sub categories
        
$sSQL2="SELECT id,name,parent_id,cOrder,cLink FROM ".PREFIX."categories WHERE parent_id=".$id." AND display<>'N' ORDER BY cORDER DESC, name ASC";
        
//$output.=$sSQL2."\n";
        
$result2=$db->query($sSQL2);
        if(
$result2->size() > 0)
        {
            
$output.="<ul>\n";
            while(
$row $result2->fetch())
            {
                
$subid=$row['id'];
                if(
$row['cLink']<>'')
                {
                    
$link=$row['cLink'];    
                }
                else
                {
                    if(
$subid>1)
                    {
                        
$link='category.php?type='.$id.'&sec='.$subid;
                    }
                    else
                    {
                        
$link='category.php?type='.$subid;    
                    }
                }
                
$output .= "<li ".$li_attr."><a href=\"".$link."\">".$row['name']."</a>\n";
                if(
$show_total=='Y') {
                        
$output.="( "getTotal($subid) .")";
                }
            }
            
$output.="</ul>\n";
        }
        
$output.="</li>\n";
    }
    
$output.="</ul>\n";
    return 
$output;
}
function 
getTotal($cat)
{
    global 
$db;
    
$sSQL="SELECT COUNT(*) AS total FROM ".PREFIX."listings WHERE display = 'Y' AND expiration > NOW() AND section=".$cat;
    
$result=$db->query($sSQL);
    
$row $result->fetch();
    return 
$row['total'];
}
?>
Next in your template file add:
Code:
{categories_ul show_total='Y'}
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 01-19-2007, 10:17 AM   #10
Junior Member
 
 
Join Date: Jan 2007
Posts: 19
Rep Power: 16
dawnrae is on a distinguished road
Default

I created the file: function.categories_ul.php and uploaded it to the smarty plugins folder as directed and then put the template tag into my page where I wanted the menu to appear. here is the message I received:

Notice: Query failed: Table 'hshomefr_classifieds.class_listings' doesn't exist SQL: SELECT COUNT(*) AS total FROM class_listings WHERE display = 'Y' AND expiration > NOW() AND section=9 in /home/hshomefr/public_html/classifieds/includes/classes/database/mysql.php on line 135

Here's a link for you to see the page:

http://www.hotspringshomefront.com/classifieds/

It shows the menu down below the query errors, but the ad totals do not show.

Dawn

P.S. Your assistance in this matter is greatly appreciated

Last edited by dawnrae; 01-19-2007 at 10:37 AM.
dawnrae is offline   Reply With Quote
Reply

Tags
None

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Featured Listings Vertical SkGold Templates, HTML, CSS, and Design Help 8 06-10-2006 02:08 AM


All times are GMT -4. The time now is 01:38 PM.


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