collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 272
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Limit Article Block to a specific Category  (Read 6533 times)

0 Members and 1 Guest are viewing this topic.

Offline russ skinner

  • Semi Newbie
  • *
  • Posts: 22
  • Gender: Male
    • Slough RC Model Club
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Limit Article Block to a specific Category
« on: January 02, 2010, 06:01:11 AM »
Hi all,

Just wondered if there is anywhere the article block can me modified to only show articles from a specific article category.

I have a number of user guides within the forum I look after and would like to add them to an article block on the front page and not have them over written by articles published at a later date - a sticky article block if you like. The easiest way I can see of achieving of this would be to place these articles in a specific category - 'User Guides' and only have the article block look at this category.

I have tried using a custom HTML naviagtion  block to achieve this, but the HTML links get corrupted with PHPSESSID code when viewed by guests - see post here.


Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Limit Article Block to a specific Category
« Reply #1 on: January 02, 2010, 05:28:35 PM »
This should be easy, when you public an article you can choose which category that article belongs to. Then you can setup the categories in the admin area so that the other categories don't get shown on the portal (which makes them fairly pointless for the moment - SP 2.3.1 will have other ways of publishing categories).
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline russ skinner

  • Semi Newbie
  • *
  • Posts: 22
  • Gender: Male
    • Slough RC Model Club
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Limit Article Block to a specific Category
« Reply #2 on: January 03, 2010, 05:27:29 AM »
Thanks Nathaniel, I can see this works.

Not sure what's in the pipeline for SP 2.3.1 and do not know how difficult this would be, but it would be nice to be able to select a category for an article block or some flexibility that can achieve this.   

Offline BPLive

  • Semi Newbie
  • *
  • Posts: 7
  • SMF Version: None
  • SP Version: None
Re: Limit Article Block to a specific Category
« Reply #3 on: January 25, 2010, 04:02:29 AM »
Thanks Nathaniel, I can see this works.

Not sure what's in the pipeline for SP 2.3.1 and do not know how difficult this would be, but it would be nice to be able to select a category for an article block or some flexibility that can achieve this.

I concur...  my main issue right now is that all Article catagory's are posted to the same place on the portal index. CaT blocks for articles are much needed so we can make sections etc.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Limit Article Block to a specific Category
« Reply #4 on: January 29, 2010, 12:15:01 PM »
This will let you filter the articles by category for articles block.

Sources/PortalBlocks.php

Code: (Find) [Select]
$block_parameters = array(
'limit' => 'int',
'type' => 'select',
'image' => 'select',
);

if ($return_parameters)
return $block_parameters;

Code: (Replace) [Select]
$block_parameters = array(
'limit' => 'int',
'type' => 'select',
'image' => 'select',
'category' => array(0 => 'All'),
);

if ($return_parameters)
{
global $sourcedir;

require_once($sourcedir . '/Subs-PortalAdmin.php');

$categories = getCategoryInfo();

foreach ($categories as $category)
$block_parameters['category'][$category['id']] = $category['name'];

$txt['sp_param_sp_articles_category'] = 'Category';

return $block_parameters;
}

$category = empty($parameters['category']) ? 0 : (int) $parameters['category'];

Code: (Find) [Select]
AND a.approved = {int:approved}
Code: (Replace) [Select]
AND a.approved = {int:approved}' . (!empty($category) ? '
AND a.id_category = ' . $category : '') . '

While editigin Articles type blocks, you'll notice a new option "Category:" where you can select the category.
And slowly, you come to realize... It's all as it should be...

Offline russ skinner

  • Semi Newbie
  • *
  • Posts: 22
  • Gender: Male
    • Slough RC Model Club
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Limit Article Block to a specific Category
« Reply #5 on: February 25, 2010, 10:16:05 AM »
Many thanks SiNaN, have just incorporated this feature and it works really well - exactly the flexibility I was looking for  ;D.

Hope you consider including this option in the next portal release. 

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Limit Article Block to a specific Category
« Reply #6 on: February 25, 2010, 11:26:37 AM »
Oooh! I like this! 
 
This is much better than the solution I came up while I was trying to figure out "sub-portal" pages (http://simpleportal.net/index.php?topic=4654).
This is so much better than hand-crafting custom pages using grabmessage.
 
After I test your code, I think I will be back here for advice on how to put message text into the article block, so I can put the article block on a SimplePortal page and display the articles from that category.
 
Thanks [SiNaN], and thanks russ for thinking of the idea.
 
Putting these two ideas together really almost makes SimplePortal a CMS, because I will be able to put custom article categories on custom pages.
 
After that, I'll just throw in a custom navigation bar, and I'll be all set.  I'll let you know how I make out.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Limit Article Block to a specific Category
« Reply #7 on: February 25, 2010, 04:06:49 PM »
This works perfectly!
So now, of course I want to change it.
 
I think it would be best if I took a copy of this slightly-modified block and created a new block
 
function sp_articles_withbody

I have been searching blindly through SimplePortal files, without any luck.
Can a kind soul tell me:
  • Where I can find the list of blocks that go in the "choose a block" list, so I can see how to add one there?
  • Where I can find the code that writes the articles to the portal page, when articles on the portal page is turned on?
  • Where I can find the code that interprets the block_parameters, so I can understand the whys and wherefores of adding block_parameters?
Thanks!
 
----------------
I have found out that I don't want to mess with adding new test blocks to the database right now (http://simpleportal.net/index.php?topic=4301.0), so I've scratched that question.
And I think I figured out the block_parameters just from looking at the language files, so I've scratched that question.
And I found template_articles in PortalArticles.template
 
So I'm good!
My next step is to pull some of template_articles into
sp_articles.  Just for fun.
« Last Edit: February 28, 2010, 09:08:48 PM by AngelinaBelle »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?