Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Pages: 1 ... 4 5 [6] 7 8

Author Topic: [PACKAGE] Subcategories  (Read 40494 times)

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Re: [PACKAGE] Subcategories
« Reply #75 on: March 03, 2008, 12:36:54 pm »

This mod is possible to work also with snewsMU?
Logged

centered

  • Guest
Re: [PACKAGE] Subcategories
« Reply #76 on: March 03, 2008, 12:56:45 pm »

My answer would be: I don't know.
My gut answer would be:  I don't see why not.
The person to ask is Doug (Keyrocks) since he may know better on that.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: [PACKAGE] Subcategories
« Reply #77 on: March 03, 2008, 02:13:32 pm »

My answer would be: I don't know. My gut answer would be:  I don't see why not.
The person to ask is Doug (Keyrocks) since he may know better on that.

Yes, it does. During its development, I installed it as it was at the end of December in 3 sNews 1.6 projects - default and MU with no other mods, and in a heavily modded MEMU and it works fine in all three. The version released here has several improvements over the one I used, and I have not had time yet to update my 3 projects yet.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
Re: [PACKAGE] Subcategories
« Reply #78 on: March 04, 2008, 12:04:02 pm »

hey all
i am looking at the paginator function,
it has the problem with missing part of the url.

Code: [Select]
http://localhost/website//p_2/

awesome day

centered

  • Guest
Re: [PACKAGE] Subcategories
« Reply #79 on: March 04, 2008, 12:42:52 pm »

In function articles()
replace teh line after:
Code: [Select]
$home = l('home_sef'); $categorySEF = get_id('category');

with:
Code: [Select]
$categorySEF = empty($categorySEF) ? $home : $categorySEF;
Then find:
Code: [Select]
paginator($categorySEF, $currentPage, $totalPages, '', l('paginator'));Before that line add:
Code: [Select]
if (!empty($subcatSEF)) { $categorySEF = $categorySEF.'/'.$subcatSEF; } else { $categorySEF = $categorySEF; }
Logged

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
Re: [PACKAGE] Subcategories
« Reply #80 on: March 04, 2008, 02:12:23 pm »

 8) works great, thank you

centered

  • Guest
Re: [PACKAGE] Subcategories
« Reply #81 on: March 04, 2008, 02:56:35 pm »

hmm it may be a band aid solution now that I review it...... may not be an ideal solution though...
Logged

Nicu Alecu

  • Full Member
  • ***
  • Karma: 12
  • Posts: 224
    • BLUEBYTE.ro // IT consultant
Re: [PACKAGE] Subcategories
« Reply #82 on: March 26, 2008, 08:25:40 am »

Hi, EQ.
Does the download package contain all the notes, bug fixes and boosters? I mean ... is it stable? I finally have some time to test this mod (and some need to use it ;), of course), and you guys kinda lost me along the 6 pages of "coding esperanto" ;D
Logged

centered

  • Guest
Re: [PACKAGE] Subcategories
« Reply #83 on: March 26, 2008, 09:46:42 am »

Just add the fixes and you will be fine.... or wait a week..
Logged

tb0111

  • Guest
Re: [PACKAGE] Subcategories
« Reply #84 on: March 28, 2008, 04:14:57 am »

hi Keyrocks,

can you give me a quick guide to add this mod into MEMU.
Thank you
Logged

Nicu Alecu

  • Full Member
  • ***
  • Karma: 12
  • Posts: 224
    • BLUEBYTE.ro // IT consultant
Re: [PACKAGE] Subcategories
« Reply #85 on: March 28, 2008, 05:52:58 am »

Just add the fixes and you will be fine.... or wait a week..

Thanks EQ. I think I'll wait ... I'm in no rush  ;)
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: [PACKAGE] Subcategories
« Reply #86 on: March 28, 2008, 01:28:18 pm »

hi Keyrocks,
can you give me a quick guide to add this mod into MEMU.
Thank you

A quick guide:
1) Download the latest subcats package and the latest MU package.
2) Install both on your localhost server environment (XAMPP or WAMP) on your computer and get them both running and tested OK.
3) Open the snews.php files for both of them. Examine each carefully, function-by-function, noting where subcats mod locations
   are in snews.php (subcats) and where the same locations are in the snewsMU.php.

Just looking through the Dec.29.07 version of the subcats snews.php... I notice that the mod locations are prefixed with Subcategory Add. I can't remember if EQ put those in the file or if I did after doing a file comparison but I think EQ did. I think there are at least 28 mod locations... some are just a single string replacement while others are a complete function replacement or a complete new function. I haven't downloaded EQ's latest package so I can't say if all mod locations are prefixed with comments in it.

So... from there it's a matter of getting familiar with the code in each function and adding the Subcategory Add stuff into the snewsMU.php file... replacing or adding to each function as you go through the files. Making comment notes in the file along the way is also a good thing to do so you have references as to what you did when you go to trouble-shoot.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

centered

  • Guest
Re: [PACKAGE] Subcategories
« Reply #87 on: March 28, 2008, 07:02:25 pm »

Yes my mod's are (sort-of) clearly commeted.  This mod has // subcategory in all places. 
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: [PACKAGE] Subcategories
« Reply #88 on: July 14, 2008, 09:22:24 pm »

Several months have passed and I've continued working with the original Subcategories mod as part of the continued revision process with my current sNews 1,6 MEMU+++ project... now slowly emerging in its first Online Application Here.

Today I applied expandable Category Titles in the Sitemap Page and to the SubCategory titles (under them) as well. As an example... click the Bylaws & Policies Subcat under the Government Category to see how they work nicely. I also applied expandable Month/year titles in Archive Page and it works nicely too.

UPDATED: July 16.08
DISPLAYING CATEGORY / SUBCATEGORY TITLES ON ARCHIVE PAGE LINKS

As you notice... looking at the links in a default Archives page using the Subcategories Mods... the Category OR SubCategory title is displayed at the end of each link in brackets... pretty much as it does in a default archive function for both 1.6 and 1.7RC. There really isn't any way to tell if an article link is in a Category or a Subcategory within a Category... all titles are displayed only as one "Category" title.

This Modification will generate the Category Title if the article is listed under a Category... and generate both the Category AND SubCategory titles if the article is listed under a SubCategory within a Category.
EXAMPLES:
1 - Article Title in a Category (parent):  Article Title (Category Title)
2 - Article Title in a SubCategory (child):  Subcat Article Title (Category Title / Subcat Title)

Step One:
I've provided the complete function below. Though it has a few mods not in a default function... it will function OK for testing within a default sNews 1.6 package that has the Subcategories mods in it. To get the Category / Subcategory title displaying... we've replaced the $cat_name string with a new one, just below the comment-line that starts with # NEW STRING:.

Code: [Select]
<?php

// ARCHIVE - July 14.08 (keyrocks) - lists article & page links under expandable month/year titles
function archive() {
echo '<h2>'.l('archive').'</h2>';
$query "SELECT date FROM ".db('prefix')."articles WHERE position IN (1,3) AND published = 1 GROUP BY month(date) ORDER BY date DESC";
$result mysql_query($query);
$num mysql_num_rows($result);
$home s('home_sef');
$home_name l('home');
$month_names explode(', 'l('month_names'));
$i 1;
while ($r mysql_fetch_array($result)) {
   $year_month date('Y-m',strtotime($r['date']));
   $year substr($r['date'], 04);
   $month substr($r['date'], 52) -1;
   $month_name = (substr($month01) == 0) ? $month_names[substr($month11)] : $month_names[$month];
   # month/year titles, expandable
   echo '<div class="filelist_div"><p class="filelist_title"><a title="'.$month_name.', '.$year.'" onclick="toggle(\'sub'.$i.'\')" style="cursor: pointer;"><strong>'.$month_name.', '.$year.'</strong></a></p></div>';
   echo '<div id="sub'.$i.'" style="display: none;">';

   $query1 "SELECT * FROM ".db('prefix')."articles WHERE position IN (1,3) AND published = 1 AND date LIKE '$year_month%' ORDER BY date DESC";
   $result1 mysql_query($query1);

         while (
$r1 mysql_fetch_array($result1)) {
$catSEF $r1['category'] != find_cat_sef($r1['category']) : $home;
$articleSEF retrieve('seftitle''articles''id'$r1['id']);
# NEW STRING: shows cat / subcat titles. Replaces string below it.
$cat_name $r1['category'] == $home catname_rel($r1['category'], 'name');
  // $cat_name = $r1['category'] != 0 ? retrieve('name', 'categories', 'seftitle', $catSEF) : $home_name;
$categorySEF $r1['category'] == $home cat_rel($r1['category'], 'seftitle');
# article & page title links
echo '<div class="icon_indent"><a href="'.db('website').$categorySEF.'/'.$articleSEF.'/" title="'.$r1['title'].'">'.$r1['title'].'</a> ('.$cat_name.')</div>';
$last $year.$month;
}
echo '</div>';
$i++;
}
}

?>


Step Two:
Assuming you already have the Subcategories Mods added in... search your engine file for - function cat_rel($var, $column) which is the first line of a function that is part of the Subcategories Mods. This cat_rel function is used in the archives function (and others) to generate the category SEF and subcategory SEF links together as one (within the article title links).

This function can be used to generate the Category & SubCategory Titles as well... but there is no space between them and the slash the separates them, making them a little difficult to read. We cannot add any space in this function (where the slash is generated) because that would cause SEF link errors... so to get the space... we clone (copy) the function... paste it below it... and change its name... and put the spaces in so they only work with the NEW string we placed in the archives function. In this case... we've called the "new" function - catname_rel so we know it generates category & subcategory names that are related to the article title.

Code: [Select]
<?php

// CAT/SUBCAT TITLE GENERATOR (keyrocks July 16.08)
// Subcategory Add - new function to build parent/child titles. Gets parent/child from an id
function catname_rel($var$column) {
$categoryid $var;
$join_result mysql_query("SELECT parent.$column
FROM "
.db('prefix')."categories as child
INNER JOIN "
.db('prefix')."categories as parent
ON parent.id = child.subcat
WHERE child.id = 
$categoryid");
while($j mysql_fetch_array($join_result)) {
$parent $j[$column].' / ';
}
$subresult mysql_query("SELECT * FROM ".db('prefix')."categories WHERE id = '".$categoryid."'");
while ($c mysql_fetch_array($subresult)) {
$child $c[$column];
}
return $parent.$child;
}

?>


And that's it. Your Article Titles in the Archive Page will now have both the Category and SubCategory titles displayed when articles are located in a SubCategory.  :)
« Last Edit: October 08, 2010, 10:14:31 pm by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

poosk

  • Newbie
  • *
  • Karma: 0
  • Posts: 9
Re: [PACKAGE] Subcategories
« Reply #89 on: August 11, 2008, 12:42:23 pm »

Is this kind of structure possible with this mod?

   --   top level 1 menu --
side level 2 menucontent
------------- footer --------------

Basically I'd need top menu (home, products, contact etc) and fex product page would have level 2 type of navigation for different products...
Logged
Pages: 1 ... 4 5 [6] 7 8