zoukankan      html  css  js  c++  java
  • [Drupal] Simple steps of building a module theme

    1. Scene of building a theme.

    代码
    /**
    * Implementation of hook_block().
    */
    function mymodule_block($op = 'list',$delta = 0, $edit = array()) {
    switch ($op) {
    case 'list':
    $blocks[0]['info'] = t('my testmodule');
    return $blocks;
    case 'view':
    $content = theme('mymodule_get_sth','David Lee', 'David Lee 2.0');
    $blocks['subject'] = t('Just atest');
    $blocks['content'] = $content;
    return $blocks;
    }
    }

     

     

    2. Build a function: hook_theme()

    function mymodule_theme() {
    return array(
    'mymodule_get_sth' => array(
    'arguments' => array('arg_1' =>NULL, 'arg_2' => NULL),
    )
    ,
    );
    }

     

    3. Build a function: theme_hook()

    function theme_mymodule_get_sth($arg_1,$arg_2) {
    return '<divclass=”mymodule_theme”>'.$arg_1.' and '.$arg_2.'</div>';
    }

  • 相关阅读:
    js内置date类
    获取下拉列表的value
    表单的隐藏与显示
    JavaScript
    CSS的相关属性
    CSS
    基于akka-http搭建restfull框架
    Netsharp配置文件
    nginx配置备忘
    docker安装radis
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/1846031.html
Copyright © 2011-2022 走看看