在Drupal 7中更改主题的drush命令是什么?
drush theme disable theme_name
drush theme enable theme_name
Run Code Online (Sandbox Code Playgroud)
不起作用.
如何使用jquery计算文本框中的字符数?
$("#id").val().length < 3
只计算3个字符空格,但不计算字符数
$_SERVER['REQUEST_URI']和$_GET['q'](用于Drupal)有什么区别?
我有2个提交按钮,并希望为每个提交按钮执行不同的操作.在这里,我想设置只能在form_alter()中完成的表单字段.任何人都可以建议如何检查form_alter()函数中的多个提交按钮?
我用过
function myform_form_submit($formID, &$form_state) {
if($form_state['clicked_button']['#value'] == $form_state['values']['submit_one']) //if button 1 is clicked
$form_state['redirect'] = 'mypath/page_one'; //redirect to whatever page you want
else if($form_state['clicked_button']['#value'] == $form_state['values']['submit_two']) /if button 2 is clicked
$form_state['redirect'] = 'mypath/page_two';
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用
对于隐藏字段,我可以使用该类型的字段
<input type="hidden" name="field_name" value="<?php print $var; ?>"/>
Run Code Online (Sandbox Code Playgroud)
并在GET/POST方法之后检索它 $_GET['field_name'] / $_POST['field_name'] ?
有没有其他方法在PHP中使用隐藏字段?
我计划在hook_schema的帮助下添加一个表.我已经定义了模式,并在我的模块中调用它.但是,没有创建架构.我哪里错了.我的sample2.install文件中有以下代码
function sample2_schema(){
$schema['mytable1'] = array(
'description' => t('My table description'),
'fields' => array(
'mycolumn1' => array(
'description' => t('My unique identifier'),
'type' => 'serial',
'unsigned' => true,
'not null' => true,
),
'myvarchar' => array(
'description' => t('My varchar'),
'type' => 'varchar',
'length' => 32,
'not null' => true,
),
'mytimestamp' => array(
'description' => t('My timestamp'),
'type' => 'int',
'not null' => true,
),
),
'indexes' => array(
'myvarchar' => array('myvarchar'),
),
'primary key' => array('mycolumn1'),
'unique keys' …Run Code Online (Sandbox Code Playgroud) 如何在drupal中获取当前页面的视图.
我有一个过滤器,每当用户输入搜索项时,视图都会更改.
$view = views_get_current_view();
不起作用.
我已经为自定义模块安装了一个模式,该模块在启用模块时创建表.但是当我禁用模块时,表仍然存在.我使用以下代码进行卸载:
function sample2_install() {
if(!db_table_exists('contact')){
drupal_install_schema('sample2');
}
}
function sample2_uninstall() {
drupal_uninstall_schema('sample2');
}
Run Code Online (Sandbox Code Playgroud)
为什么表没有被卸载?