Jump to content

Topic Feed filter by tags


CalvinK

Recommended Posts

Hi there,

Would it be possible please to add an option to the topic feed widget that allows me to display topics that have specific tags attached to them? At present this option is not available and in my opinion it really should be. For a possible use case - the European Championships are coming up and I would like to showcase the threads that have the tag "euro2016" attached to the topic.

Thanks ^_^

Link to comment
Share on other sites

  • 1 year later...

i have solved with a pages php block but is not same thing :(

/* \IPS\Content\_Widget::buildWhere OR find for tag_text OR \IPS\Content\_Controller::getSimilarContent for search along content router */

$class		= 'IPS\forums\Topic';
$where		= [];
$tags		= ['home'];
$container	= ['201','203'];


/* Container */
if ( isset( $class::$containerNodeClass ) )
{
	$where[] = array( \IPS\Db::i()->in( $class::$databaseTable . '.' .  $class::$databasePrefix . $class::$databaseColumnMap['container'], $container ) );
}
/* Tags */
$tagWhere = array();
$binds    = array( $class::$application, $class::$module );
foreach( $tags as $tag )
{
	$tagWhere[] = "( tag_text LIKE CONCAT( ?, '%') )";
	$binds[] = $tag;
}

$where[] = array( $class::$databaseColumnId . ' IN (?)', \IPS\Db::i()->select( 'tag_meta_id', 'core_tags', array( array_merge( array( 'tag_meta_app=? AND tag_meta_area=? AND (' . implode( ' OR ', $tagWhere ) . ')' ), $binds ) ) ) );

$table = new IPS\Helpers\Table\Content( $class, \IPS\Http\Url::external( \IPS\Http\Url::baseUrl().ltrim($_SERVER['PHP_SELF'],'/') ), $where, NULL, \IPS\Content\Hideable::FILTER_AUTOMATIC, 'read', FALSE );
$table->limit = 9;
//..........
print table;

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...