• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Taggly, a tag-cloud library

#11
[eluser]llbbl[/eluser]
Thanks again...!

#12
[eluser]Gavin Vickery[/eluser]
Welcome Big Grin

#13
[eluser]CI Lee[/eluser]
I will send you the link once I have it implemented...

Looks good!


-Lee

#14
[eluser]Majd Taby[/eluser]
Nice Gavin, this looks like something I could implement with JTaby for tags, thanks

p.s. nice blog Smile

#15
[eluser]CI Lee[/eluser]
JTaby? Whats that?

:p


-Lee

#16
[eluser]Gavin Vickery[/eluser]
Thanks Zaatar Smile If you do implement with JTaby, I'd be curious to see it.

Also, I thought of a possible 'upgrade' to Taggly last night. After looking through other sites using the tag-cloud concept, I noticed several use CSS styles to define the size and color instead of embedding it right in the tag.

So:
Code:
<a href="http://..." style="font-size: 12px">Example</a>
Becomes:
Code:
<a href="http://..." class="small_font">Example</a>

This way you can define an array of styles to be used instead of font-sizes allowing you to not only apply font sizes, but other CSS styles too (color, text-decoration, background etc.).

Code:
.small_font {font-size: 12px; color: red;}
.medium_font {font-size: 20px; color: blue;}
.large_font {font-size: 30px; color: green; font-weight: bold;}

The logic would be a bit tricky, because you should be able to define any amount of styles to be used and still just pass an array of tags (I love expandability).

Does that make sense? What do you guys/gals think? Is this something wroth implementing?

#17
[eluser]Majd Taby[/eluser]
It's a neat concept, but it would mean that a person who wants to use taggly would need to implement/maintain two files instead of one. just my 2cents

#18
[eluser]Gavin Vickery[/eluser]
Well yes and no. They would only need to maintain two files if they wanted to use that functionality. Taggly's original core would still be there. You could just call a different function to use the CSS styles.

Example:
Code:
$this->taggly->styled_cloud($dataArray, $stylesArray);

Or better yet, just except a 3rd parameter in the Orignal funcion
Code:
$this->taggly->cloud($dataArray, $configArray, $stylesArray);

Besides, most websites have styles sheets now and days, so they are already maintaining a stylesheet as is.

#19
[eluser]murphy2006[/eluser]
Hello,

I am having a bit of a problem with Taggly.
If I use a static array like below it works perfectly fine.

Code:
$tagsArray = array (
    array(10, 'Dog', 'http://dogs.com'),
    array(53, 'Cat', 'http://cats.com')
);

echo $this->taggly->cloud($tagsArray);

If I use the below code instead all tags are printed, BUT they
are all in the same size (11px) even though that the count is different.
I am not sure how to "fill" an array from the data base but this is what I have tried.

In the controller:

Code:
$this->load->library('taggly');
$this->db->select('*');
$this->db->from('blogs_tags');
$data['tags'] = $this->db->get();

In the view file:

Code:
&lt;?php foreach($tags->result() as $tags): ?&gt;
&lt;?php $tagsArray = array (array($tags->count, $tags->name, 'http://dogs.com')); ?&gt;
&lt;?php echo $this->taggly->cloud($tagsArray); ?&gt;
&lt;?php endforeach; ?&gt;

Please help

Kind Regards,
Daniel

#20
[eluser]Gavin Vickery[/eluser]
Hey Daniel,

The problem is within your foreach statement. You are looping through each tag individually, and outputting the tag cloud each time. Because you are only ever passing one value, the size is always the lowest setting (11px).

What you need to be doing is creating the array before you call the Taggly cloud method.

Here is an example
Code:
&lt;?php
// First build the 2D array
foreach($tags->result() as $tags):
    $tagsArray[] = array($tags->count, $tags->name, 'http://dogs.com')); ?&gt;
endforeach;

// Output Taggly Cloud
echo $this->taggly->cloud($tagsArray);
?&gt;

Also, depending on the structure of your query array, you could just do this:

Code:
&lt;?=$this->taggly->cloud($tags->result_array())?&gt;

Keeping in mind that the array returned from your SQL statement would have to be COUNT - NAME - URL for the above shortcut to work.

Hope that helps. Wink


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.