drupal-views

Supplying a predefined list of options for an exposed item in a view in Drupal?

℡╲_俬逩灬. 提交于 2019-12-13 06:52:51
问题 I've got a view that filters by year. The year is a normal text CCK field on the content type. I've exposed this field in the view, so that the user can type in a value for it. E.g. 2010. It will then show all the content types with the field set to 2010. My problem is, I don't want the user to type in the value. I want to change that text field to a dropdown with several years. My options are: Hack it with JQuery --> VERY BAD Edit the exposed value using some hook or something BEFORE it's

Views doesn't show checkbox fields where answer > 1

橙三吉。 提交于 2019-12-13 03:39:32
问题 I am using Drupal with Views and the extended profiles module activated. To enable users to check multiple areas of interest I also added a module called Profile Checkboxes. It adds the ability to use a free-form list but turns it into either check boxes or radio buttons. This module works very cleanly and did not present errors. But if a user check multiple interests then those are stored in the profile_values table as a comma seperated value. So if the user likes lets say cars, trucks and

Loading views_accordion through an ajax request

故事扮演 提交于 2019-12-13 02:56:08
问题 I am currently loading my view through an ajax request in my custom module: $.getJSON('/reports/summarized-progress/get_output_activities/'+nid, null,activities); The drupal page for the above request returns the following: $output_arg=arg(3); $html=""; $activities=views_embed_view('activities','block_activities',$output_arg); //this returns a view accordion view if(!empty($activities)) { $html.=''; $html.=$activities; $html.=''; } drupal_json_output(array('data'=>$html)); The accordion

Drupal View display - setting a limit for the query results

血红的双手。 提交于 2019-12-12 12:31:07
问题 I have a View set to grab the latest forum posts. That's working fine, but I'd like to limit it to get the last 5 records only. I know I can display only 5 with PHP but I don't want a larger query than I need. I can't find any option for this in the View. thanks 回答1: Yep. There is an option that limits it called 'Items to display:' under Basic Settings. 来源: https://stackoverflow.com/questions/2566958/drupal-view-display-setting-a-limit-for-the-query-results

$view->total_rows is wrong (sort of), I want “Items to display”

天涯浪子 提交于 2019-12-12 03:57:20
问题 The " total_rows " property of my view returns the total rows (22), but not the number of items I have set the view to display (5) (through the Web UI Block -> Basic Settings ). How can I get this in a proper way without relying on (the possibly soon to be deprecated " result " property? for now Im using $totalRows = min($view->total_rows, count($view->result)); 回答1: This is always available as: $view->display['your_display']->display_options['items_per_page'] where your_display is replaced

Drupal - Modify tabs added to user page by Views

半腔热情 提交于 2019-12-12 02:53:37
问题 I've added a number of new tabs to the user page, using Views (as a page with menu tab settings etc.). What I now want to do is remove them if the viewed user is the current, logged in user. Prior to adding some user filtering, my first problem is that I just can't seem to modify these tabs at all. I know the general procedure is to use HOOK_MENU_ALTER and (for example): $items['user/%user/view']['type'] = MENU_CALLBACK; This works fine for the original tabs, but not for tabs added with Views

Way to display those nodes in a view that are related to any other node of a different type

不打扰是莪最后的温柔 提交于 2019-12-11 19:28:45
问题 I have two content types - "Blog" and "News". I am using a reference field to relate blog nodes to news nodes. Now, for the news landing page, I need a block view that displays "Related blogs" i.e. it lists blogs that are related to any news node. The news landing page is a panel page with a main view that lists all news nodes. The "Related blogs" block will be placed below the main block. Is there a way to achieve this "Related blogs" block using views? I am using Drupal7 and I am free to

Drupal 7: how to filter view content (with entity reference field) based on current page content

被刻印的时光 ゝ 提交于 2019-12-11 10:22:44
问题 in my drupal 7 I have 2 content-types like these: ContentA ContentB (with a field Entity Reference to ContentA) In the front-end detail page of ContentA, I would love to show a block/view with a list of ContentB whose Entity Reference field is set to the current ContentA. I made a view of type Block and added it correctly to the page, but I cannot filter ContentB based on the current ContentA. Could you help me? Thanks 回答1: You should add a contextual filter for the value you will use for

Create a Drupal view with a list of top voted nodes by month

﹥>﹥吖頭↗ 提交于 2019-12-11 07:36:31
问题 I'm using the Drupal 6 Views module to request for top nodes rated using the fivestar module. However, I can't seem to find out how I can create a view to request for the top voted node for each month and display them on a list. What I'd like as a result is a list like this: January 2011: Most voted node title an link to that node December 2010: Most voted node title an link to that node November 2010: Most voted node title an link to that node ... I'm not even sure this is possible using

drupal views facebook like button

亡梦爱人 提交于 2019-12-11 06:55:11
问题 I tried to add facebook like button to my veiws, which lists a particular node-type. I used views custom field module to add the iframe code. The problem is when I click like.. it shows Nikhil liked http://example.com/node/44 instead it should have shown Nikhil liked node title on example.com . Where am I going wrong. 回答1: Use Open Graph tags: http://developers.facebook.com/docs/reference/plugins/like 回答2: oK , well I was able to achieve the above feature by following methods: Created a cck