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

这里的技术是共享的

You are here

drupal

shiping1 的头像

drupal7 移除 css js 文件

function THEME_NAME_css_alter(&$css)
{
    unset($css[drupal_get_path('module', 'system').'/system.theme.css']);
    unset($css[drupal_get_path('module','system').'/system.base.css']);
    unset($css[drupal_get_path('module', 'system').'/system.messages.css']);
    unset($css[drupal_get_path('module', 'comment').'/comment.css']);
    unset($css[drupal_get_path('module', 'field').'/theme/field.css']);
    unset($css[drupal_get_path('module', 'mollom').'/mollom.css']);

普通分类: 
shiping1 的头像

drupal 自定义上传 使用upload模块的功能

1)给某种类型的节点 定义一个表单 
function upload_jiangyi_form(&$form_state, $node) {
  global $user;
  $node = (object)$node;
  $form['nid'] = array(
    '#type' => 'hidden',
    '#default_value' => $node->nid,
  );
  // Set the id of the top-level form tag
  $form['#id'] = 'node-form';

  // Basic node information.
  // These elements are just values so they are not even sent to the client.
 
  // Changed must be sent to the client, for later overwrite error checking.
普通分类: 
shiping1 的头像

drupal 学习有用

example module真是神器。
file_example.module  文件上传的例子
普通分类: 
shiping1 的头像

Drupal 模块开发实例之二:自定义文件上传

Drupal 模块开发实例之二:自定义文件上传


本篇教程主要讲解如何通过 Drupal 表单系统上传文件,涉及到的主要接口在 includes/form.inc 和 includes/file.inc 文件中,核心函数即file_save_upload,该函数实现文件的移动、验证、保存、入库。

系统自带 files 表,用做存储文件相关信息,所以,这个简单的实例,就不需要另外创建数据表。如果复杂的应用,比如让文件和节点关联等等,就需要创建数据表了。

模块名称:myfile。
实现功能:定义一个页面,生成一个表单,让用户可以上传文件。
权限设置:暂不设置

普通分类: 
shiping1 的头像

How do I alter the form submission handler? hook form submit alter

普通分类: 
shiping1 的头像

view 视图 内容为空时 应出现的文字

视图bijibyjiaocheng, 显示节点类型的条目.
普通分类: 
shiping1 的头像

php 视图参数例子2 views parameter 这种方法好像不对 可以不看

普通分类: 
shiping1 的头像

根据角色名得到角色id rolename roleid rid 有大用

This is quite straightforward with user_roles() and array_search(). Below is a function which will return the role ID if there is a role matching the name and FALSE otherwise.

普通分类: 
shiping1 的头像

php 视图参数例子 views parameter 有大用






普通分类: 
shiping1 的头像

drupal 主题 函数例子 theme_item_list theme_links l 函数

下面这在个函数默认都会给当前的路径加上 class为active的属性
1)theme_item_list
  
表示 输出一个 ul 其 class='item_list'
其中 li 里面的东西就是 $links

$query = "select nid,title,created from {node}";
             $queryResult = db_query_range($query, 0 ,10);
             $links = array();
             while ($node = db_fetch_object($queryResult))
             {
                 $links[] = l($node->title,'node/'.$node->nid);
             }
普通分类: 
shiping1 的头像

drupal判断当前页面是否为首页_drupal常用判断语句

drupal判断当前页面是否为首页_drupal常用判断语句

 

xiaopang

普通分类: 
shiping1 的头像

判断用户是否管理员角色 得到 权限 有大用 有大大用

判断用户是否管理员角色。


在模板文件中 用   $is_admin  来判断是否是管理员
在template.php文件中 用   $variables['is_admin']   来判断是否是管理员
在模块文件中好像不行用 好像不能用   用这个吧  if(user_access('access administration pages')){ //这个绝对可以

普通分类: 
shiping1 的头像

Drupal ajax jquery 简单应用

Drupal ajax jquery 简单应用

 
 

Drupal结合ajax可以实现很多特出的功能,ajax功能强大,客户体验效果好。
因此比较流行。简单实用ajax来调用生成好的drupal form.
主要使用到hook menu drupal_get_form 还有hook_form

普通分类: 
shiping1 的头像

admin/build/block/list 默认显示哪个主题的区块

当admin/build/themes  默认 选择哪个主题 的时候
它 admin/build/block/list  就默认显示哪个主题的区块
普通分类: 
shiping1 的头像

views 的自定义文本 放onclick style 会被过滤掉的解决办法

三种方法
1)覆写views的模板文件 这个有点麻烦
普通分类: 
shiping1 的头像

drupal wysiwyg ckeditor 内容里的style样式丢失

1)我们编辑body的时候 使用 Full html
内容里的style样式就不会丢失


admin/settings/wysiwyg/profile/2/edit 这个是Full html
admin/settings/wysiwyg/profile/1/edit 这个是filter html





还有要注意的是
admin/settings/filters
它也是关于样式的 是否过滤掉标签(或其它的东西)的功能
普通分类: 
shiping1 的头像

drupal ajax 分页的例子

下面几个文件组成一个模块 为 shipingzhongmymodule 就可以实现ajax 分页的例子的功能
下面的模块是drupal6 完全是好的
普通分类: 
shiping1 的头像

theme('table' theme_table例子

function _shipingzhongmymodule_test_pager_callback () {
    header("Content-type: text/html");
    header("Expires: Wed, 29 Jan 1975 04:15:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    
普通分类: 
shiping1 的头像

Drupal 6:Statistics模块 网站访问统计

普通分类: 
shiping1 的头像

admin/user/settings 用户设置 配置默认用户行为,包括注册必要信息、E-Mail 以及用户图片。

admin/user/settings  用户设置     配置默认用户行为,包括注册必要信息、E-Mail 以及用户图片。

取得默认头像的程序 modules/user/user.module 大约827行
$picture = variable_get('user_picture_default', '');
普通分类: 
shiping1 的头像

Drupal7基础教程--用户(一)

Drupal7基础教程--用户(一)

作者:大漠 日期:2011-04-02 点击:3579

用户注册(User Registration)

Drupal提供了几种注册用户的方法:

1、管理员的邀请

2、访客的注册,但需要管理员的审批

3、任何访客

访客可注册你的网站的会员,可以点击首页的"User Login”block中的"Create new account”,如下图所示:

普通分类: 
shiping1 的头像

views 选择父分类 如何带出子分类的节点node

1) 在过滤器中 选择 Has taxonomy terms (with depth) 带深度的
普通分类: 
shiping1 的头像

怎么使用联动地址下拉列表作为Exposed Filter

怎么使用联动地址下拉列表作为Exposed Filter

赞成!
0
否决!

我的一个内容类型添加了地址字段,用的是China_address_field, 我想在

普通分类: 
shiping1 的头像

取得用户信息 包括其它的 如个人信息 有大用

<?php global $user; $user = user_load($user->uid); ?>
<?php //global $user; //$user = user_load($user->uid);var_dump($user);//为什么还要user_load一次 个人用户信息才全取到
?>

//如果以上user_load($user->uid);还不行的话 下面下面的方法就可以了  profile_load_profile()这个函数是引用指向的

 //加载了自定义信息的字段
 profile_load_profile($user);
 
普通分类: 
shiping1 的头像

drupal 用户导入 user_import 模块

由于 user_import 对中文不太友好  我们到    http://shipingzhong.cn/node/1119 可以导中文 (它导节点 导用户都可以)
1)安装 启用 User Import   https://drupal.org/project/user_import
2)https://drupal.org/node/137653 里面有详细的说明
3)admin/user/user_import 到这里
4)上传如相格式的csv文件 csv文件为utf-8的格式
普通分类: 
shiping1 的头像

drupal form 增加 class

$form['#attributes'] = array('class' => 'search-form');
普通分类: 
shiping1 的头像

未注册用户 普通用户 匿名用户 要想让 user/login 的 theme info themer developer 起作用 要把权限里的未注册用户 和 注册用户里关于themer developer的权限开启 有大用 有大大用

普通分类: 
shiping1 的头像

登录模板文件

page-user-login.tpl.php < page-user.tpl.php < page.tpl.php
普通分类: 
shiping1 的头像

d7 drupal7 d6 drupal6 表单里面 添加文本文字 text html 标签元素 drupal form drupal_get_form 用markup元素 有大用 有大大用

drupal6 d6 

$form['new_row_wrapper'] = array(
    '#type' => 'markup',
    '#value' => '<br><div id="ahah-example-new-row-wrapper" style="clear: both;"></div>',
  );


添加链接也是用markup 
/node-admin/1809




drupal7 d7

普通分类: 
shiping1 的头像

drupal 给其它的用户赋予角色的模块

Role Delegation


这个模块 可以分配角色给其它的用户 仅仅是给其它的用户赋予角色 没有其它功能

1)安装 启用它
2)到权限页面 可以看到 

Role Delegation role_delegation 模块

assign all roles  这个是可以分配所有角色
assign  .... roles 就可 某个特定的角色


assign all roles
administer permissions  (管理权限)
这两个权限最好去掉

就给 角色分配权限吧
3) 用户就可以 user/用户id/roles 来访问页面了 
这个 用户id 并不一定是本人id 而是其它用户的id
(如果没有权限访问看下面的代码)
//看role_delegation.module
普通分类: 

页面

Subscribe to RSS - drupal