drupal-views

Creating list of similar nodes in Drupal 7/Views 3

安稳与你 提交于 2019-11-28 15:16:38
Copy from drupal.stackexchange.com hoping to get more answers here: I face a rather common problem of displaying a list of nodes similar to current one. Similar node is defined as one having at least one taxonomy term that current node has. There are few solutions available as modules, however the modules I've found (specifically Similar By Terms) are in beta stage (as in "not working properly") for Drupal 7. I've also found a couple of solutions based on Views and contextual filters (such as http://scito.ch/content/show-related-nodes-block-based-taxonomy-terms-views-3-and-drupal-7 ) or

print_r to get object methods in PHP?

放肆的年华 提交于 2019-11-28 13:39:23
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? I believe you're looking for get_class_methods . If this is the case, get_class_vars may also interest you. 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-depth examples. Besides the functions mentioned by Mathachew you can also take a look at Reflection , especially

Drupal Views: Display recent nodes created by user on profile page

梦想与她 提交于 2019-11-27 20:29:09
问题 I'm wondering how I can display the recently created nodes by a user on their profile page. I've created a new page for a user at /user/%user and I want to be able to display the latest nodes created by that user. 回答1: ok, the answer involves creating a drupal view, so you will need the views module and although simple, the answer is lengthy. please bear with me through this... :) (i am actually doing this on a test site as i write the instructions, to make sure i dont miss anything...) i

OR operator in Drupal View Filters

送分小仙女□ 提交于 2019-11-27 17:53:41
问题 I need to implement an OR operator between some filters in a Drupal View. By default, Drupal AND's every filter together. By using hook_views_query_alter(&$view, &$query) I can access the query ( var $query ) , and I can change either : $query->where[0]['type'] to 'OR', or $query->group_operator to 'OR' The problem is however, that I do not need OR's everywhere. I've tried changing both of them to OR seperately, and it doesn't yield the desired result. It seems changing those values, puts OR

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

How to quickly theme a view?

霸气de小男生 提交于 2019-11-27 10:15:52
I've defined a view with the CCK and View 2 modules. I would like to quickly define a template specific to this view. Is there any tutorial or information on this? What are the files I need to modify? Here are my findings: (Edited) In fact, there are two ways to theme a view: the " field " way and the " node " way. In "edit View", you can choose " Row style: Node ", or " Row style: Fields ". with the " Node " way, you can create a node-contentname.tpl.php which will be called for each node in the view. You'll have access to your cck field values with $field_name[0]['value']. (edit2) You can

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 quickly theme a view?

孤者浪人 提交于 2019-11-27 04:01:48
问题 I've defined a view with the CCK and View 2 modules. I would like to quickly define a template specific to this view. Is there any tutorial or information on this? What are the files I need to modify? Here are my findings: (Edited) In fact, there are two ways to theme a view: the " field " way and the " node " way. In "edit View", you can choose " Row style: Node ", or " Row style: Fields ". with the " Node " way, you can create a node-contentname.tpl.php which will be called for each node in