Translations of this page:

News Tag Cloud

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 = "<span><a href=". $url .">". $tag_name ."</a>&nbsp;|</span>\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
<!--@head@
<style type="text/css">
.infobox_newscloud {
	background-color:#ffffcc;
	margin-top:5px;
	border:1px solid #DEE1E6;
	padding: 1px;
}
 
.infobox_newscloud_title {
	color:#fff;
	display:block;
	font-family:Arial;
	font-size:11px;
	font-weight:bold;
	padding:5px 0 5px 5px;
	text-transform:uppercase;
	background-attachment: scroll;
	background-color: #ff9933;
	background-image: url(/interface_{custom)/img/orange_title_bg.gif);
	background-repeat: repeat-x;
	background-position: center bottom;
}
 
.newscloud_content {
	line-height:150%;
	font-size:12px;
	font-family:Arial;
	padding:10px;
}
 
.newscloud_footer {
	text-align:right;
	padding:3px 5px 3px 0;
	font-size:11px;
	border-top:1px solid #ccc;
}
</style>
-->
 
<div class="infobox_newscloud">
    <div class="infobox_newscloud_title">News Tag Cloud</div>
    <div class="newscloud_content" name="newstagcloud" datasrc="">
    	<txt name="link"></txt>
    </div>
    <div class="newscloud_footer">
    	<a href="/intranet/main/all_articles.php?tag=">Clear Filter</a>
    </div> 
</div>

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:

<component class="NewsTagCloud">

Suggested location:

/interface_{custom}/main/all_articles.html  

or

/interface_{custom}/main/right_column.html  
 
components/news_tag_cloud.txt · Last modified: 07/06/2011 10:49 by cmoores
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki