看到3D标签云很久了,一直很羡慕,不知道人家是怎么弄的,今天终于了解了一下,就是js+swf实现的。具体代码是大牛写的,我们会用行了。
扒开代码,看了一天怎么用,终于到晚上得时候让我弄出来了。为了方便,我把它封装成了函数。记录一下吧。
要有这两个文件:tagcloud.swf , swfobject.js
然后便是自己对这些东西的调用了。不多说了,直接上代码吧。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>tag cloud fengzhuang</title>
</head>
<body>
<?php
//$abnormal: when the flash and js can not support ,we can also use the links to access
//$abnormal format: '<a href="http://www.abc.com">abc</a>';
// $mytags: use to put in the sphere
// $mytags format:'<a href='http://www.baidu.com' style='font-size: 24.12pt;'>abc24</a> '
function tag_cloud($abnormal, $mytags)
{
$soname = 'so_' . rand(0,999999);
$moviename = 'mo_' . rand(0, 999999) ;
$mytags = urlencode('<tags>') . urlencode($mytags) . urlencode('</tags>');
$flashtag = '';
$flashtag .= '<div id="wp-cumulus" class="block">';
//remember to change the src
$flashtag .= '<script type="text/javascript" src="http://localhost/test/js/swfobject.js"></script>';
$flashtag .= '<div id = "tagcannotdis">';
$flashtag .= $abnarmal;
$flashtag .= '</div>';
$flashtag .= '<script type="text/javascript">';
// remember to change the url
$flashtag .= 'var ' . $soname .' = new SWFObject("http://localhost/test/js/tagcloud.swf?r=' . $moviename . '", "tagcloudflash", "800", "800", "9", "#ffffff");';
$flashtag .= $soname . '.addParam("wmode", "transparent");';
$flashtag .= $soname . '.addParam("allowScriptAccess", "always");';
$flashtag .= $soname . '.addVariable("tcolor", "0xb06002");';
$flashtag .= $soname . '.addVariable("tcolor2", "0x000000");';
$flashtag .= $soname . '.addVariable("hicolor", "0x814600");';
$flashtag .= $soname . '.addVariable("tspeed", "100");';
$flashtag .= $soname . '.addVariable("distr", "true");';
// if you want to add the categories , modify here
$flashtag .= $soname . '.addVariable("mode", "both");';
$flashtag .= $soname . '.addVariable("tagcloud", "' . $mytags . '");';
// if you want to add the categories , modify here
// 6 means the frequency or articles of this categorie
$flashtag .= $soname . '.addVariable("categories", "' . urlencode(' <a href="http://www.baidu.com">Baidu</a>(6)<br />') . '");';
$flashtag .= $soname . '.write("tagcannotdis");</script>';
$flashtag .= '</div>';
return $flashtag;
}
?>
<?php
// a demo how to use the function tag_cloud();
echo '<h1>标签云</h1><br />';
$a = "<a href='http://www.baiduc.com'>baidu</a>";
$c = "";
//<a href='http://www.baidu.com' style='font-size: 24.12pt;'>abc24</a>
for ( $i = 8 ; $i <= 70; $i++)
{
$c .= "<a href='http://www.baidu.com' style='font-size: " . $i . ".12pt;'>tag" . $i . "</a>";
}
echo tag_cloud($a, $c);
?>
</body>
</html>
将代码保存为php文件,然后借助前面提到的两个文件,就可以看到3D效果的云标签了。
效果图:
附件中有完整代码。
注意:tagcloud 变量里的格式是urlencode('<tags><a href='http://www.baidu.com' style='font-size: 24.12pt;'>abc24</a>tags>')
而categories里面的格式是urlencode(' <a href="http://www.baidu.com" title="P2P">ZZG</a> (1)<br />');
单引号里德空格是一个tab健,后面的"(1)"表示的是此词条出现的频率,必须按此格式来才可以。
- 大小: 156.6 KB
分享到:
相关推荐
大名鼎鼎的WP-CUMULUS 3D标签云,已经改成支持中文标签,可在.htm自行添加标签链接,可以单机玩耍测试,不需要安装WordPress然后装插件~~ 主要是有些童鞋只是想要3D标签云动画,所以就提取重要文件出来稍作修改下.
WORDPRESS用到的.wp-cumulus_3D云标签
包括swfobject.js和tagcolud.swf中文支持文件。
这个7k大小,不需要内嵌字体,支持中英文 但是不支持变色、消除锯齿效果欠佳的版本
distr 设定: true或false 如果设置为true时,标签均匀分布的球的表面。 tcolor Hex颜色值: 0xff0000 for red. 标签典型显示颜色 tcolor2 Hex颜色值 根据标签热门程度显示梯度颜色 hicolor Hex颜色值 鼠标悬停颜色...
完美支持中文wp-cumulus插件源码(无锯齿无抖动7K大小)
不错的标签云,喜欢立体效果的博客主或者网站主可以试试看哦!强力推荐
这个3D标签云可不是N年前的那个Flash版的 wp-cumulus, 这个3D旋转标签云完全使用JS代码编写,很小只有几K,不用担心像垃圾Flash对资源的耗费。
服务器端利用 PHP插件 生成标签云数据,页面用 flash 3D效果展示标签,效果很爽的,放在自己博客格外吸引眼球。 查看效果: http://www.roytanck.com/about-my-themes/donations/ 下面是详细: -------------------...
汉化的drupal标签云效果-tagadelic模块,cumulus模块
cumulus4.4.0 镜像,可加载到EVE环境。测试好使。
建立在内置标签云Web部件和WordPress的Cumulus插件基础上。 它和标准标签云有相同的设置,但是以美妙的3D云效果呈现。 请注意,这个Web部件依靠SP标签功能,只能在SP Server 2010上可用,所以在SP Foundation 2010...
压缩包中已经有了以下插件:lightbox-plus :点击图片放大的插件nextgen-gallery:非常强大的相册插件wp-cumulus: flash动画标签云 可以插入到小工具中插件安装方法:插件–安装插件—上传 完成之后启用即可 安装:...
标签Tags:WP-Cumulus 启动插件后 设置--》固定链接--》 选择自定义结构:/%post_id% 分类目录前缀:直接输入一个. 首页左边导航直接可以通过 外观--主题选项 首页左侧分类布局设置: 此分类为首页左侧...
通常,可以在目录中找到Cumulus的npm软件包,而在目录中可以找到工作流任务。 为了帮助减少在此monorepo中安装软件包依赖项所需的时间和磁盘空间,所有devDependencies都在顶级中定义。 允许所有软件包和任务在该...
Cumulus集成测试项目[已弃用] 注意:此存储库不再维护。 该存储库的内容已移至。 什么是积云? Cumulus是NASA未来地球科学数据流的基于云的数据提取,存档,分发和管理原型。 阅读 安装 nvm use npm install 在...
Ansible角色:Cumulus界面 该角色将在主干(和上行链路)交换机上设置OSPF(FRR)。 此外,还将在叶子交换机上配置接口并配置PoE。 Naturalis将此角色与私人库存一起使用。 要求 没有任何。 角色变量 下面列出了...
配置仪表板所需的信息可在app/src/js/config/config.js ,但通常首选在构建过程中设置覆盖默认值的环境变量。 设置以下环境变量可以覆盖默认值。 环境名称 描述 默认 根 API 网址。 这必须由用户设置。 例子.com...
资源分类:Python库 所属语言:Python 资源全名:cumulus-message-adapter-1.0.0a1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059