1.3 Drupal前端培训

龹龷龵龱龮龪龦龢龟龹龜龚龗龖龓龑龐龪龏龋image style龓齰龢

齬龷齨齤齡齠齜齘齔龓齑齐齎齊齰齇齆齅

test 齑齐齁鼾齜齘鼼鼹龪鼵鼳鼱鼯龪鼬鼫鼧page鼢鼞齁鼾鼚鼗鼓鼏龪鼋鼇鼃龓鼫齁鼾鼁黽黼header齎footer黯黭

test_content 齑齐黥黣齁鼾齜齘鼼鼹龪鼵鼳鼱鼯龪鼬鼫鼧黥黣鼢鼞齁鼾鼚鼗鼓鼏龪鼋鼇鼃龓鼫齁鼾鼁黠黽黼header齎footer黯黭

test_ajax_url ajax黕齔齜齘鼼鼹龪黓黒黏黋黈黄黂黁黕黀齰鼁齆麼麺麷黁齊齰齇鼚鼗齜齘

麵龷齨齤龮麱麭麫龓龟龹齆齅

黓麧麦麤麣麢麠麜龮麱麭麫龓鼼麚龪鼬齠黏黋麘麔龹齠龟龹龓齆齅齨齤麭麫龮麱龓麑麐龪龹麏黓黒麍麦齔js麉麈麅龮麱麭麫龓麄麃龪麀鹼鹹鹵麘麔鼬鹱龹齠齆齅龪齆麼麭麫齰齇鹭鹪龪麷黁fid

鹨龷龜鹤龦龢鹣齔webfont

龏龋龜鹤麭麫齰龢

鹜龷龜鹤龗龖齎麭麫鹙鹘龪麭麫鹖鹔鹐鹎

鹐鹎鹍鹋鹇鹃龓龜龚鹀鸾齔jpg龪鸺鹍鸸龋龓鹀鸾png龪鸵...

鸲龷鸰鼼鸮鸭鸬鸫鸨鸤鼚鼗鸠鸜齜齘

鹭鸙鸗黒鸓黓黒鸒鸏黭鸋龪鸊鸈黓黒鸅鸃龹鸁龪鷾齆鷺鷶鷵鸬鸫鸠鸜鸨鸤鷱麉鷮

鷫龷鷧齔齐鷦鼧鷣鼱鷡鷝鷙css鹱鹘

鷗鷖鷒鷎鹱鹘鷖btn, btn-default, btn-primary, btn-danger, btn-disable

鷆龷齨齤鷖pager.php, table龓html鹱鷃

鷁鶽黭齑齎鶺鹙龪麀鹼鼋鼇鼫齔drupal齨齤龓麚鶹鶸鶷龓龪鶶黋黓黒龓html鶴鶲麜鹭鶰龹鶭鷮

鶬.php齁鼾鶨鶹

1.齁鼾鶦龢

麀鹼鶽黓黒麘麔龓齁鼾麭麫龪麜鶤鶣鶠齁鼾龓黏齔鶦龢鶟鶝龪鶚齰齇龓鶘鶕鶑鶎黓黒麉鶋鷮

/**
 * @file
 * 我的项目经历页面
 *
 * 可用变量:
 * $user_display_name 用户姓名
 * $user_avatar_url 用户头像文件地址
 * ......
 */

2.print

鶸鶷鶦龢

<?php print $user_name; ?>

3.if else endif

鵑麫鵏鵌鶸鶷

<?php if ($front_page): ?>
  <a href="">首页</a>
<?php else: ?>
  <a href="">不是首页</a>
<?php endif; ?>

4.foreach

鴹鸨齰鷝鶸鶷

<?php foreach ($project_lable as $tag): ?>
  <span><?php print $tag->name; ?></span>
<?php endforeach; ?>

5.drupal_add_css

drupal_add_css(path_to_theme() . '/css/cropper.min.css'); 加载css文件

6.drupal_add_js

drupal_add_js(path_to_theme() . '/js/cropper.js'); 加载js文件
drupal_add_js(array('profile' => array('uid' => $uid)), 'setting'); 定义js变量

7.drupal_add_library

鴵鴱鶘鴥鴢

drupal_add_library('common', 'angular');

8.include

黽黼麭麫

include path_to_theme() . "/templates/html/footer.php";

9.url

鶸鶷鸬齑鼼鼹

<?php print url(''); ?> // 首页
<?php print url('project_list'); ?> // 项目列表页
<?php print url('user/' . $user->uid); ?> // 用户主页

10.file_create_url

鶸鶷麭麫鼼鼹鴓path_to_theme() 鴐鴏鴎黓鴘鴊鴉鴈鴆

<?php print file_create_url(path_to_theme() . '/images/example.jpg'); ?>

11.switch

switch 鶨鴅齔鴃鳿鴃黠鳻鵑麫鳷鼗黠鳻鳶鶕

<?php
  $fa_icon_file_type = '';

  switch ($value['report_file_type']) {
    case 'video':
      $fa_icon_file_type = 'fa-file-video-o';
      break;
    case 'document':
      $fa_icon_file_type = 'fa-file-text-o';
      break;
    case 'audio':
      $fa_icon_file_type = 'fa-file-audio-o';
      break;
    case 'image':
      $fa_icon_file_type = 'fa-file-image-o';
      break;
  }
?>

12.current_path

鴐鴏鴎黓齑齐鳬龟鴉鴈

<?php print current_path(); ?>

鴐鴏鴎黓齑齐鳩鼧鴉鴈

<?php
  global $base_url; // 域名前缀
  
  print $base_url . '/' . current_path();
?>

13.dpm

鹹黓黒鳢鳟龹齠鸰鼼鸠鸜鸨鸤龓鸠鸜鳜鳛鳙龪黏黋鹣齔devel齁鳖龓dpm麉鳕鳒齁鼾黏齔鶦龢鷮

评论 (写第一个评论)