zoukankan      html  css  js  c++  java
  • wordpress 天气插件开发

    <?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="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;        
        }
        
        
    }
    
    ?>
  • 相关阅读:
    练习二十七:递归函数应用
    mysql8.0数据库忘记密码时进行修改方法
    格式化字符串两种方式
    练习二十六:阶乘计算(递归)
    练习二十五:阶乘之和计算
    Dapper批量添加
    c# FTP操作类(转)
    c# 依赖注入之---反射(转)
    c# 依赖注入之---setterInjection(转)
    php遍历数组赋值
  • 原文地址:https://www.cnblogs.com/hellowzd/p/5593161.html
Copyright © 2011-2022 走看看