Tag cloud in a new window

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-27-2007, 06:58 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,042
I want to "force" my users to use existing tags of the tag cloud as far as itīs justified to get a better linkage between the stories.

Therefore they should be able to work at step 1 and klick on Tag Cloud to see the existing tags in a new window. To make it a little bit easier, I donīt mind if the tag could opens everytime in a new window.

Can you tell me how to modify the code to achieve this?
Reply With Quote
  #2 (permalink)  
Old 05-27-2007, 08:14 AM
not2serious's Avatar
Pligg Donor
Pligg Version: 1.1.5
Pligg Template: Westie
 
Join Date: Apr 2007
Location: East Coast, USA
Posts: 229
Quote:
Originally Posted by tbones View Post
I want to "force" my users to use existing tags of the tag cloud as far as itīs justified to get a better linkage between the stories.
I think this may be a good idea. This would increase the traffic between stories.
Reply With Quote
  #3 (permalink)  
Old 05-30-2007, 04:04 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,042
Iīve tried <a href="{$URL_tagcloud}" target="_blank" >{#PLIGG_Visual_Tags#}</a> in ./templates/yget/header.tpl without any success.
Reply With Quote
  #4 (permalink)  
Old 05-30-2007, 06:04 AM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,181
this would require a bit more changes and i don't have a solution.

When i do, i'll post it here.
Reply With Quote
  #5 (permalink)  
Old 07-15-2007, 06:46 AM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,181
here's a bit of code to get the tag cloud displayed and add it to the tag text box.

You can make this better, but if you do please post the changes you've made to share with everyone.

in submit.php

Find these lines:
PHP Code:
$main_smarty->assign('lastspacer'0);
    
$main_smarty->assign('cat_array'$array); 
and add this below those lines.

PHP Code:
        $cloud=new TagCloud();
    
$cloud->smarty_variable $main_smarty// pass smarty to the function so we can set some variables
    
$cloud->word_limit tags_words_limit_s;
    
$cloud->min_points tags_min_pts_s// the size of the smallest tag
    
$cloud->max_points tags_max_pts_s// the size of the largest tag
    
$cloud->show();
    
$main_smarty $cloud->smarty_variable// get the updated smarty back from the function 
This will create the tag cloud and pass the tag cloud info on to the template engine.

in submit_step_2.tpl

Find these lines.

PHP Code:
<strong>{#PLIGG_Visual_Submit2_Tags_Inst1#}</strong> {#PLIGG_Visual_Submit2_Tags_Example#} <em>{#PLIGG_Visual_Submit2_Tags_Inst2#}</em><br/>
            
<input type="text" id="tags" name="tags" value="{$tags_words}" size="60" maxlength="40" /><br /><br /> 
below that add this.

PHP Code:
            <label>Top Tags:</label>
            <
strong>Click on a tag to add</strong><br/>
            
            {
literal}
            <
script language="javascript" type="text/javascript">
                function 
addTag(tag_string)
                {
                    var 
tagsTextBox document.getElementById('tags');
                    var 
middleBit '';
                    var 
tagsTextBoxValue tagsTextBox.value;
                    var 
tagsTextBoxLength tagsTextBoxValue.length;
                    if(
tagsTextBoxLength == 0)
                    {
                        
middleBit '';
                    }else{
                        
middleBit ', ';
                    }
                    
tagsTextBox.value tagsTextBox.value middleBit tag_string;
                }
            
</script>
            {/literal}
            <div id="tagcloud" style="margin: 5px 0 0 0; line-height: {php} echo tags_max_pts_s; {/php}pt;">
                {section name=customer loop=$tag_number}
                
                    {* --- to change the way the words are displayed, change this part --- *}
                        <span style="font-size: {$tag_size[customer]}pt">
                            <a href="javascript:addTag('{$tag_name[customer]}');">{$tag_name[customer]}</a>
                        </span>
                    {* ---        --- *}
                    
                {/section}
            </div> 
Tag cloud in a new window-tagcloud.png

You can change the look and feel, how the javascript should interact and other changes. Post what changes you've made to share with everyone.
Reply With Quote
  #6 (permalink)  
Old 07-15-2007, 07:33 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,042
I already forgot about that :-)

What an excellent code! All thumbs up for this performance! Thank you very much! This is a must for V1.0.

I´ve added two <br/> at the end of submit_step2.tpl to get a little bit space to the story description.

I´d like to subsitute $tag_number with the Tag cloud word limit variable. What´s its name? Absolute numbers don´t seem to work.

Last edited by tbones; 07-15-2007 at 07:50 AM. Reason: Absolute numbers
Reply With Quote
  #7 (permalink)  
Old 07-15-2007, 11:36 AM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,181
is there a reason why you want to change the $tag_number bit??

$cloud->word_limit // limits how many tags to display.

this is the query in the TagCloud Class

$sql = "select tag_words, count(*) as count $from_where order by count desc limit $this->word_limit";
Reply With Quote
  #8 (permalink)  
Old 07-15-2007, 11:44 AM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,042
Possibly I got something wrong:
My users post to very different topics so it´s less likely that the TOP 8 tags fit. Therefore I´d like to have all tags of the cloud displayed. I know that therefore submit_step2 will become a quite long page but a good linkage between similar stories is more important to me.
Reply With Quote
  #9 (permalink)  
Old 07-15-2007, 03:11 PM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,181
doesn't increasing $cloud->word_limit increase the number of tags??
Reply With Quote
  #10 (permalink)  
Old 07-15-2007, 03:26 PM
Constant Pligger
 
Join Date: Apr 2007
Posts: 1,042
I´ve tried
$cloud->word_limit = tags_words_limit;
in submit.php but I guess the limit for the "big" cloud has a different variable name. It works with an absolute number like 50.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tag Cloud links ppelsmaeker Questions and Comments 0 08-18-2008 06:13 PM
Tags not cloud in Pligg v9.9 bhatiacane Questions and Comments 4 05-03-2008 03:16 AM
How does the Tag cloud works? Niko Questions and Comments 1 03-31-2008 03:47 AM
New window links in out.php only? tones Questions and Comments 1 08-09-2007 07:21 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development