我需要将样式和只读属性应用于drupal表单的输入元素.我编码如下:
$form['precio'] = array(
'#type' => 'textfield',
'#title' => t('Precio'),
'#default_value' => ''.$precio,
'#size' => 20,
'#required' => TRUE,
'#attributes' => array($inputAtributo => 1),
'#description' => t('Modifica el precio '),
);
Run Code Online (Sandbox Code Playgroud)
并在 '#attributes' => array($inputAtributo => 1),
在创建表单之前,我检查这个输入是否应该是readonly并应用一些样式:
if ($tarifa !='' & $tarifa=='N')
$inputAtributo=" readonly style=\"background: none repeat scroll 0 0 #EAEAEA;\" ";
else
$inputAtributo = "";
Run Code Online (Sandbox Code Playgroud)
这有效,但我认为它编码不正确
html代码显示以下内容:
<input id="edit-precio" class="form-text required" type="text" maxlength="128" size="20" value="258" name="precio" ="1"="" style="background: none repeat scroll 0 0 #EAEAEA;" readonly="">
Run Code Online (Sandbox Code Playgroud)
我怎么能做得更好?
如何覆盖drupal首页node.tpl文件?我试过各种各样的
node--front.tpl.php
page--node--front.tpl.php
page--front--node.tpl.php
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
覆盖主页节点的文件名是什么?(我在drupal 7工作)
function mymodule_search_form($form, &$form_state) {
$form..... define the form here
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Search',
);
return $form;
}
function mymodule_search_form_submit($form, &$form_state) {
//process the form and get result
$output = this is the result with a table of data.
//I want to display the result table here.
//Now I can only use drupal message to display on top.
drupal_set_message($output);
return;
}
Run Code Online (Sandbox Code Playgroud)
所以基本上我想要一个表单从数据库中搜索一些东西.点击提交后进行搜索,即可获得结果.
我想在同一表单页面的表单下显示结果. 不要转到另一页,只需在原始表单页面中.
表格可以清理/重置为原始状态,这很好.
http://drupal.org/node/542646 这个讨论是我想要的,但那里看起来没有可靠的结果/解决方案.
我想听听是否有人可以帮助替换我的大型 XML 文件的 HTML 标记。
XML 文件有我自己的架构,一切都很好。但我需要删除标签<sspan>, <style>, <div>中的 和 属性<p>。
例如,我需要保留所有<ul>, <ol>, <li>, <strong>, <a>, <img>标签和其他标签,但删除<div>(带属性)、<span>(带属性)和<p>标签中的属性。
我已经尝试过该网站和许多其他网站的许多示例。但大多数都没有奏效。
我想在drupal 7中将以下内容添加到页脚区域/块中.
页脚将如下所示版权所有2012 | 链接到隐私
做这个的最好方式是什么?
谢谢
这是我的字符串
component/content/article?id=9
Run Code Online (Sandbox Code Playgroud)
如何从中动态获得9?
我想在字符串上做,而不是url,并且可能存在更多paremateres的情况,例如url.我想像$ _GET一样做得很好,但是在字符串上
重写问题(由Ayesh K撰写):
我有一个包含URL路径和查询字符串的字符串.我想将查询字符串解析为一个键和值数组,就好像它是当前页面的查询字符串,所以我可以从中获取它们$_GET.
例如,我有以下字符串:
component/content/article?id=9
Run Code Online (Sandbox Code Playgroud)
现在我想从数组中获取idvalue(9).如何解析此类字符串以分隔查询字符串并将其转换为数组?