Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: [MOD] Article list under Categories (sNews 1.5)  (Read 16565 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
[MOD] Article list under Categories (sNews 1.5)
« Reply #15 on: February 20, 2007, 08:20:09 AM »

Waiting ... :lol:
Logged
"It's only dead fish that goes with the flow... "
Updated

Pali

  • Full Member
  • ***
  • Karma: 16
  • Posts: 111
    • LE-PAVON
[MOD] Article list under Categories (sNews 1.5)
« Reply #16 on: February 20, 2007, 04:41:43 PM »

mod is here. Enjoy!
« Last Edit: February 20, 2008, 01:20:03 PM by philmoz »
Logged
I like sNews!

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
[MOD] Article list under Categories (sNews 1.5)
« Reply #17 on: February 21, 2007, 10:49:44 AM »

Thanks a bunch, oniip. Will investigate ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

bobcat

  • Jr. Member
  • **
  • Karma: 1
  • Posts: 67
    • ESL Jobs by Country
[MOD] Article list under Categories (sNews 1.5)
« Reply #18 on: June 18, 2007, 01:11:03 AM »

Is there any way to disable the drop down java part of this script.

I am just looking for something to simply list articles under categories. No need to hide them as i only have 1 article per category.

Thanks!

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
[MOD] Article list under Categories (sNews 1.5)
« Reply #19 on: June 18, 2007, 03:37:46 AM »

quick way, -- I think this will work... :)
locate in the code (first post)

Quote
if ($divid!==$divset){$echo.='display:none;';}
and alter to
Quote
if ($divid!==$divset){$echo.='';}
(note, that it is 2 single quotes, not a double quote...)
this removes the hiding of the article listing divs...

You could then just go through and remove all the onclick=toggle bits (carefully).
Logged
Of all the things I have lost, it is my mind that I miss the most.

bobcat

  • Jr. Member
  • **
  • Karma: 1
  • Posts: 67
    • ESL Jobs by Country
[MOD] Article list under Categories (sNews 1.5)
« Reply #20 on: June 18, 2007, 11:46:27 AM »

Thanks Phil, bit of mucking around i i think i worked it out.

snapplekid13

  • Newbie
  • *
  • Karma: 0
  • Posts: 23
[MOD] Article list under Categories (sNews 1.5)
« Reply #21 on: June 29, 2007, 06:43:46 PM »

When I add some style to this mod it doesn't do what it normally does...

http://towncook.com/recipes/ ( with style )

If you look on the left  it doesn't move down like the one here:

http://towncook.com/articles/  ( without style )

The DIV/CSS with style looks like this:

.leftmenu {
   border-left:1px solid #dee0e2;
   border-right:1px solid #dee0e2;
   padding:3px 6px 4px 4px;
   }
.leftmenu ul {
   margin:0;
   padding:0;
   list-style:none;
   }
.leftmenu li {
   background:#f3f4f5 url(images/arrow.gif) 9px 12px no-repeat;
   height:28px;
   line-height:28px;
   font-family:Verdana, Arial, Helvetica, sans-serif;
   padding-left:24px;
   margin:3px 0 4px 0;
   }
.leftmenu li a {
   text-decoration:none;
   }

Without Style:

.right_1_inner {
   border-left:1px solid #cecfcf;
   border-right:1px solid #cecfcf;
   padding:5px;
   }

I think it has to do with the UL and LI funtions I have in my .css file correct?
Logged

centered

  • Guest
Re: [MOD] Article list under Categories (sNews 1.5)
« Reply #22 on: December 11, 2007, 11:53:12 PM »

Update to this mod from me.  I noticed that this mod did not validate for me and I also wanted a way to control the links outside of the engine file.  In doing so, I cleaned up some code and now presenting this to you all.

This is also against a 1.6 version

0. BACKUP, BACKUP, BACKUP!!

1. In index.php, replace categories with the below.  Take away the <ul></ul> tags that enclose the categories function call
Code: [Select]
<?php categories(0,1); ?>

This works the same as Philmoz's original function but I have it now in index, where it is easier to change.
$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.

2.  Replace categories with the following:
Code: [Select]
// DISPLAY expanded CATEGORIES (with toggle, set cat link, set home link)
function categories($link,$homelink) {
    if (!isset($_SESSION[db('website').'Logged_In'])){jsuser();}
    $categorySEF = get_id('category');
    $divset="expanda".$categorySEF;
    $class = $category_title == $categorySEF ? ' class="current"' : '';
    echo "<!-- start category listing -->\r\n".'<ul class="expandacat">';
    if($homelink == 1){ echo '<li class="expandacat">'."\r\n".'<a'.$class.' 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";
        $cm_result = mysql_query($calc_num_query);
        $num_rows = mysql_num_rows($cm_result);
            $category_title = $r['seftitle'];
            $divid="expanda".$category_title;
if ($divid!==$divset){ $style = ' style="display:none;"'; } else { $style = ''; }
            $class = $category_title == $categorySEF ? ' class="current"' : '';
            if ($link == 1){ $linking = ' href="'.db('website').$category_title.'/"'; } else { echo ''; }
            echo '<li class="expandacat">'."\r\n".'<a'.$class.' style="cursor:pointer;" title="'.$r['description'].'" onclick="toggle(\''.$divid.'\');return false"'.$linking.'>'.$r['name'].'';
            echo (s('num_categories') == 'on' ? ' ('.$num_rows.')' : '').'</a>'."\r\n";
if ($num_rows > 0) {
echo '<ul id="'.$divid. '" class="expandaArticles"'.$style.'>'."\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 '</ul>'."\r\n";
}
echo '</li>'."\r\n";
}
           echo "</ul>\r\n \r\n <!-- end category listing -->";
}

3. Add the css & javascript from the first post. 

4.  Your set to go.
« Last Edit: December 12, 2007, 12:00:09 AM by equilni »
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: [MOD] Article list under Categories (sNews 1.5)
« Reply #23 on: July 04, 2008, 12:07:45 PM »

When playing with this nice Mod I notice a little error if we set $linkingSwitch with 1.

You got a double "title" in the link.

If I remove the little sentence : title="'.$r['description'].'" Everything is correct

Default code :
Code: [Select]
if ($linkingSwitch == 1){$echo.=' href="'.db('website').$r['seftitle'].'/" title="'.$r['description'].'" ';}

Without title description
Code: [Select]
if ($linkingSwitch == 1){$echo.=' href="'.db('website').$r['seftitle'].'/" ';}

Working with  $linkingSwitch 0 or 1
Logged
Pages: 1 [2]