drupal-6

Drupal behaviors

╄→尐↘猪︶ㄣ 提交于 2019-11-27 19:47:47
问题 What are Drupal behaviors at all? What type of service layer it offers to module developers? What type of relation it maps to jQuery.ready ? 回答1: Long version : Drupal.behaviors is not simply a replacement for jQuery.ready since the latter only runs once (when DOM is ready for manipulation): behaviors can be fired multiple times during page execution and can be run whenever new DOM elements are inserted into the document. Also, modules could override or extend an existing behavior (e.g. if

Can someone explain “access arguments” in Drupal?

好久不见. 提交于 2019-11-27 14:45:50
问题 Can someone explain "access arguments" in Drupal? Trust me I have tried Googling it but I am just not getting a clear grasp. 回答1: in /admin/user/permissions you will see lots of access options. they come from drupal modules, and lets the site administrator distribute specific permissions to user roles (drupal provides 'anonymous' and 'registered' roles by default). modules declare them through hook_perm and they are as easy to use as: function mymodulename_perm { return array('use custom

Drupal Views exposed filter of Author name as a drop down

有些话、适合烂在心里 提交于 2019-11-27 12:39:11
问题 This is a follow up question to Drupal Views exposed filter of Author name. The following question was answered and works. I can filter a view by user name. The user name is entered is entered by typing in a box and the box then auto completes. Rather then doing this I would like the list of users as a drop down. I only need one user to be selected. Do you know if this is possible? 回答1: You'll need a custom module for that. I've done this for Drupal 7 this way: create a module, say, views

print_r to get object methods in PHP?

ε祈祈猫儿з 提交于 2019-11-27 07:48:18
问题 I'm working with Views 2 in Drupal 6, and I am having difficulty finding documentation on the methods of the View object. Is there any PHP function like print_r that outputs methods as well as fields? 回答1: I believe you're looking for get_class_methods. If this is the case, get_class_vars may also interest you. 回答2: The Reflection API might be of interest to you (if it's not overkill). Specifically:- <?php Reflection::export(new ReflectionClass('View')); ?> Check out the manual for more in

How to redirect user to a specific page after they login if they belong to a certain role?

こ雲淡風輕ζ 提交于 2019-11-27 06:53:20
问题 We have certain users in our member list that have a role "vendor" attached to them. All such members are to be redirected to a certain page upon login. How can this be accomplished? 回答1: You can define actions and triggers in Drupal: Action( admin/settings/actions ) - Redirect to a specific page Trigger ( admin/build/trigger/user ) - After user has logged in Try this. EDIT (see comments): Create a small module to check on a user's login process what role he has and then redirect if neccesary

How do I use theme preprocessor functions for my own templates?

亡梦爱人 提交于 2019-11-27 04:16:18
问题 I have several .tpl.php files for nodes, CCK fields, and Views theming. These template files have a lot of logic in them to move things around, strip links, create new links, etc. I understand that this is bad development and not "The Drupal Way". If I understand correctly, "The Drupal Way" is to use preprocessor functions in your template.php file to manipulate variables and add new variables. A few questions about that: Is there a naming convention for creating a preprocessor function for a

Drupal: How to Render Results of Form on Same Page as Form

[亡魂溺海] 提交于 2019-11-27 03:31:09
问题 How would I print the results of a form submission on the same page as the form itself? Relevant hook_menu: $items['admin/content/ncbi_subsites/paths'] = array( 'title' => 'Paths', 'description' => 'Paths for a particular subsite', 'page callback' => 'ncbi_subsites_show_path_page', 'access arguments' => array( 'administer site configuration' ), 'type' => MENU_LOCAL_TASK, ); page callback: function ncbi_subsites_show_path_page() { $f = drupal_get_form('_ncbi_subsites_show_paths_form'); return

Drupal 6: best way to upgrade jQuery?

北战南征 提交于 2019-11-27 02:57:02
问题 I want to upgrade jQuery inside my drupal installation. At the moment I have jQuery 1.2.6 and I would like to upgrade it to jQuery 1.4 I guess some Drupal modules still depends on the old jQuery version. I've tried jquery_update module to upgrade jQuery, but it didn't work. It asked to replace the original Drupal files in the "misc" folder with the new ones, but it didn't work. Anyway, I was wondering if there is a better method instead of using another module thanks 回答1: the jquery update

How to solve the use of deprecated function ereg() of PHP 5.3.0 in Drupal 6.13

徘徊边缘 提交于 2019-11-26 21:54:26
问题 Anyone knows how to solve the error below? Deprecated: Function ereg() is deprecated in C:\wamp\www\includes\file.inc on line 895 It is happening after installing Drupal 6.13 on wamp server 2.0i with PHP 5.3.0 回答1: Drop your error reporting level below E_DEPRECATED. PHP 5.3 introduced two new error reporting levels, E_DEPRECATED and E_USER_DEPRECATED and - for the first time in PHP's history - they've started to walk away from older parts of their API. The ereg_* function will still work, but

Drupal: how to access to Drupal's APIs with a standalone php script?

十年热恋 提交于 2019-11-26 21:18:43
问题 When I create a new script in a separate php file to run for Drupal, I need to add the following lines on top in order to access all Drupal APIs: require_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); Is this correct ? 回答1: Yep, I use this: /** bootstrap drupal **/ chdir("/path/to/drupal/site/htdocs"); require_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); And then just add whatever Drupal-specific code you need below that. 回答2: this