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] 2

Author Topic: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)  (Read 3511 times)

Rui Mendes

  • Development,Testing, Support
  • sNews Dude
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1039
  • sNews1.7
    • Comunidade Portuguesa

I made this mod first time for snews 1.6, now it's time to make it for snews 1.7.
I must say thank you HAC for porting for snews 1.7, but I review the code and make some new improvements.

Version 2.0
Easy to integrate, open my files and find the word MAreas
Files I changed:
- index.php
- snews.php
- EN.php
- snews.sql

Here some images



And you can download here the official_package 1.7 with Multiple Areas 2.0

How to use in your index.php:
Quote
<?php categories(1, true, false, 0, 4, 0, 3); ?>

this instruction will show Area1 and show home(true), won't show on sitemap and will show only 4 categories (postition 0, size=4) and 3 sub-categories (position=0 and size=3)

Package updated
« Last Edit: May 20, 2011, 07:41:32 PM by Rui Mendes »
Logged
Need a Job on Europe. Linkdin - Facebook / Group

sibas

  • Hero Member
  • *****
  • Karma: 24
  • Posts: 525
    • simply4all.net
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #1 on: May 19, 2011, 07:12:50 PM »

Hello Rui!

I tried your Multiple Areas 2.0, but i cant make/generate any categories or subcategories..
Logged

Rui Mendes

  • Development,Testing, Support
  • sNews Dude
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1039
  • sNews1.7
    • Comunidade Portuguesa
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #2 on: May 19, 2011, 08:03:36 PM »

You're right.
I duplicate one extra field (,'$subcat')
on line 2870 the mysql correct is
Code: [Select]
mysql_query("INSERT INTO "._PRE.'categories'."
(name, seftitle, description, published, catorder, subcat, catnumber, showcount, showsitemap)
VALUES('$name', '$seftitle', '$description', '$publish_category', '$catorder','$subcat', '$subcat','$catnumber', '$showcount', '$showsitemap')");

Package updated
« Last Edit: May 19, 2011, 08:05:35 PM by Rui Mendes »
Logged
Need a Job on Europe. Linkdin - Facebook / Group

sibas

  • Hero Member
  • *****
  • Karma: 24
  • Posts: 525
    • simply4all.net
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #3 on: May 20, 2011, 04:21:49 PM »

Thank you Rui!!
Seems like working very nice!!!
Still in your package you have duplicate $subcat on line 2870
At beginning i don't have realize that you have define max_areas, but everything OK now   ;D
karma to you!!!!!!!!!!!
One more question, how to make display all the subcategories before I click to any category?

Rui I don't test it properly
by adding
Code: [Select]
<?php categories(2falsefalse02); ?>show the main category but not display subcategories, also  when I go to specific category display all subcategories i make 4 for testing
« Last Edit: May 20, 2011, 04:57:38 PM by sibas »
Logged

Rui Mendes

  • Development,Testing, Support
  • sNews Dude
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1039
  • sNews1.7
    • Comunidade Portuguesa
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #4 on: May 20, 2011, 04:58:27 PM »

As a default (snews1.7.1) sub-categories are hidden until you click to open one category

If you want show every sub-categories just find this line 366
Code: [Select]
if ($category_title == $categorySEF) { subcategories($parent); }
and change to
Quote
subcategories($parent);

Thank you for try, I don't what happen I update the file to the server, but he didn't update
« Last Edit: May 20, 2011, 05:01:25 PM by Rui Mendes »
Logged
Need a Job on Europe. Linkdin - Facebook / Group

sibas

  • Hero Member
  • *****
  • Karma: 24
  • Posts: 525
    • simply4all.net
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #5 on: May 20, 2011, 05:03:50 PM »

Thanks that did the trick
Code: [Select]
subcategories($parent);
but how i said above showing all the subcategories if i use
Code: [Select]
<?php categories(2falsefalse02); ?>
Logged

Rui Mendes

  • Development,Testing, Support
  • sNews Dude
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1039
  • sNews1.7
    • Comunidade Portuguesa
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #6 on: May 20, 2011, 05:07:54 PM »

It don't show you correctly?

For me is working perfect
Logged
Need a Job on Europe. Linkdin - Facebook / Group

sibas

  • Hero Member
  • *****
  • Karma: 24
  • Posts: 525
    • simply4all.net
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #7 on: May 20, 2011, 05:33:34 PM »

OK here what i have done



try to display like this
Code: [Select]
<h3>New Category Area</h3>
<ul>
<?php categories(0truefalse02); ?>
<?php categories(1truefalse02); ?>
<?php categories(2falsefalse02); ?>
<?php categories(3falsefalse04); ?>
<?php categories(4falsefalse04); ?>
<?php categories(5falsefalse04); ?>
</ul>

As you see display in Area1 all the subcategories
If I use
Code: [Select]
<?php categories(1truefalse12); ?>
says [No categories at the moment]


Logged

Rui Mendes

  • Development,Testing, Support
  • sNews Dude
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1039
  • sNews1.7
    • Comunidade Portuguesa
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #8 on: May 20, 2011, 06:04:20 PM »

On index.php for Area0 I use
Quote
<h3>Categories</h3>
<ul>
<?php categories(); ?>
</ul>

In other new place I use (not Area0)
Quote
<h3>New Category Area</h3>
<ul>
<?php categories(1, true, false, 0, 2); ?>
<?php categories(2, false, false, 0, 2); ?>
<?php categories(3, false, false, 0, 4); ?>
<?php categories(4, false, false, 0, 4); ?>
<?php categories(5, false, false, 0, 4); ?>
</ul>

And I got this image


If says  [No categories at the moment] means are empty
don't add
Quote
<?php categories(5, false, false, 0, 4); ?>
or just decrease one number on max_areas
« Last Edit: May 20, 2011, 06:08:36 PM by Rui Mendes »
Logged
Need a Job on Europe. Linkdin - Facebook / Group

Rui Mendes

  • Development,Testing, Support
  • sNews Dude
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1039
  • sNews1.7
    • Comunidade Portuguesa
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #9 on: May 20, 2011, 06:11:43 PM »

If you use only 2 areas
- Area 0
- Area 1 (new area) with all categories and su-categories

On Categories index.php I use
Quote
<h3>Categories</h3>
<ul>
<?php categories(); ?>
</ul>

And in other place
Quote
<h3>New Category Area</h3>
<ul>
<?php categories(1, true, false, 0, 2); ?>
</ul>
Logged
Need a Job on Europe. Linkdin - Facebook / Group

sibas

  • Hero Member
  • *****
  • Karma: 24
  • Posts: 525
    • simply4all.net
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #10 on: May 20, 2011, 06:21:45 PM »

I think you misunderstand me
lets say in Area1 i have category Internet and i have 20 subcategories
i want to display only 10 of them,
if i try
Code: [Select]
<?php categories(1truefalse09); ?>display all 20 subcategories and not only the 10
and if i try
Code: [Select]
<?php categories(1truefalse110); ?>display [No categories at the moment]
Logged

Rui Mendes

  • Development,Testing, Support
  • sNews Dude
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1039
  • sNews1.7
    • Comunidade Portuguesa
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #11 on: May 20, 2011, 07:32:13 PM »

Ok I got what you want.

I made some changes
Quote
<?php categories(1, true, false, 0, 4, 0, 2); ?>
- 0, 4 (will show categories on position 0 with size = 4), this means show 4 categories on Area 1
- 0, 2 will show 2 sub-categories (position 0 and size = 2)


on index.php
Quote
<?php categories(1, true, false, 0, 4, 0, 2); ?>
- show Area 1
- Show Home link
- Do not show on sitemap
- Categories position0 and size = 4
- Sub-categories postion = 0 and size = 2

Package updated (add variables on categories and subcategories)
replace both functions
« Last Edit: May 20, 2011, 07:43:50 PM by Rui Mendes »
Logged
Need a Job on Europe. Linkdin - Facebook / Group

sibas

  • Hero Member
  • *****
  • Karma: 24
  • Posts: 525
    • simply4all.net
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #12 on: May 20, 2011, 07:55:39 PM »

YES!!! You are the man dude  ;D
Is working perfect, although the code
Code: [Select]
subcategories($parent, $sub_start, $sub_size);generates the links in subcategories like this
Quote
http ://127.0.0.1/snews-multi-cat//cat1/

karma++
Logged

Rui Mendes

  • Development,Testing, Support
  • sNews Dude
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1039
  • sNews1.7
    • Comunidade Portuguesa
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #13 on: May 20, 2011, 08:04:56 PM »

sNews 1.7.1 has
Quote
if ($category_title == $categorySEF) { subcategories($parent); }

When we change to
Quote
subcategories($parent);


This means won't be able to detect correct link on variable $categorySEF (on function subcategories).

I made new changes, package updated
Logged
Need a Job on Europe. Linkdin - Facebook / Group

sibas

  • Hero Member
  • *****
  • Karma: 24
  • Posts: 525
    • simply4all.net
Re: Multiple Areas for Categories for sNews 1.7 only (Version 2.0)
« Reply #14 on: May 20, 2011, 08:14:45 PM »

Just thank you for this powerful mod, I think is one of most useful modifications for sNews 1.7  ;)
Logged
Pages: [1] 2