PDA

View Full Version : Animated Flash Tags Widget , Flash Tag Cloud



PhucSD
08-06-2011, 11:26 AM
Cái hướng dẫn ở dưới là dùng để thêm Tag Cloud Flash vào vBCMS
Còn đây mình sẽ hướng dẫn cách thêm đám mây Tag dạng Flash vào Forum

Bạn vào ACP=> Forum & Moderators =>Forum Blocks Manager => Add Block

Title: Tag Cloud
Description: Bỏ trống hay điền gì cũng đc
Content Type: Chọn PHP
Content: Điền vào code sau

$flashWidth = 240; $flashHeight = 240; $flashPath = 'tagcloud.swf'; $flashBackgroundColor = 'ffffff'; $tagCount = 30; $tagMaxSize = 16; $tagMinSize = 8;
// Colors are in hex $data['tcolor'] = '0x000000'; $data['tcolor2'] = '0x336699'; $data['hicolor'] = '0x000000'; $data['speed'] = 100; $data['distr'] = 'true'; $data['mode'] = 'tags';
$contentTypes = array(2=>'tags.php?tag=',15=>'blog.php?tag=');
/* No Editing Below This Line*/
global $vbulletin;
// %d
$query = sprintf("SELECT Tag.tagid, Tag.tagtext, TagContent.contenttypeid, COUNT( TagContent.tagid ) AS count FROM ".TABLE_PREFIX."tag AS Tag LEFT JOIN ".TABLE_PREFIX."tagcontent AS TagContent ON ( Tag.tagid = TagContent.tagid ) GROUP BY TagContent.tagid ORDER BY count DESC LIMIT %d",$tagCount);
$qtags = vB::$db->query_read($query);
while($tag = vB::$db->fetch_array($qtags)) { $tags[] = $tag; $tagSize[$tag['tagtext']] = $tag['count']; }
// largest and smallest array values $maxQty = max(array_values($tagSize)); $minQty = min(array_values($tagSize));
$spread = $maxQty - $minQty; if ($spread == 0) { $spread = 1; }
$step = ($tagMaxSize - $tagMinSize) / ($spread);
// make the tag cloud $tagsHTML = ""; foreach ($tags as $tag) { $size = round($tagMinSize + (($tag['count'] - $minQty) * $step)); $text = $tag['tagtext'];
$url = $vbulletin->options['homeurl'].'/'.$contentTypes[$tag['contenttypeid']].urlencode($tag['tagtext']); $tagsHTML .= "<a href='$url' style='$size'>$text</a>"; }
$data['tagcloud'] = '<tags>'.$tagsHTML.'</tags>';
$flashVars = "";
foreach($data as $var=>$val) { $flashVars .= (empty ($flashVars))?'':'&amp;'; $flashVars .= "$var=".urlencode($val); }
ob_start(); ?> <embed width="<?php echo $flashWidth;?>" height="<?php echo $flashHeight;?>" flashvars="<?php echo $flashVars;?>" wmode="transparent" allowscriptaccess="always" quality="high" bgcolor="#<?php echo $flashBackgroundColor;?>" name="vbCloudFlash" id="vbCloudFlash" style="" src="<?php echo $vbulletin->options['homeurl'].'/'.$flashPath;?>" type="application/x-shockwave-flash"/> <?php
$content = ob_get_contents(); ob_end_clean();
$output = $content;

Save !

Done!

Live Demo (http://vietgamer.net/)


Flash Tag Cloud

Released 6/3/2010
By Vikas - http://www.ngcoders.com (http://www.ngcoders.com/)
Demo - http://www.roboticsindia.com (http://www.roboticsindia.com/) , Look at left sidebar

Installation

Goto Admincp->vBullietin CMS->Widgets->Create New Widget
Choose PHP Direct Execution as Widget's Type
Place a Title. eg Upcoming Events. Keep it short as this is what will appear as title on your pages.
Click Save
Click Configure on the right of the new created widget.
Remove the default code that appears. Be sure to not leave behind even a single letter.
Copy and Paste the code that you can find below.
Leave the template name as is (vbcms_widget_execphp_page)
Click Save
Goto Admincp->vBullietin CMS->Layout Manager
Click Go on the Default Layout
Add the Widget to your Layout
Click Save
Download the attached tagcloud.zip and extract it.
Upload tagcloud.swf to root directory of your vbulletin install
That's all !!
PHP Code




$flashWidth = 330;
$flashHeight = 330;
$flashPath = 'tagcloud.swf';
$flashBackgroundColor = 'ffffff';
$tagCount = 30;
$tagMaxSize = 16;
$tagMinSize = 8;

// Colors are in hex
$data['tcolor'] = '0x000000';
$data['tcolor2'] = '0x336699';
$data['hicolor'] = '0x000000';
$data['speed'] = 100;
$data['distr'] = 'true';
$data['mode'] = 'tags';

$contentTypes = array(2=>'tags.php?tag=',15=>'blog.php?tag=');

/* No Editing Below This Line*/

global $vbulletin;

// %d

$query = sprintf("SELECT Tag.tagid, Tag.tagtext, TagContent.contenttypeid, COUNT( TagContent.tagid ) AS count FROM ".TABLE_PREFIX."tag AS Tag LEFT JOIN ".TABLE_PREFIX."tagcontent AS TagContent ON ( Tag.tagid = TagContent.tagid ) GROUP BY TagContent.tagid ORDER BY count DESC LIMIT %d",$tagCount);

$qtags = vB::$db->query_read($query);

while($tag = vB::$db->fetch_array($qtags)) {
$tags[] = $tag;
$tagSize[$tag['tagtext']] = $tag['count'];
}

// largest and smallest array values
$maxQty = max(array_values($tagSize));
$minQty = min(array_values($tagSize));

$spread = $maxQty - $minQty;
if ($spread == 0) {
$spread = 1;
}

$step = ($tagMaxSize - $tagMinSize) / ($spread);

// make the tag cloud
$tagsHTML = "";
foreach ($tags as $tag)
{
$size = round($tagMinSize + (($tag['count'] - $minQty) * $step));
$text = $tag['tagtext'];

$url = $vbulletin->options['homeurl'].'/'.$contentTypes[$tag['contenttypeid']].urlencode($tag['tagtext']);
$tagsHTML .= "<a href='$url' style='$size'>$text</a>";
}

$data['tagcloud'] = '<tags>'.$tagsHTML.'</tags>';

$flashVars = "";

foreach($data as $var=>$val)
{
$flashVars .= (empty ($flashVars))?'':'&amp;';
$flashVars .= "$var=".urlencode($val);
}

ob_start();
?>
<embed width="<?php echo $flashWidth;?>" height="<?php echo $flashHeight;?>" flashvars="<?php echo $flashVars;?>" wmode="transparent" allowscriptaccess="always" quality="high" bgcolor="#<?php echo $flashBackgroundColor;?>" name="vbCloudFlash" id="vbCloudFlash" style="" src="<?php echo $vbulletin->options['homeurl'].'/'.$flashPath;?>" type="application/x-shockwave-flash"/>
<?php

$content = ob_get_contents();
ob_end_clean();

$output = $content;
It is based on WP-Cumulus , to change settings please refer to this page -

http://www.roytanck.com/2009/03/11/h...us-shortcodes/
(http://www.roytanck.com/2009/03/11/how-to-use-wp-cumulus-shortcodes/)
(http://www.roytanck.com/2009/03/11/how-to-use-wp-cumulus-shortcodes/)

quocduyze
26-06-2011, 01:52 PM
Làm đi làm kaij nhiều lần mà sao không được nhỉ, bạn nào là cái flashTag xin được hướng dẫn với

hoangduykt7990
26-06-2011, 05:06 PM
Kiểm tra xem đuờng dẫn đã đúng chưa

PhucSD
26-06-2011, 05:25 PM
Cái hướng dẫn trên là dùng để thêm Tag Cloud Flash vào vBCMS
Còn đây mình sẽ hướng dẫn cách thêm đám mây Tag dạng Flash vào Forum

Bạn vào ACP=> Forum & Moderators =>Forum Blocks Manager => Add Block

Title: Tag Cloud
Description: Bỏ trống hay điền gì cũng đc
Content Type: Chọn PHP
Content: Điền vào code sau

$flashWidth = 240; $flashHeight = 240; $flashPath = 'tagcloud.swf'; $flashBackgroundColor = 'ffffff'; $tagCount = 30; $tagMaxSize = 16; $tagMinSize = 8;
// Colors are in hex $data['tcolor'] = '0x000000'; $data['tcolor2'] = '0x336699'; $data['hicolor'] = '0x000000'; $data['speed'] = 100; $data['distr'] = 'true'; $data['mode'] = 'tags';
$contentTypes = array(2=>'tags.php?tag=',15=>'blog.php?tag=');
/* No Editing Below This Line*/
global $vbulletin;
// %d
$query = sprintf("SELECT Tag.tagid, Tag.tagtext, TagContent.contenttypeid, COUNT( TagContent.tagid ) AS count FROM ".TABLE_PREFIX."tag AS Tag LEFT JOIN ".TABLE_PREFIX."tagcontent AS TagContent ON ( Tag.tagid = TagContent.tagid ) GROUP BY TagContent.tagid ORDER BY count DESC LIMIT %d",$tagCount);
$qtags = vB::$db->query_read($query);
while($tag = vB::$db->fetch_array($qtags)) { $tags[] = $tag; $tagSize[$tag['tagtext']] = $tag['count']; }
// largest and smallest array values $maxQty = max(array_values($tagSize)); $minQty = min(array_values($tagSize));
$spread = $maxQty - $minQty; if ($spread == 0) { $spread = 1; }
$step = ($tagMaxSize - $tagMinSize) / ($spread);
// make the tag cloud $tagsHTML = ""; foreach ($tags as $tag) { $size = round($tagMinSize + (($tag['count'] - $minQty) * $step)); $text = $tag['tagtext'];
$url = $vbulletin->options['homeurl'].'/'.$contentTypes[$tag['contenttypeid']].urlencode($tag['tagtext']); $tagsHTML .= "<a href='$url' style='$size'>$text</a>"; }
$data['tagcloud'] = '<tags>'.$tagsHTML.'</tags>';
$flashVars = "";
foreach($data as $var=>$val) { $flashVars .= (empty ($flashVars))?'':'&amp;'; $flashVars .= "$var=".urlencode($val); }
ob_start(); ?> <embed width="<?php echo $flashWidth;?>" height="<?php echo $flashHeight;?>" flashvars="<?php echo $flashVars;?>" wmode="transparent" allowscriptaccess="always" quality="high" bgcolor="#<?php echo $flashBackgroundColor;?>" name="vbCloudFlash" id="vbCloudFlash" style="" src="<?php echo $vbulletin->options['homeurl'].'/'.$flashPath;?>" type="application/x-shockwave-flash"/> <?php
$content = ob_get_contents(); ob_end_clean();
$output = $content;

Save !

Done!

Live Demo (http://vietgamer.net)

quocduyze
26-06-2011, 05:26 PM
Kiểm tra xem đuờng dẫn đã đúng chưa

Mình đã làm đúng cái bước mà sao không thấy hiện ra ,

http://www.tenmien.com/forum.php : Mình mún nó hiện ở forumhome mà không thấy ,,sạc

Chèn xong báo lỏi

hoangduykt7990
26-06-2011, 05:40 PM
đưA LINK 4RUM BẠN và đưa cái code bạn chèn lên đây di, sửa cho :)

PhucSD
26-06-2011, 05:40 PM
Đã cập nhật bài hướng dẫn trong bài gốc, mọi người đọc và làm theo, không được chỗ nào thì rep tại đây

hoangduykt7990
26-06-2011, 05:44 PM
Forum mình là domain/@4r thì config như sau, tagcloud CMod 755



$flashWidth = 200;
$flashHeight = 200;
$flashPath = '@4r/images/tagcloud.swf';
$flashBackgroundColor = 'ffffff';
$tagCount = 30;
$tagMaxSize = 16;
$tagMinSize = 8;


// Colors are in hex
$data['tcolor'] = '0x000000';
$data['tcolor2'] = '0x336699';
$data['hicolor'] = '0x000000';
$data['speed'] = 100;
$data['distr'] = 'true';
$data['mode'] = 'tags';


$contentTypes = array(2=>'@4r/tags.php?tag=',15=>'@4r/blog.php?tag=');


/* No Editing Below This Line*/


global $vbulletin;


// %d


$query = sprintf("SELECT Tag.tagid, Tag.tagtext, TagContent.contenttypeid, COUNT( TagContent.tagid ) AS count FROM ".TABLE_PREFIX."tag AS Tag LEFT JOIN ".TABLE_PREFIX."tagcontent AS TagContent ON ( Tag.tagid = TagContent.tagid ) GROUP BY TagContent.tagid ORDER BY count DESC LIMIT %d",$tagCount);


$qtags = vB::$db->query_read($query);


while($tag = vB::$db->fetch_array($qtags)) {
$tags[] = $tag;
$tagSize[$tag['tagtext']] = $tag['count'];
}


// largest and smallest array values
$maxQty = max(array_values($tagSize));
$minQty = min(array_values($tagSize));


$spread = $maxQty - $minQty;
if ($spread == 0) {
$spread = 1;
}


$step = ($tagMaxSize - $tagMinSize) / ($spread);


// make the tag cloud
$tagsHTML = "";
foreach ($tags as $tag)
{
$size = round($tagMinSize + (($tag['count'] - $minQty) * $step));
$text = $tag['tagtext'];


$url = $vbulletin->options['homeurl'].'/'.$contentTypes[$tag['contenttypeid']].urlencode($tag['tagtext']);
$tagsHTML .= "<a href='$url' style='$size'>$text</a>";
}


$data['tagcloud'] = '<tags>'.$tagsHTML.'</tags>';


$flashVars = "";


foreach($data as $var=>$val)
{
$flashVars .= (empty ($flashVars))?'':'&';
$flashVars .= "$var=".urlencode($val);
}


ob_start();
?>
<embed width="<?php echo $flashWidth;?>" height="<?php echo $flashHeight;?>" flashvars="<?php echo $flashVars;?>" wmode="transparent" allowscriptaccess="always" quality="high" bgcolor="#<?php echo $flashBackgroundColor;?>" name="vbCloudFlash" id="vbCloudFlash" style="" src="<?php echo $vbulletin->options['homeurl'].'/'.$flashPath;?>" type="application/x-shockwave-flash"/>
<?php


$content = ob_get_contents();
ob_end_clean();


$output = $content;

quocduyze
26-06-2011, 05:56 PM
Forum mình là domain/@4r thì config như sau, tagcloud CMod 755



$flashWidth = 200;
$flashHeight = 200;
$flashPath = '@4r/images/tagcloud.swf';
$flashBackgroundColor = 'ffffff';
$tagCount = 30;
$tagMaxSize = 16;
$tagMinSize = 8;


// Colors are in hex
$data['tcolor'] = '0x000000';
$data['tcolor2'] = '0x336699';
$data['hicolor'] = '0x000000';
$data['speed'] = 100;
$data['distr'] = 'true';
$data['mode'] = 'tags';


$contentTypes = array(2=>'@4r/tags.php?tag=',15=>'@4r/blog.php?tag=');


/* No Editing Below This Line*/


global $vbulletin;


// %d


$query = sprintf("SELECT Tag.tagid, Tag.tagtext, TagContent.contenttypeid, COUNT( TagContent.tagid ) AS count FROM ".TABLE_PREFIX."tag AS Tag LEFT JOIN ".TABLE_PREFIX."tagcontent AS TagContent ON ( Tag.tagid = TagContent.tagid ) GROUP BY TagContent.tagid ORDER BY count DESC LIMIT %d",$tagCount);


$qtags = vB::$db->query_read($query);


while($tag = vB::$db->fetch_array($qtags)) {
$tags[] = $tag;
$tagSize[$tag['tagtext']] = $tag['count'];
}


// largest and smallest array values
$maxQty = max(array_values($tagSize));
$minQty = min(array_values($tagSize));


$spread = $maxQty - $minQty;
if ($spread == 0) {
$spread = 1;
}


$step = ($tagMaxSize - $tagMinSize) / ($spread);


// make the tag cloud
$tagsHTML = "";
foreach ($tags as $tag)
{
$size = round($tagMinSize + (($tag['count'] - $minQty) * $step));
$text = $tag['tagtext'];


$url = $vbulletin->options['homeurl'].'/'.$contentTypes[$tag['contenttypeid']].urlencode($tag['tagtext']);
$tagsHTML .= "<a href='$url' style='$size'>$text</a>";
}


$data['tagcloud'] = '<tags>'.$tagsHTML.'</tags>';


$flashVars = "";


foreach($data as $var=>$val)
{
$flashVars .= (empty ($flashVars))?'':'&';
$flashVars .= "$var=".urlencode($val);
}


ob_start();
?>
<embed width="<?php echo $flashWidth;?>" height="<?php echo $flashHeight;?>" flashvars="<?php echo $flashVars;?>" wmode="transparent" allowscriptaccess="always" quality="high" bgcolor="#<?php echo $flashBackgroundColor;?>" name="vbCloudFlash" id="vbCloudFlash" style="" src="<?php echo $vbulletin->options['homeurl'].'/'.$flashPath;?>" type="application/x-shockwave-flash"/>
<?php


$content = ob_get_contents();
ob_end_clean();


$output = $content;





Forum mình ko có @4r thì điền đường dẫn ntn : vào thẳng forumhome
Là tenmien.com/forum.php ah : thì phải sửa ntn

PhucSD
26-06-2011, 06:09 PM
Bạn đã đọc kĩ HD chưa ???
Up cái file tagcloud.swf vào forum root của bạn, tức là ngang hàng admincp, forum.php đấy

hoangduykt7990
26-06-2011, 06:11 PM
Lấy cái code trên cùng, up cái tagcloud.swf ngang hàng với index.php

Thảo Nguyên
26-06-2011, 06:15 PM
đây làm được rùi nè :MatCuoi (40):

quocduyze
26-06-2011, 06:32 PM
Bạn đã đọc kĩ HD chưa ???
Up cái file tagcloud.swf vào forum root của bạn, tức là ngang hàng admincp, forum.php đấy

Mình đã Làm theo hướng dẫn rùi toàn ra trắng nhu này thôi
http://hostpixs.com/images/312flashtag.jpg
http://hostpixs.com/images/312flashtag.jpg

hoangduykt7990
26-06-2011, 06:32 PM
làm sao để nó hiện tiếng việt như softvnn nhỉ

PhucSD
26-06-2011, 07:53 PM
làm sao để nó hiện tiếng việt như softvnn nhỉ

Vui lòng đọc hướng dẫn ở trên, Demo (http://vietgamer.net)này mà sao không xem

P/s Hoangduykt7990 không spam những câu hỏi như thế này nữa nhá

quocduyze
26-06-2011, 08:13 PM
Mò từ chiều giờ mới ra

dinhdungvt47
27-07-2011, 10:57 AM
Mình làm y hệt hướng dẫn, mà nó hiện ra trang trắng phau như của quocduyze vậy, mấy bạn giúp mình.Thank

t8mclub
28-07-2011, 10:32 AM
Tất cả các lỗi trên điều do đường dẫn mà ra. Các bạn chú ý đường dẫn tới file flash, file tag và file blog.

sharingan47
11-06-2012, 08:05 PM
mình làm lại bị lỗi ! bạn có thể hướng dẫn cụ thể dc ko

PhucSD
12-06-2012, 10:01 AM
mình làm lại bị lỗi ! bạn có thể hướng dẫn cụ thể dc ko


Bạn phải tải file đính kèm ở dưới bài viết rồi giải nén và upload file tagcloud.swf lên host(ngang hàng với index.php)

haitac261189
01-07-2012, 03:27 PM
cho mình hỏi, mình đang học web cơ bản. cái này mình chèn vào 1 div nó có chạy được ko ah? Ai làm được hướng dẫn mình với, tks rất nhiều..