<?php
/*
* author by:wordpress教程网(http://www.wpnoob.cn)
* url:
*
*/
class weatherWidget extends WP_Widget {
/*
* 参数:
* $widget_ops -- 用来保存类名和描述,以便在主题控制面板正确显示小工具信息
* $control_ops -- 是可选参数,用来定义小工具在控制面板显示的宽度和高度
* 最后是关键的一步,调用WP_Widget来初始化我们的小工具
**/
function weatherWidget(){
$widget_ops = array('classname'=>'site_weather','description'=>'天气');
$control_ops = array('width'=>250,'height'=>300);
$this->WP_Widget(false, '天气', $widget_ops, $control_ops);
} function form($instance){
//title:标题,text:内容
$text = "<div class='widget '><iframe name='weather_inc' src='http://i.tianqi.com/index.php?c=code&id=55' width='255' height='294' frameborder='0' marginwidth='0' marginheight='0' scrolling='no'></iframe></div>";
echo '<p style="text-align:left;"><label for="'.$this->get_field_name('text').'"><div style="width:200px;" id="'.$this->get_field_id('text').'" name="'.$this->get_field_name('text').'" type="text" /> ' . $text . '</div></label></p>';
} function widget($args, $instance){
$text = "<div class='widget '><iframe name='weather_inc' src='http://i.tianqi.com/index.php?c=code&id=55' width='255' height='294' frameborder='0' marginwidth='0' marginheight='0' scrolling='no'></iframe></div>";
if( $text ) echo $text;
} } ?>

最新文章

  1. Android RecyclerView.Adapter notifyDataSetChanged 不起作用
  2. [Ubuntu] Install teamviewer9 on Ubuntu14.04_x64
  3. 【py网页】urllib模块,urlopen
  4. STM32F0xx_TIM基本延时配置详细过程
  5. GlusterFS集群文件系统概述
  6. ios 利用Reveal来调试界面1 --模拟器(步骤详解)
  7. 包装一个php的验证码类
  8. React 系列文章(1): npm 手动搭建React 运行实例 (新手必看)
  9. XAMPP重置MySQL密码
  10. python 模块定义导入
  11. mv,rm等命令出现unrecognized option提示的解决方法
  12. HDU 1611 敌兵布阵 / HRBUST 1794 敌兵布阵(线段树)
  13. Linux如何实现开机启动程序详解(转)
  14. SQL查找删除重复行
  15. PHP在引号前面添加反斜杠的原因及PHP去除反斜杠的办法
  16. Smarty中{literal}的使用详解(ecshop)
  17. Educational Codeforces Round 56 Solution
  18. 关于面向对象和String类型的 09,10
  19. 图示NP, P, NP-Complete和NP-Hard问题
  20. python将一些朋友的姓名存储在一个列表中,访问该列表中的每个元素,从而将每个朋友的姓名都打印出来

热门文章

  1. 转载--thinkphp框架的路径问题 - 总结
  2. IIS7 Appcmd.exe 使用
  3. Html - 对话箭头
  4. OpenStack手动从数据库中删除实例 - ugyn109的专栏 - 博客频道 - CSDN.NET
  5. 分布式架构高可用架构篇_06_MySQL源码编译安装(CentOS-6.7+MySQL-5.6)
  6. Objective-C、C++和swift 的运行效率比较
  7. Web中的图标
  8. python多线程使用
  9. PHP--进行模块化设计
  10. Rails--render partial时传递参数