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.

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

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

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: [PACKAGE] Subcategories
« Reply #90 on: August 11, 2008, 04:06:45 pm »

Is this kind of structure possible with this mod?

          <table><tr><td>   --   top level 1 menu -- </td></tr>
          <tr><td>  side level 2 menu</td><td>content</td></tr>
          <tr><td> ------------- footer -------------- </td></tr>
          </table>

Basically I'd need top menu (home, products, contact etc) and fex product page would have level 2 type of navigation for different products...

The answer is Yes. But... we use CSS only... no table-and-cell structure as you have indicated. It will be up to you to adapt this for your own template.

Let's say you have your top-level menu displaying the categories and Products is one of your categories... and you have several articles posted (assigned to) that Products category. And, when you click on Products... from the top-level menu, you would get the main articles page for that category.

If you want to have all of the article links for any given category (or sub-category) automatically displayed on all article pages within that category (or sub-category) ... then you would need to use a function that will automatically generate those links in a horizontal format (it can also be done in a vertical format within a side-bar if you want).

This function, based on one originally authored by Joost (for a default category-only sNews install) has been modified to do this in an sNews project that has the Subcategories mods in it. To use it, you would copy this function into your snews.php file... under the subcategories function (excluding the php tags):

Code: [Select]
<?php

// HORIZONTAL ARTICLE MENU - in current Category/SubCategory (Joost, keys, equilni)
function harticles_menu_incat() {
   
$categorySEF get_id('category');
   
$subcatSEF get_id('subcategory');
   
$exist check_category($categorySEF);
   if (!empty(
$subcatSEF)){  $categorySEF $subcatSEF; }
   if (!empty(
$categorySEF) && $exist == false) {
echo"\n\t".'<ul id="this_category">';
$cat retrieve('id','categories','seftitle',$categorySEF);
$query "SELECT * FROM ".db('prefix')."articles WHERE category = $cat AND position = 1 AND published = 1 ORDER BY artorder ASC";
$result mysql_query($query);
while ($r mysql_fetch_array($result)) {
    $pageSEF get_id('article');
    $catSEF cat_rel($cat,'seftitle');
    if ($pageSEF == $r['seftitle']){
echo '<li class="horiz_cat_menu"><span id="artikel">|&nbsp;&nbsp;'.$r['title'].'&nbsp;&nbsp;</span></li>';
    } else {
echo'<li class="horiz_cat_menu"><a href="'.db('website').$catSEF.'/'.$r['seftitle'].'/" >|&nbsp;&nbsp;'.$r['title'].'</a>&nbsp;&nbsp;</li>';
    }
        }
echo'</ul>'."\n";
   }
}

?>


Then you would paste this little bit into your style.css file to make the links display horizontally:
          .horiz_cat_menu { display: inline; }

Then... wherever you want the new function to display its menu in your template (index.php file)... you would paste this into place to call the function:
          <?php harticles_menu_incat(); ?>

« Last Edit: August 11, 2008, 04:13:22 pm by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

antvoi

  • Newbie
  • *
  • Karma: 0
  • Posts: 2
Re: [PACKAGE] Subcategories
« Reply #91 on: September 03, 2008, 03:21:01 pm »

i am a newbie in Snews. could you please explain how to add sub categories to Snews Multiple Languages?

Thank you!  ;D
Logged

nuno

  • Jr. Member
  • **
  • Karma: 1
  • Posts: 52
Re: [PACKAGE] Subcategories
« Reply #92 on: September 10, 2008, 01:00:01 pm »

Sorry if this is a sill question... could someone point me in the direction of the latest package for this?

Many thanks
Logged

bobcat

  • Jr. Member
  • **
  • Karma: 1
  • Posts: 67
    • ESL Jobs by Country
Re: [PACKAGE] Subcategories
« Reply #93 on: October 08, 2008, 03:48:03 am »

Really need this mod. Does any one have the package for download, the thread says it is unavailable at the moment.

Thanks.

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: [PACKAGE] Subcategories
« Reply #94 on: October 08, 2008, 04:07:04 am »

Really need this mod. Does any one have the package for download, the thread says it is unavailable at the moment.
Thanks.

I posted this link somewhere else on these forums around Sept.27.08 to a complete snews 1.6 Subcats Zip Package for someone else who asked the same question. It is a development package as I had it working at the end of December, 2007. It works fine but it doesn't have all the 1.6 Patches that were posted from January 2008 on.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

bobcat

  • Jr. Member
  • **
  • Karma: 1
  • Posts: 67
    • ESL Jobs by Country
Re: [PACKAGE] Subcategories
« Reply #95 on: October 08, 2008, 06:18:02 am »

I had searched but couldn't find. Anyway thanks keyrocks for the link, i will give it a try.

bobcat

  • Jr. Member
  • **
  • Karma: 1
  • Posts: 67
    • ESL Jobs by Country
Re: [PACKAGE] Subcategories
« Reply #96 on: October 08, 2008, 06:52:16 am »

Is this available as a mod instead of a package?

I have a heavily modded snews which i can't just exchange with another .

Is there anywhere to get a list of the changes that need to be made to implement subcategories.

I have searched the forums now for 2 days but can't find anything complete/finished in this form.

Thanks.

Joost

  • Guest
Re: [PACKAGE] Subcategories
« Reply #97 on: October 08, 2008, 07:05:41 am »

Virtually every function is affected by this modification.
Logged

bobcat

  • Jr. Member
  • **
  • Karma: 1
  • Posts: 67
    • ESL Jobs by Country
Re: [PACKAGE] Subcategories
« Reply #98 on: October 08, 2008, 07:17:26 am »

Virtually every function is affected by this modification.

OK, thanks. Then i guess it will be easier to have 2 installations of snews to be able have a news section and an articles section? (like below)

home - articles > categories
   |
news > articles

Joost

  • Guest
Re: [PACKAGE] Subcategories
« Reply #99 on: October 08, 2008, 07:27:47 am »

Yes, in fact I am in favour of that approach
I've written something about that here

Logged

bobcat

  • Jr. Member
  • **
  • Karma: 1
  • Posts: 67
    • ESL Jobs by Country
Re: [PACKAGE] Subcategories
« Reply #100 on: October 08, 2008, 07:39:15 am »

Yes, in fact I am in favour of that approach
I've written something about that here



Thanks Joost. I will go check that out :)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: [PACKAGE] Subcategories
« Reply #101 on: October 08, 2008, 02:57:50 pm »

Is this available as a mod instead of a package?
Is there anywhere to get a list of the changes that need to be made to implement subcategories.

@ Bobcat... (and anyone else looking for adventure...)
If you download the package I linked to above yesterday... and open the snews.php file that comes with it (in your good code editor)... and search for - Subcategory Add... you will find every change occurence in the file related to this Mod. I purposely left a lot of comments in the file so that anyone could find all their locations and transfer them to another snews.php file.

One very good way to find the differences in one file compared to another is to open both in WinMerge... and you can copy sections from one side (file) to the other as you identify all of the different (highlighted) sections.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

bobcat

  • Jr. Member
  • **
  • Karma: 1
  • Posts: 67
    • ESL Jobs by Country
Re: [PACKAGE] Subcategories
« Reply #102 on: October 08, 2008, 03:20:05 pm »

Thanks keyrocks, never thought of that. Also thanks for the link to winmerge, sounds like it could be quite useful.  :)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: [PACKAGE] Subcategories
« Reply #103 on: October 08, 2010, 10:39:13 pm »

It's been a long time since the last activity on this thread.
But I'm trying to do something that might not be possible with the 1.6 Category-Subcategory function-set and would appreciate some help.

The function-set I am working with displays text-links to both articles and pages under expandable Category and Sub-Category titles.
I am doing a variation of it to display only links to the latest articles or pages... as a vertical side-bar menu.

So, in this case, function categories() is now function latest_content_menu($start, $size) ... and the subcategories function is now function subcontent_menu($parent,$submenu).

I am using the $start and $size parameters (used in 1.6's // MENU ARTICLES to limit what is fetched from the articles table.... and the function-tag uses the same parameters... like - latest_content_menu(0,3);
This works fine for article and page title links listed under expandable Category titles.

Problem is... I cannot seem to get these parameters to apply to article and page title links under the Sub-categories.

I'm kinda hoping Jason drops by and picks up on this one as he knows these functions inside and out.  8)
« Last Edit: October 08, 2010, 10:42:11 pm by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

nukpana

  • Hero Member
  • *****
  • Karma: 71
  • Posts: 663
Re: [PACKAGE] Subcategories
« Reply #104 on: October 09, 2010, 01:20:27 am »

Hey Doug, how are you?

I assume you are referring to the $start & $size parameters to the subcategory function...
if so...
You need to pass the $start, $size to the subcontent_menu() function like so:
subcontent_menu($parent, $submenu, $start, $size)

So within latest_content_menu(0,3) it will call (as an example):
subcontent_menu($r['id'], $menutype, 0, 3)
Logged
Pages: 1 ... 5 6 [7] 8