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

这里的技术是共享的

You are here

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"

详细步骤如下:

普通分类: 
shiping1 的头像

theme_links theme_item_list l 函数

普通分类: 
shiping1 的头像

drupal 覆写 区块 内容

区块覆写 其实还是用 devel themer看到的函数 对函数进行覆写比较方便
drupal 覆写 区块 内容  使用预处理函数

function shipingzhong_preprocess_block(&$vars, $hook) {
    //dpr($vars);
     
    dpr($vars['block']->bid);//这里是各个区块不同的
    dpr($vars['block_id']);//这里是各个区块 有可能相同
   dpr($vars['block_html_id']);//这里是各个区块不同的

  根据不同的区块 进行不同的覆写 这里用得到
}
普通分类: 
shiping1 的头像

drupal6 hook form validate 验证的几种方法 有大用 有大大用 有大大大用

1)hook_validate
2)hook_nodeapi时验证
2)下面的方法是比较好的


function mymodule_form_alter(&$form, &$form_state, $form_id) {
	switch($form_id) {
		case 'artist_node_form':
			$form['#after_build'][] = 'mymodule_custom_after_build';
			break;
	}
}

function mymodule_custom_after_build($form, &$form_state) {
	$form['#validate'][] = 'mymodule_custom_validation';					
	
	return($form);
}

function mymodule_custom_validation($form, &$form_state) {
	//My custom validations went here.
}



普通分类: 
shiping1 的头像

处理节点表单提交之后的页面跳转

处理节点表单提交之后的页面跳转

  在普通情况下,当用户提交节点表单后会被重定向到对应的节点页面,如果在 URL 中传入了 ?destination=path/xxx 这样的参数,提交表单后用户就会被重定向到 destination 设置的页面。

  除此之外,开发人员还可以通过为节点表单设置重定向属性,来控制表单提交后的重定向路径。

  下面的代码通过应用 hook_form_alter(),判断当表单ID为"story_node_form"时,设置表单的重定向属性(#redirect

普通分类: 
shiping1 的头像

WYSIWYG 字段 禁用富文本编辑器

下面的方法 应该是好的
<?php
function my_module_form_alter($form_id, &$form) {
普通分类: 
shiping1 的头像

清理处理垃圾节点和评论模块

1)本来后台 就可 内容管理 和垃圾管理功能
2)有第三方模块 Antispam,Mollom,Spam可以自动对垃圾文件进行判断,
Mollom 与 CAPCHA 验证码模块一起使用,可以防止机器人登录
普通分类: 
shiping1 的头像

通过PEAR安装Drupal命令行工具Drush

通过PEAR安装Drupal命令行工具Drush

Drupal命令行工具Drush

普通分类: 
shiping1 的头像

Windows linux 上面安装Drush

shiping1 的头像

Drush 原理与应用





普通分类: 
shiping1 的头像

安装DRUSH 遇到的问题以及解决办法

安装DRUSH 遇到的问题以及解决办法

今天在本机安装drush-6.x-3.3,遇到了一些问题,还好搜出了解决方法。

本机 Ubuntu 10.04

下载安装drush-6.x-3.3

普通分类: 
shiping1 的头像

drush 下载的地方

页面

Subscribe to RSS - drupal