====== News Tag Cloud ======
{{components:news_tag_cloud.png|}}
This component generates a list of News Tags into a styled infobox (see screen print above). When clicking any of the links, the news is filtered by that tag. The component generates the tag links into a Claromentis datasrc and is called from the usual component element. There is also a link in the footer of the container to clear the search filter.
1. Create file called:
NewsTagCloud.php
/*
Class to create News Tag Cloud
Created by CM - craig.moores@babcock.co.uk
*/
class NewsTagCloud extends TemplaterComponentTmpl
{
public function Show($attributes)
{
global $db;
$template = "common/news_tag_cloud.html";
$res = $db->query("SELECT metadata_id, meta_text FROM erms_metadata_field_values WHERE metadata_id=6");
while($row = $res->fetchArray())
{
$tag_name = $row['meta_text'];
$edited = urlencode($tag_name);
$url = "/intranet/main/all_articles.php?tag=". $edited ."";
$values = "". $tag_name ." |\n";
$args['newstagcloud.datasrc'][] = array('link.body_html' => $values);
}
return $this->CallTemplater($template, $args);
}
}
2. Copy this file into:
/intranet/common/classes/
3. Create file called:
news_tag_cloud.html
4. Copy this into:
/interface_{custom}/common/
5. Upload the file "orange_title_bg.gif" to:
/interface_{custom}/img/
***Remember to modify the entry in the html page above to link to your title background image.***
background-image: url(/interface_{custom)/img/orange_title_bg.gif);
6. Paste the following component code anywhere on a templater file:
Suggested location:
/interface_{custom}/main/all_articles.html
or
/interface_{custom}/main/right_column.html