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>';
    }

  • 相关阅读:
    关于vue的npm run dev和npm run build
    移动端meta行大全
    浅谈前端三大框架Angular、react、vue
    Web Workers
    Meta(其他信息)
    页面
    页面
    日期和时间
    ECharts教程(未完)
    页面
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/1846031.html
Copyright © 2011-2022 走看看