我正在尝试修改我正在创建的Drupal 7主题中的HTML输出.
基本上,我希望在<a>中包含一些额外的HTML,而不是仅包含带有文本的简单<a>的<li>.
我知道可以修改Drupal中菜单创建的HTML.我可以在page.tpl.php中看到以下调用:
<?php print theme('links__system_main_menu', array(
'links' => $main_menu,
'attributes' => array(
'id' => 'main-menu',
'class' => array('links', 'clearfix'),
),
'heading' => array(
'text' => t(''),
'level' => 'h2',
'class' => array('element-invisible'),
),
)); ?>
Run Code Online (Sandbox Code Playgroud)
它显然调用了主题函数,它创建了输出.修改输出的一种方法是修改theme.inc中的theme_links函数,对吧?
http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_links
我也知道你可以在template.php中放一个钩子来覆盖创建HTML的函数.我无法弄清楚如何创建实际的覆盖功能.有人能指出我正确的方向吗?
我使用的是CentOS 5.5 Linux(没有X),PHP 5.3和Drupal 7.0.
我网站的核心语言是俄语(不是英语)!
我创建了一个game.info和以下game.module,为首页生成3个块:
function game_block_info() {
return array(
'game_main' => array(
'info' => t('Set FlashVars and show the flash game.'),
'cache' => DRUPAL_NO_CACHE,
),
'game_winner' => array(
'info' => t('Show the winner of the last week.'),
'cache' => DRUPAL_NO_CACHE,
),
'game_leader' => array(
'info' => t('Show the leader of the current week.'),
'cache' => DRUPAL_NO_CACHE,
);
}
function game_block_view($block_name = '') {
global $user;
if ($block_name == 'game_main') {
if (user_is_logged_in()) { …Run Code Online (Sandbox Code Playgroud) 如何在Drupal 7中获取当前登录用户的角色?你知道一个简单的方法吗?这有什么drupal核心功能吗?
我们正在使用Drupal 7并尝试重写视图输出
我们需要图像字段的src,而不是整个图像标记.
点击
重写此字段的输出
[field_first_image] :给出整个内容,即带标签,
我们试图显示以下内容
[field_first_image-fid] ==原始的fid
[field_first_image-alt] ==原始alt
[field_first_image-title] ==原始标题
但是在视图中显示相同的([field_first_image-fid])事物.有没有办法从视图重写中获取src?
刚刚注册了一个新帐户并创建了一个配置文件后,我将如何登录用户?
我试过了 :
global $user;
$user = user_load($account->uid);
Run Code Online (Sandbox Code Playgroud)
要么
global $user;
$user = user_load(array('mail' => $_POST['email'], 'pass' => trim($_POST['password'])));
Run Code Online (Sandbox Code Playgroud)
但是没有工作,第二个导致有关array_flip的错误.
我需要在Drupal 7中为水平登录表单设置一个占位符.单击时该文本需要消失.他们只会说"用户名"和"密码".这是截至目前的表单代码.谢谢!
function horizontal_login_block($form) {
$form['#action'] = url($_GET['q'], array('query' => drupal_get_destination()));
$form['#id'] = 'horizontal-login-block';
$form['#validate'] = user_login_default_validators();
$form['#submit'][] = 'user_login_submit';
$form['#prefix'] = '<div id="loginbar">';
$form['#suffix'] = '</div>';
$form['name'] = array(
'#type' => 'textfield',
'#prefix' => '<div class="usericon">',
'#suffix' => '</div>',
'#maxlength' => USERNAME_MAX_LENGTH,
'#default_value' => t('Username'),
'#id' => 'userbar',
'#size' => 15,
'#required' => TRUE,
);
Run Code Online (Sandbox Code Playgroud) 我正在研究Drupal.我想知道如何更改由Drupal提供的页脚文本以及给它的链接.我想要"Copyrights 2012(我的网站名称).保留所有权利." 我无法得到任何人可以帮助我.
我正在尝试在基本页面中显示登录表单.当我登录时,会将我重定向到用户帐户页面.当我退出时,这没有任何显示.
<?php drupal_get_form("user_login"); ?>
Run Code Online (Sandbox Code Playgroud) 早上,我试图获得一组最新的节点类型,但似乎无法弄清楚如何按日期订购它们.到目前为止,我的功能是:
function latest_nodes($type, $limit = 15, $offset = 0) {
$query = new EntityFieldQuery();
$tmp = $query->entityCondition('entity_type', 'node');
if( is_string( $type ) )
$tmp->entityCondition('bundle', $type);
elseif( is_array( $type ) )
$tmp->entityCondition('bundle', $type, 'IN');
$tmp->range($offset, $limit);
$results = $tmp->execute();
return node_load_multiple(array_keys($results['node']));
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将非常感谢!
我希望能够在我的本地环境中以编程方式禁用然后卸载模块,然后轻松地将该代码推送到prod,以便一切都得到更新.
我猜它是与之相关的东西hook_update_N.但不知道从哪里开始.
drupal-7 ×10
drupal ×4
login ×3
php ×3
forms ×2
css ×1
drupal-views ×1
gettext ×1
javascript ×1
localization ×1