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: 853
  • 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]

Blocks speak! Do you have an interest in getting more blocks - or even making your own? The Blocks Board is for you!

Author Topic: Calling specific category with articles  (Read 5816 times)

0 Members and 1 Guest are viewing this topic.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Calling specific category with articles
« on: September 20, 2011, 03:42:03 PM »
Hey yall ;)

You know the front page serves all articles from several categories when a post is added to articles.

Well, what im trying to do is, call the articles from a specific category to use in a custom php page.

My problem is i dont know how to call the category to display these articles.

I have this so far which im assuming im missing the 'call' component.

Code: [Select]
function template_articles()
{
global $context;

if ($context['SPortal']['core_compat'])
template_articles_curve();
}

function template_articles_curve()
{
global $context, $txt, $modSettings;

if (empty($modSettings['articleactive']))
return;

while ($article = $context['get_articles']())
{
echo '

<div class="windowbg">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">';

if (!empty($modSettings['articleavatar']) && $article['poster']['avatar']['name'] !== null && !empty($article['poster']['avatar']['href']))
echo '
<img src="', $article['poster']['avatar']['href'], '" alt="', $article['poster']['name'], '" width="30" class="sp_float_right" />
<div class="middletext">', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '</div>';
else
echo '
<div class="middletext">', $article['message']['time'], ' ', 'Written by', ' ', $article['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '</div>';

echo '
<div class="post"><hr />', !empty($article['category']['picture']['href']) ? '<div><img src="' . $article['category']['picture']['href'] . '" alt="' . $article['category']['name'] . '" class="sp_article_image sp_float_right" /></div>' : '', $article['message']['body'], '</div>
<div class="sp_right">', $article['article']['link'], ' ',  $article['article']['new_comment'], '</div>
</div>
<span class="botslice"><span></span></span>
</div>
<br />';
}

if (!empty($modSettings['articleperpage']) && !empty($context['page_index']))
echo '
<div class="sp_page_index">', $txt['sp-articlesPages'], ': ', $context['page_index'], '</div>';
}



Thanx for reading, Mick.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Calling specific category with articles
« Reply #1 on: September 24, 2011, 02:38:11 PM »
Would be cool if anyone can figure this one out  :)

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Calling specific category with articles
« Reply #2 on: September 24, 2011, 02:41:25 PM »
Have you tried the Board News block? You should be able to choose multiple boards to display topics from. I can help you embedding such a block in a page.
And slowly, you come to realize... It's all as it should be...

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Calling specific category with articles
« Reply #3 on: September 24, 2011, 05:12:22 PM »
OMG yes! Exactly, but,..... i'd like to use the actual code as is not showing it in admin.

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Calling specific category with articles
« Reply #4 on: September 24, 2011, 05:17:12 PM »
You know what? I figured out.  I created a page, then used the board news in those pages. Excellent.

Thanx brother. ;)

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Calling specific category with articles
« Reply #5 on: September 25, 2011, 07:44:44 AM »
As a note, you can use the SP blocks in a PHP page too. See this topic and post:

http://simpleportal.net/index.php?topic=5332.0
http://simpleportal.net/index.php?topic=5332.msg37841#msg37841
And slowly, you come to realize... It's all as it should be...

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Calling specific category with articles
« Reply #6 on: September 25, 2011, 10:53:17 AM »
This is great Sinan.

I didnt know all this was possible.  Check out my menu in my website. Now my SMF has a blog feel. I removed linktrees, jump to's, etc.

http://www.bluedevilcustoms.com/community/index.php

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Calling specific category with articles
« Reply #7 on: September 26, 2011, 03:14:54 PM »
You are using SimplePortal there? the copyright notice "fell off". That should be fixed in the next version of SimplePortal. That looks good. The youtube doesn't work for me, though.

For a more complicated solution, you can try a custom articles block: http://simpleportal.net/index.php?topic=4734.msg28884#msg28884 (in SMF 1.1.x and SMF 2 flavors, limited to 1 article category at a time, but still useful on sites with multiple "sub-portals" and one main portal that can select articles from all the different boards.

So -- does that mean the Chevy Avalanche site is looking at another move back to SimplePortal, too?
You must be awfully good at exporting and importing your custom php blocks code by now!
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 Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Calling specific category with articles
« Reply #8 on: September 26, 2011, 10:19:17 PM »
You are using SimplePortal there? the copyright notice "fell off". That should be fixed in the next version of SimplePortal. That looks good. The youtube doesn't work for me, though.

For a more complicated solution, you can try a custom articles block: http://simpleportal.net/index.php?topic=4734.msg28884#msg28884 (in SMF 1.1.x and SMF 2 flavors, limited to 1 article category at a time, but still useful on sites with multiple "sub-portals" and one main portal that can select articles from all the different boards.

So -- does that mean the Chevy Avalanche site is looking at another move back to SimplePortal, too?
You must be awfully good at exporting and importing your custom php blocks code by now!
I found the solution not knowing how kickass SP works.  ;)

Yeah the copyright did 'fell off' and i tried to fix it in subs with no luck. Oh well, i can wait.

Oh my chevy site will stay using TP. But yeah, im good at exporting blocks lol. Copy and paste and save the codes on notepad. lol

Reason it stays with TP is, TP has the 'upper' and 'lower' blocks across the site that SP does not have. In fact i have studied SP structure that im thinking on making and 'add-on' for SP so it has these 2 blocks.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Calling specific category with articles
« Reply #9 on: September 27, 2011, 01:57:39 AM »
Those sides are already added to SP with 2.3.4 version of which we are at the alpha testing stage now.
And slowly, you come to realize... It's all as it should be...

Offline Mick.

  • Comrade
  • *
  • Posts: 77
  • Gender: Male
  • Premium SMF Themes
    • idesignSMF
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Calling specific category with articles
« Reply #10 on: September 27, 2011, 07:14:20 AM »
Awesome. I always thought SP needed them. ;)