Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: [CHANGED - assistance] Modified function categories() and IE6  (Read 5371 times)

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
[CHANGED - assistance] Modified function categories() and IE6
« on: February 16, 2008, 07:48:21 PM »

Hehe, not in any way suggesting that I am a coder, but still...

I have Phil's old "Article list under Categories (sNews 1.5)" applied (It is working with 1.6 )

Now the problems starts, hehe... I have a couple of categories to which articles are assigned, and should show up as sub-things. They do in IE7, Opera, Safari and Firefox. All is well, until I came across a friend who wanted to see what I was doing (having IE6) and I got to konw that the dropdown do not work...

I have tested original function with both original CSS, and the updated CSS, and it works. When swapping the original function for this one (below) the hovering (and OnClick) of buttons (which did work just a minute ago) stops working, thus meaning that the dropdown do not work either (Still doing this in mentioned browsers though):


Code: [Select]
Will add updated snippet later today 20/2

The CSS is this:
Code: [Select]
Will add updated snippet later today 20/2

and the index part of it all is this:
Code: [Select]
    <div class="navbar">   
      <?php categories(); ?>
    </div> 

So my issue is that I have currently 4 categories with articles in them (which should, and did at first in the default appearance, dropdown upon OnClick) Now after trying to add this menu to the site, I can visibly see it (looks neat) and I can click every link that have not got articles which should unfold (like start, contact ), but when trying to click the cat's that should drop, nothing happens... Not even a link is showing in the status field...

What is being outputted in my index.php is this:
Code: [Select]
  Will add updated snippet later today 20/2

Anyone... ? Please ? I'll die otherwise, hehe...
« Last Edit: February 20, 2008, 12:20:48 PM by Patric Ahlqvist »
Logged
"It's only dead fish that goes with the flow... "
Updated

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: [ASSISTANCE] Now here's a dilemma for the troubled CSS and PHP coder
« Reply #1 on: February 16, 2008, 09:03:00 PM »

Hehe... I've done some work with Stu's menus... and have this one working OK in my snews.ca re-boot project (dormant for 10 months or so). The function I am using with it is much shorter than yours:

Code: [Select]
<?php


// DISPLAY dropdown menu; CATEGORIES with dropdown Articles
# A new function, by oniip, added Mar.11.07 - http://www.solucija.com/forum/viewtopic.php?pid=23839#p23839
function categories_dropdown() {
    
$linkingSwitch=0;  // set to 1 to make category name act as a link to the category page.
    
$showHomeAsCAT=0// set to 0 to omit the Home link.
    
$categorySEF get_id('category');
    if(
$showHomeAsCAT==1){
    
echo '<li>'."\r\n".'<a href="'.db('website').'" title="'.s('website_title').'">'.l('home').'</a>'."\r\n".'</li>'."\r\n";
    }
    
$query "SELECT * FROM ".db('prefix')."categories WHERE published = 'YES' ORDER BY catorder ASC";
    
$result mysql_query($query);
    while (
$r mysql_fetch_array($result)) {
$calc_num_query "SELECT * FROM ".db('prefix')."articles WHERE position = 1 AND category = $r[id] AND published = '1' ORDER BY date DESC";
# Replace above string with this one when using Celebro's Article Re-ordering Mod
//$calc_num_query = "SELECT * FROM ".db('prefix')."articles WHERE position = 1 AND category = $r[id] AND published = '1' ORDER BY artorder ASC";
        
$cm_result mysql_query($calc_num_query);
        
$num_rows mysql_num_rows($cm_result);
        if (
$num_rows 0) {
$category_title $r['seftitle'];
$echo'<li>'."\r\n".'<a href="'.db('website').$r['seftitle'].'/" title="'.$r['description'].'" ';
if ($linkingSwitch == 1){$echo.=' href="'.db('website').$r['seftitle'].'/" title="'.$r['description'].'"';}
//next line replaces 2 lines to remove # of articles in brackets after cat-titles
        
$echo.='>'.$r['name'].'</a>'."\r\n";
        
//$echo.='>'.$r['name'];
//$echo.= (s('num_categories') == 'on' ? ' ('.$num_rows.')' : '').'</a>'."\r\n";
        
$echo.='<ul>'."\r\n";
        while (
$art mysql_fetch_array($cm_result)) {
        
$echo.= '<li><a href="'.db('website').$category_title.'/'.$art['seftitle'].'/" title="'.$art['title'].'">'.$art['title'].'</a></li>'."\r\n";
}
        echo 
$echo."</ul></li>\r\n";       }
   }
echo "\r\n \r\n <!-- end category listing -->";
}

?>


I'd love to work on adapting more of Stu's menus for sNews... but too many other things to do these days.  ;)
« Last Edit: February 16, 2008, 09:07:39 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: [ASSISTANCE] Now here's a dilemma for the troubled CSS and PHP coder
« Reply #2 on: February 18, 2008, 01:42:08 PM »

ahh, well, this won't do for me at this point in time... thanks anyhow, Doug. The version posted above (mine) is somewhat enhanced by Phill'my'man in order to stop certain category links from showing any sub's, so I need that.

I have reversed my thinking, not using Stu's menu as it became to difficult for me ;) I mearly stole the looks of it, and changed the CSS at hand to make it work accordingly, now only (hehe, "ONLY") having IE6 debacle... the freaking hover doesn't hover... IE7 great, FF great... Have to go check upon Opera and Safari... though...
Logged
"It's only dead fish that goes with the flow... "
Updated

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: [ASSISTANCE] Now here's a dilemma for the troubled CSS and PHP coder
« Reply #3 on: February 18, 2008, 02:37:19 PM »

Over the weekend I applied the above (my function & dropdown script) to a current project. I had already created a horizontal menu bar in the header for Category titles with a nice image bar background. When clicked, the  Category link(s) display that Category article page (as the Category home) and in the side-bar is an automatic vertical category-specific menu that changes with each category... to list both article and page links for the given Category.

The dropdown menu script required some tweaking since it positions elements absolutely but it works perfectly. This particular project is using Olle Axellson's most recent template released on his site at eatlon.com... the one that has three layout options: 3 column, left sidebar and right sidebar. Together they make a good combination. Once I get this project delivered and finished... I may release Olle's layout set with this dropdown menu in a new MESU and/orMEMU 1.7 package(s).

I should note that the function I posted above is based on the same categories function by Philmoz that you are using... only I had to strip it down to remove the stuff that was conflicting with Stu's menu script.  I would think the mods you have in your function should be able to work within my function as well... perhaps I'll take a looksee. One of these days I want to get around to adapting more of Stu Nicholl's menus to sNews templates & functions... but they are tricky to work with for the uninitiated.  :)

« Last Edit: February 18, 2008, 02:44:28 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: [ASSISTANCE] Now here's a dilemma for the troubled CSS and PHP coder
« Reply #4 on: February 20, 2008, 11:07:12 AM »

Have updated first post with new problem, and will attach new code snippets as soon as I get home (about 5 hours from now)
Logged
"It's only dead fish that goes with the flow... "
Updated

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: [CHANGED - assistance] Modified function categories() and IE6
« Reply #5 on: February 20, 2008, 05:45:12 PM »

@ Patric... the following assumes that you are (I think) using the Multiflex 5.3 template ported for sNews 1.6. If this is what you have installed, with a default snews.php file (or at least one with the default categories function in it), then this set-up for a drop-down menu is working OK for me in IE7 and FF... in that template package.

1. New Function for Category Dropdowns, copy & paste into default 1.6 snews.php file, above or below existing function categories():

Code: [Select]
<?php

// DISPLAY dropdown menu; CATEGORIES - WITH DROPDOWN MENU (keys, Feb.20.08)
function categories_dropdown() {
    
$linkingSwitch=0;  // set to 1 to make category name act as a link to the category page.
    
$showHomeAsCAT=1// set to 0 to omit the Home link.
    
$categorySEF get_id('category');
    if(
$showHomeAsCAT==1){
    
echo '<li>'."\r\n".'<a href="'.db('website').'" title="'.s('website_title').'">'.l('home').'</a>'."\r\n".'</li>'."\r\n";
    }
    
$query "SELECT * FROM ".db('prefix')."categories WHERE published = 'YES' ORDER BY catorder ASC";
    
$result mysql_query($query);
    while (
$r mysql_fetch_array($result)) {
$calc_num_query "SELECT * FROM ".db('prefix')."articles WHERE position IN (1,3) AND category = $r[id] AND published = 1";
        
$cm_result mysql_query($calc_num_query);
        
$num_rows mysql_num_rows($cm_result);
        if (
$num_rows 0) {
$category_title $r['seftitle'];
$echo'<li>'."\r\n".'<a href="'.db('website').$r['seftitle'].'/" title="'.$r['description'].'" ';
if ($linkingSwitch == 1){
$echo.=' href="'.db('website').$r['seftitle'].'/" title="'.$r['description'].'"';
}
//next line replaces 2 lines to remove # of articles in brackets after cat-titles
        
$echo.='>'.$r['name'].'</a>'."\r\n";
        
//$echo.='>'.$r['name']; $echo.= (s('num_categories') == 'on' ? ' ('.$num_rows.')' : '').'</a>'."\r\n";
        
$echo.='<ul>'."\r\n";
        while (
$art mysql_fetch_array($cm_result)) {
        
$echo.= '<li><a href="'.db('website').$category_title.'/'.$art['seftitle'].'/" title="'.$art['title'].'">'.$art['title'].'</a></li>'."\r\n";
}
        echo 
$echo."</ul></li>\r\n";       }
   }
echo "\r\n \r\n <!-- end category listing -->";
}

?>


2. In the Multiplex 5.3 index.php file, find the navbar division and replace it with:

Code: [Select]
<?php

    
<div class="navbar">
        <?
php echo '<ul>'categories_dropdown(); echo '</ul>'?>

    </div>

?>

And you will have a functioning dropdown Categories menu... with the dropdowns on top of everything else.
This has been tested OK on IE7 and FF.



« Last Edit: February 20, 2008, 05:59:23 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: [CHANGED - assistance] Modified function categories() and IE6
« Reply #6 on: February 20, 2008, 06:34:28 PM »

Thanks, Key's... I will try that aswell... I have been spending this day in front of the puter making my own solution, heh, which I will apply now. It is ok on another template just for testing purposes, and I will swap what is now for that... I'll have my fungertips on your solucija aswell...  You're indeed a rock ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [CHANGED - assistance] Modified function categories() and IE6
« Reply #7 on: February 20, 2008, 06:55:50 PM »

Patric ... does the submenu on my site work for you in IE6? (If you ask your buddy to take a peek and hover over the Work or Blog links...). If it does, you can have that solution, you'll need to change the styling of course, but it's an all CSS solution. No javascript involved... Holler back if you want it.
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: [CHANGED - assistance] Modified function categories() and IE6
« Reply #8 on: February 20, 2008, 11:42:02 PM »

Thanks Doug, and Freddie... Matters solved. I remade the menu, and Bobo helped me with the solution I needed... Great man that, Bobo ;)

23:40 gotta go up at 06:00, so I'm off to bed...
Logged
"It's only dead fish that goes with the flow... "
Updated