dashan 提交于
论坛:
显示一个views内容:<?php print views_embed_view('view_name', 'display_name'); ?>
可以输出打印cck字段节点在视图模板或php页面。可以帮助打印(选择列表)cck字段显示值,而不是键调用编程领域。
$node = node_load($nid); echo field_view_value('node', $node, 'field_YOUR_FIELD', node->field_YOUR_FIELD['und'][0]);
- 登录以发表评论
清除页面源码的Drupal 7
- 登录以发表评论
dashan 答复于 永久连接自动在新页面打开所有的PDF文件
- 登录以发表评论
dashan 答复于 永久连接Calling the Profile2 fields in Drupal User Profile
- 登录以发表评论
dashan 答复于 永久连接您可以简单地打印$ urser_profile数组字段名称。
- 登录以发表评论
dashan 答复于 永久连接just simple use
<?php
print render($user_profile['field_age']);
?>
(where "field_age" is the field name)
in user-profile.tpl.php to print field name
- 登录以发表评论
dashan 答复于 永久连接单独加载js代码
<?php
print drupal_add_js('path-to/javascript.js', 'theme');
?>
应该放置于页面最后段
- 登录以发表评论
dashan 答复于 永久连接改变首页的模板
- 登录以发表评论
dashan 答复于 永久连接drupal add css
drupal_add_css(drupal_get_path('module','')."style.css");
- 登录以发表评论
dashan 答复于 永久连接Add Javascript file to your theme
- 登录以发表评论
dashan 答复于 永久连接Then you can use this theme function in your .tpl file to get cl
<?php
$content['field_NAME']['#theme'] = "nomarkup";
// Print a clean from markup field
print render($content['field_NAME']);
?>
- 登录以发表评论
dashan 答复于 永久连接Drupal embedding View in theme
<?php
$viewName = 'MYVIEWNAME';
$display_id = 'block';
$myNodes = array(1, 2, 3);
print views_embed_view($viewName, $display_id, $myNodes);
?>
- 登录以发表评论
dashan 答复于 永久连接查找模板中的所有可用的变量
<pre><?php print_r(array_keys($variables)); ?></pre>
- 登录以发表评论
dashan 答复于 永久连接Custom Views Output
<?php
$view = views_get_view('reviews_front');
$view->render();
$images = array();
$teasers = array()
foreach ($view->result as $result) {
$node = node_load($result->nid);
$images[] = $node->field_image[0]['view'];
$teasers[] = node_teaser($node->body);
}
echo '';
foreach ($images as $img) {
echo $img;
}
echo '';
//same way for teasers ...
?>
- 登录以发表评论
dashan 答复于 永久连接Drupal Views: display all views template keys (print_r)
<?php
print print_r(array_keys(get_defined_vars()), 1);
// If you have devel.module installed, comment the line above and uncomment the line below
// dsm(array_keys(get_defined_vars()));
?>
- 登录以发表评论
dashan 答复于 永久连接Drupal Views Custom download file link
-add the field and to view and exlude from diplay
-add the fiedl again and rewrite:
<a href="[field_field_name]" target="_blank" rel="nofollow">Link Name</a>
- 登录以发表评论
dashan 答复于 永久连接在Drupal 7当中获取当前页面URL
current_path()
request_path()
- 登录以发表评论
dashan 答复于 永久连接输出全部用户名称
<?php
$query = db_select('users', 'u');
$query->fields('u', array('name'));
$result = $query->execute();
while($record = $result->fetchAssoc()) {
print_r($record['name']);
}
?>
- 登录以发表评论
dashan 答复于 永久连接输出用户名称和用户编号
<?php
$users = entity_load('user');
$usernames = array();
foreach($users as $id => $user){
$usernames[$user->uid] = $user->name;
}
print_r($usernames);
?>
- 登录以发表评论
dashan 答复于 永久连接if($is_front) print "something";
if($is_front) print "something";
- 登录以发表评论
dashan 答复于 永久连接$feature_a
<?php
print $feature_a;
?>
regions[ad_top] = Ad Top
regions[ad_bottom] = Ad Bottom
regions[front_sidebar] = Front Sidebar
regions[sidebar_ad] = Sidebar Ad
regions[content] = Content
regions[feature_a] = Feature A
regions[feature_b] = Feature B
regions[feature_c] = Feature C
regions[feature_d] = Feature D
node.tpl.php
page.tpl.php
page-node.tpl.php
comment.tpl.php
comment-node.tpl.php
comment-wrapper.tpl.php
comment-wrapper-forum.tpl.php
maintenance-page.tpl.php
search-result.tpl.php
search-theme-form.tpl.php
theme-settings.php
views-view.tpl.php
user-picture.tpl.php
user-profile.tpl.php
- 登录以发表评论
dashan 答复于 永久连接