drupal-views

Fundamental understanding of how Views and Pathauto work together

廉价感情. 提交于 2019-12-04 03:09:25
I am having fundamental problems understanding when to use a pathauto rule, and when to use a views page path. I have several custom content types, and I am using blocks to display certain parts of nodes on certain paths. Then I use a views page to display the main node on a path. When I do this, I can't use pathauto, as it overrides the paths I set in views. Eg.. If I set up a views page path of "location/%", and set a pathauto rule for Location content types of "location/[title-raw]", when I browse to mysite.com/location/mylocation pathauto wins, and simply displays the full node. And if I

Drupal 7 Views - list group by field

☆樱花仙子☆ 提交于 2019-12-03 21:13:38
问题 I have a View that list content of type Bio (the biographies of people). However, I would like to format it so that they are grouped under different headings. I added a new field to the Bios content type which is a dropdown list with three different options - Foo , Bar and Baz . What I want to do is display the people under the heading of their respective group. Currently: - John Doe - Jane Doe - Jack Doe - Juanita Doe - Jim Doe What I want: #Foo - John Doe - Jane Doe #Bar - Jack Doe -

Drupal return number of results in a View

僤鯓⒐⒋嵵緔 提交于 2019-12-03 11:50:49
问题 I have a view in Drupal that filters my content. It brings back 7 rows. All I want to return is the number or results returned(7). Is this possible? I tried using the View result counter but it returns a number for each results 1 2 3 4 5 6 7 I just need the 7 part. So in SQL I would do a select count(*) 回答1: what you can do is to activate php for the views header/footer and add the following snippet to it: <?php $view = views_get_current_view(); print $view->total_rows; ?> This will print the

Add Table Join, Where, and Order By to Views Query in views_query_alter()

别说谁变了你拦得住时间么 提交于 2019-12-03 08:39:09
I am trying to modify the query for Views in Drupal (Views version 3, Drupal version 7). What I want to do is change the query prior to running such that it LEFT JOINs a table in which I have weights assigned to the nodes. If I was to write the query I want in SQL, it would look like this: SELECT a.nid, a.title, a.description FROM node a LEFT OUTER JOIN node_weights b ON a.nid = b.nid WHERE b.uid = $uid ORDER BY b.weight DESC This query works like a champ when I run it in the query analyzer. So, now I need to make it work in my module. I've seen multiple approaches detailed on various blogs

Drupal return number of results in a View

耗尽温柔 提交于 2019-12-03 02:17:40
I have a view in Drupal that filters my content. It brings back 7 rows. All I want to return is the number or results returned(7). Is this possible? I tried using the View result counter but it returns a number for each results 1 2 3 4 5 6 7 I just need the 7 part. So in SQL I would do a select count(*) what you can do is to activate php for the views header/footer and add the following snippet to it: <?php $view = views_get_current_view(); print $view->total_rows; ?> This will print the total number of rows. If you need the result as a field, you could use the "Views custom field" module ,

How to update my View in Drupal 8 without scrolling back to the top?

梦想与她 提交于 2019-12-02 17:02:28
问题 I'm trying to refresh my View in Drupal 8 without reloading the page with this code : (function ($, Drupal) { 'use strict'; setInterval(function() { $('.view-message-activity-stream-timeline-public').trigger('RefreshView'); }, 10000); })(jQuery, Drupal); It works. My problem : Each time the view is refreshed, that page scolls back to the top of the view. There is another problem with the refresh of the page. When I click the "Afficher plus" link at the bottom of the home page, page 2 appears

Drupal 7: Exposed filter on a post date

穿精又带淫゛_ 提交于 2019-12-02 14:28:00
问题 I have couple hundreds of articles on a website. I use a view to show excerpts and links to them on one page and I also have a pager that show 10 articles at the time. I need to add a dropdown with years [...,2008,2009...,2013]. If you select a year in the dropdown, then view should only display articles that were posted in that year. Years in the dropdown should be updated automatically if a new article added in 2013 for example, and thus the first year is the year of the first publication.

Drupal 7: Exposed filter on a post date

≯℡__Kan透↙ 提交于 2019-12-02 06:19:30
I have couple hundreds of articles on a website. I use a view to show excerpts and links to them on one page and I also have a pager that show 10 articles at the time. I need to add a dropdown with years [...,2008,2009...,2013]. If you select a year in the dropdown, then view should only display articles that were posted in that year. Years in the dropdown should be updated automatically if a new article added in 2013 for example, and thus the first year is the year of the first publication. Please suggest possible solutions. I think, you need to set exposed filter to the view list. The

How to update my view in Drupal 8 without going back to the first page?

♀尐吖头ヾ 提交于 2019-12-02 04:14:33
I'm trying to refresh my View in Drupal 8 without reloading the page with this code : (function ($, Drupal) { 'use strict'; setInterval(function() { $('.view-message-activity-stream-timeline-public').trigger('RefreshView'); }, 10000); })(jQuery, Drupal); My module : <?php /** * @file * Holds hook implementation for the Message Activity Stream module. */ use Drupal\Core\Entity\ContentEntityBase; use Drupal\group\Entity\Group; use Drupal\node\Entity\Node; use Drupal\comment\Entity\Comment; use Drupal\commerce_store\Entity\Store; use Drupal\commerce_product\Entity\Product; use Drupal\user\Entity

How can I work out this view?

我与影子孤独终老i 提交于 2019-12-02 04:01:32
问题 List -> l_user I have a List node that has a user-reference field ( l_user ). Story -> s-user I then have Story nodes that also have a user-reference field ( s_user ). There is no direct connection between List and Story . I want to add a view to List that lists all the stories that reference the same user that list references. Basically something like SELECT stories WHERE story.s_user = this list.l_user and l_user is the user referenced in the list this view is on. So far the view is being