欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

drupal

shiping1 的头像

为什么有的字段权限查盾 要 管理节点 这个权限打开

普通分类: 
shiping1 的头像

创建Drupal Rules模块的自定义动作 如果有问题 把rules进行删除(动作或条件删除) 再进行 添加

创建Drupal Rules模块的自定义动作 如果有问题 把rules进行删除(动作或条件删除) 再进行 添加
或者把这整个规则 全删掉  再创建它

切记 这是实践得出来的结论
普通分类: 
shiping1 的头像

创建Drupal Rules模块的自定义动作 rule rules 自定义规则 有大用

具体的例子可以看rules模块里面的代码
创建Drupal Rules模块的自定义动作

普通分类: 
shiping1 的头像

根本原因是 中文路径失效 其实根本原因 是apache的中文路径失效 是由于安装了中文模块

解决问题的根本办法就是 在模块里加上下面的代码
function shipingzhongcustom_init()
{
    $_GET['q'] = mb_convert_encoding($_GET['q'],'UTF-8','GBK');
}





drupal 自动补全  autocomplete 失效 下面的方法当然可以解决 但不是根本的方法,只能解决这一个问题,不能解决所有的中文路径失效的问题
1)经查是在 userreference.module 里面
约 16 行左右 
function userreference_menu() {
  $items = array();
  $items['userreference/autocomplete'] = array(
    'title' => 'Userreference autocomplete',
普通分类: 
shiping1 的头像

drupal warning: Invalid argument supplied for foreach() in /home/wwwroot/yc_4000512126_com/public_html/includes/theme.inc on line 485.

    warning: Invalid argument supplied for foreach() in /home/wwwroot/yc_4000512126_com/public_html/includes/theme.inc on line 485.
    warning: Invalid argument supplied for foreach() in /home/wwwroot/yc_4000512126_com/public_html/includes/theme.inc on line 490.
    warning: Invalid argument supplied for foreach() in /home/wwwroot/yc_4000512126_com/public_html/includes/theme.inc on line 485.
    warning: Invalid argument supplied for foreach() in /home/wwwroot/yc_4000512126_com/public_html/includes/theme.inc on line 490.
普通分类: 
shiping1 的头像

当某个模块(比如drush 安装l10n_update )出现问题的时候 重装一下它 l10n_update

普通分类: 
shiping1 的头像

drupal MySQL server has gone away cron 失败 Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 39947189 bytes) in database.mysql.inc on line 119 有大用

1)我自己遇到的实际情况 是sessions表有问题 ,删掉 重新导一个空的好表就可以了
如何知道sessions有问题呢?
开启devel模块的在最下面显示sql执行语句的功能
看看哪个表执行的时间太长了,超过几千秒
肯定它有问题
(我发现了是sessions表有个insert语句 2千多秒)此时删掉
这个表 重建一个空的好表就可以了,以前也遇到其它出现问题的情况,也是
同样的方法解决的

2)我自己遇到第二个情况 Warning: MySQL server has gone away query: INSERT INTO watchdog
同时发现红色警告 Warning: MySQL server has gone away query: INSERT INTO cache_l10n_update

普通分类: 
shiping1 的头像

直接控制用户权限 不有角色

shiping1 的头像

SecurePages Secure Pages 的使用方法

可以看这个模块的readme.txt文件
1) 当然是启用这个模块
2)admin/build/securepages 里进行设置
3) 最好还要安装 securepages_prevent_hijack 模块,它是为了保护securepages模块 (在drupal6要安装它
drupal7中就不要安装它了)
普通分类: 
shiping1 的头像

Drupal Secure Pages模块介绍,让你的drupal站支持SSL

Drupal Secure Pages模块介绍,让你的drupal站支持SSL

普通分类: 
shiping1 的头像

drupal 网银模块

shiping1 的头像

drupal 的 cookie中 has_js 的意思 得到 cookie 有大用

/**
 * Initiate the batch processing
 */
function _batch_start() {
  // Choose between the JS and non-JS version.
  // JS-enabled users are identified through the 'has_js' cookie set in drupal.js.
  // If the user did not visit any JS enabled page during his browser session,
  // he gets the non-JS version...
  if (isset($_COOKIE['has_js']) && $_COOKIE['has_js']) {
    return _batch_progress_page_js();
  }
  else {
    return _batch_progress_page_nojs();
  }
}

普通分类: 
shiping1 的头像

根据分类得到节点

从 taxonomy 模块里面找 
12行左右function taxonomy_term_page($
46行左右$output = theme('taxonomy_term_page', $tids, taxonomy_select_nodes($tids, $terms['operator'], $depth, TRUE));

function taxonomy_select_nodes($tids = array(), 
普通分类: 
shiping1 的头像

获取用户点击量

在后台开了浏览统计,在node.tpl.php里面,怎么取到点击量?


drupal默认提供访问数统计功能,使用步骤

1、后台,启动statistics模块
2、后台,配置->系统->统计 启动浏览统计 (admin/reports/settings 至少drupal6中是如此的)
3、后台,用户权限,赋予用户组“查看内容点击数”权限
4、在note.tpl.php里:

<?php print render($content['links']); ?>
或者
<?php print $content['links']['statistics']['#links']['statistics_counter']['title']?>


来自drupalchina群分享

来自 http://www.majormoves.net/post/1982/
普通分类: 
shiping1 的头像

drupal node 节点 点击量 排序 有大用 有大大用

drupal节点按点击量排序


SELECT DISTINCT(n.nid), n.sticky, n.title, n.created, nm.totalcount FROM node n INNER JOIN term_node tn ON n.vid = tn.vid LEFT JOIN node_counter nm ON n.nid=nm.nid WHERE n.status = 1 ORDER BY n.created DESC ,nm.totalcount DESC

来自 http://hi.baidu.com/097633/item/00c9cec568d73946a8ba9454  

普通分类: 
shiping1 的头像

ubercart 已经在购物车里的商品,现在添加商品包到购物车里 而购物车里的商品 已存在于商品包中

就是我已经 添加A商品在 购物车里

现在又准 备 添加一个商品包 在 购物里 
但是这个商品包 包含A商品
我想让提交不过去 
有这个模块 实现这种功能吗

我看了一通过去 只有一个解决办法 但是我没有去实验 我觉得应该可行 
http://drupal.stackexchange.com/questions/51123/ubercart-php-message-if-a-product-is-in-cart
普通分类: 
shiping1 的头像

drupal ubercart Sku auto general 自动产生 编号 的模块

1)https://drupal.org/project/uc_product_power_tools
用法

Usage

Once installed, settings are available by product class at the url: admin/store/products/power-tools

As of version 1.10 the default product node type is supported.

Power tools settings are configured for each class by clicking the edit action next to the associated product class, and can be enabled or disabled for each class as well.

普通分类: 
shiping1 的头像

我所使用的字段的禁用

//假如是处理时 并且此人没有禁用关闭状态的权限时  也禁用转交
    if($node->field_zhuanjian_chuli[0]['value']==1 && !user_access('处理 关闭事件')){
           drupal_add_js('$("#edit-field-zhuanjian-chuli-0").attr("disabled","disabled");', 'inline', 'footer');
           //drupal_add_js('$("#edit-field-zhuanjian-chuli-0").attr("readonly","readonly");', 'inline', 'footer');
    }
普通分类: 
shiping1 的头像

cck 字段禁用 readonly disabled hidden等

Code snippet: How to set the disabled or readonly attribute of a CCK field

Last updated July 17, 2011. Created by markus_petrux on January 11, 2009.
Edited by Andrew Schulman. Log in to edit this page.

普通分类: 
shiping1 的头像

cck 字段禁用 readonly 保持原来的值 有大用 有大用

<?php

普通分类: 
shiping1 的头像

drupal 文本字段禁用

how to make a textfield un editable?

I have a text field which displays the username. The user should not be able to edit the text field values.

普通分类: 
shiping1 的头像

ubercart 加入购物车不跳转

Store Administration >> Configuration >> Cart Settings

and set:

Add to cart redirect: to <none>

I don't know about the AJAX but this works pretty well.

Rich

来自 http://www.ubercart.org/forum/support/527/how_do_you_make_add_cart_button_not_redirect_checkout_just...

普通分类: 
shiping1 的头像

node_save后 得到保存的nid (得到保存的node对象)

<?php
$node
= new stdClass();
$node->title = 'Whatever';
// ...
普通分类: 
shiping1 的头像

page.tpl.php中的变量是hook_preprocess_page中的$var 的 class_array键

普通分类: 
shiping1 的头像

ubercart 的购物车本来是checkbox来删除的 现在用button删除

shiping1 的头像

ubercart 只能购买的数量只能为1 的模块 限制购买数量 Ubercart Restrict Qty

shiping1 的头像

ubercart 设置货币符号 美元符号 改成 人民币符号

admin/store/settings/store/edit/format 
普通分类: 
shiping1 的头像

drupal 学习资料

shiping1 的头像

drupal ubercart网店设置路径

drupal ubercart网店设置路径
admin/store/settings/store/edit
admin/store/settings/store/edit/format
普通分类: 
shiping1 的头像

修复Drupal的cache表

今天Drupal遇到了cache表崩溃问题,错误信息如下:

user warning: Table './tilt_db/cache' is marked as crashed and should be repaired query

这个问题似乎很多人都遇到了,参见 http://drupal.org/node/73297
解决方法也比较简单,参见"Repairing a MySQL Database with phpMyAdmin"

详细步骤如下:

普通分类: 

页面

Subscribe to RSS - drupal