TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 18, 2024, 09:49:37 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 192
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 110
  • Total: 110

ARTICLE CATEGORIE BOX

Started by vincitygialam, October 24, 2018, 12:49:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

vincitygialam

Is there any ready to use box that I can add to a tinyportal panel where I have a list of all existing categories for articles and if I click a categorie I get only the fitting articles?  Like in a blog.

lurkalot

Sorry for delay in replying.

Pretty sure there isn't a block available to do this, but I'll have a check around and see if there's a workaround you could use for this purpose.

@rjen

It should be possible to create that in a php block...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

wildenborch

#3
This can also be done with the menu manager.
Or do I misunderstand your question?
Do you want to show the articles or only the article titles?

@rjen

You can try this code in a PHP block...

It will build a list of all categories, and clicking the category will bring you to the category page, showing all articles in the category.

The category page will show in the layout type as you defined it in the settings for the category...


echo ' <div style="float:left;padding-right: 5px;"><img height="35px" src="Themes/default/images/tinyportal/TPov_categories.png"></img></div><strong>Categories</strong></br>' ;
echo ' <br>' ;
echo ' <hr>' ;

global $scripturl, $smcFunc;

$request = $smcFunc['db_query']('', '
     SELECT id, value1, type
     FROM {db_prefix}tp_variables
     WHERE type = "category"
     ORDER BY value1 ASC'
);
echo '
<ul style="list-style-type:disc; margin: 0pt; padding: 0pt 15px;">
';
while ($row = $smcFunc['db_fetch_assoc']($request))
{
     echo '<li><a href="', $scripturl, '?cat=', $row['id'], '">', $row['value1'], '</a></li>';
}
echo '</ul>';
$smcFunc['db_free_result']($request);
Running Latest TP on SMF2.1 at: www.fjr-club.nl