Passing Arguments from a paginated Drupal Views Page url - drupal-7

I have a page generated by Views which lists 5 Articles at a time. This view is paginated so that page 2 of this View will list the second batch of 5 Articles, page 3 will list the third batch of Articles, so on and so forth.
My question: is it somehow possible to extract fields from Articles listed on the page you're currently on, perhaps via the url? And I only want to them on the Articles being displayed by the page the viewer is currently on and not all the Articles.
My intent is to have a Views Block that would ...
determine what page of the paginated View above you're looking at
determine what Articles are listed on that specific page
aggregate and display the Taxonomy Terms of those listed Articles (Articles have a Taxonomy Term field) in the block
do all the above automatically as you change what page you're looking at
The way I'm going about this is to list all the the Taxonomy terms in a block which is relatively straightforward. What I can't figure out is how to filter it based on what Articles are being displayed to me in a paginated page.
I was thinking maybe this is possible to use it using the url of the paginated page which goes along this format: ?page=1, ?page=2, etc.
If anyone could just point me to the right direction, I would appreciate it. I'm also open to alternatives.

What if you created another display of the same view as your Article page view?
You could add a Relationship for the Taxonomy Terms and then the Fields in the block view would be the appropriate fields from the taxonomy terms. You'll want to setup the same Filters, Sort and Pager options for the two displays are the same. That way the results should match.
Then you might just want to hide the pager from the block view. You could do that through a custom template for that view display, or maybe a preprocess function that hides the pager for just your view, or maybe via CSS.

Related

Is there a way to add other columns to the list display in the page admin?

Currently, in the wagtail admin for a page, it lists the Order, Title, Updated, Page Type, and Status. I would like to add an extra column for a property from my custom page model.
I would have thought that if there isn't a built-in method, I could at least overextend a template, or simply append something to the page title?
My situation is that I have created a blog page that has a date field. It is only that I wish to show.
My google-fu has failed me entirely on finding an answer as I'm sure this must have been discussed before.
There isn't currently an 'official' way for customising the columns in the listing. However, for displaying the date alongside the page title, you could make use of the get_admin_display_title method added in Wagtail 1.8: http://docs.wagtail.io/en/latest/reference/pages/model_reference.html#wagtail.wagtailcore.models.Page.get_admin_display_title

rendering an AngularJS detail view within list view

I'm a little new to the AngularJS world, and I'm wondering what the best way is to show a resource detail view within a list view.
Given a path like /people, I would just show a list of people resources. If I were to navigate from one of those people to a url like people/john-doe, I can easily get a detail view and all the data associated with that person. But how can I do this without leaving the list view? I'd like to somehow append the detail to the list, or show it within the list, etc.
What you're describing is nested views, which isn't something that the regular ngRoute library does well. I advise you check out angular-ui router.

Drupal 7 taxonomy blocks using Views

I have different nodes to which I apply taxonomy terms.
I want to display two separate blocks:
The first block should list all the taxonomy terms (HTML list would be fine) and each should be clickable.
The second block should list all nodes that have the taxonomy term clicked on the first block.
How would I achieve that? I am using Drupal 7 and the Views module. Thanks in advance.
You need to 2 block views for this.
But create just 1 view and the second view is already there in your default drupal views.
Follow this steps:
Create a view.
Select "Taxonomy Terms" for "Show" from drop down.
Select the related taxonomy vocabulary for "of type".
Click on Create a Block.
Click on "save & exit".
This will create your first view block with the taxonomy terms.
Now for the second block which should display all the node related to the taxonomy terms.
you just have to enable a view which is "Taxonomy Term".Go down words in your drupal view list there you will find this view in a disable mode. you need to enable it.
Now just override the view as you want to see that node page to display all the content related to taxonomy terms.Select the fields and filters according to normal view creation as we do.
Create a page for this second block and give path as you like.
Now use Context module(download if you don't have right now) to show the taxonomy terms block on the path you have given for views.
(Hope you will be knowing how to use context if not just leave a comment i will guide you for that)

Drupal view with contextual filters returning blank screen

This is a very particular question so any input will be appreciated...
I'm using panels and views in a custom view template file in a drupal 7 site. The panel has a view embedded in it, as well as some extra content beneath. I have the view set with 3 contextual filters having taxonomy term pulled from url. This is working fine.
So if I go to something like
/search/ford/red
It will successfully pull all items having taxonomy term "ford" that also have taxonomy term "red" applied.
But interestingly enough, if I change one of the terms to something that exists in the vocabulary, but does not happen to have any relation to items that successfully pass the first criteria, it will just load the site wrapper with the panel blank. No errors of any kind, search filter box disappears, pagination disappears, even the other content embedded in the view disappears.
It doesn't seem to matter what I choose for "Action to take if filter value does not validate" for any or all of the filters applied to the view. I tried to set it to show no results, but I assumed it didn't apply since I am also using a custom template file for the view.
I expect it to show no results. But I also expect it to have the search bar up top so the user can select a different filter from the menu, as well as the other content embedded in the view.
The search box is custom to the view template file. The only reason it would not show is if the view itself does not load. In this case it looks like the whole panel is not showing.
Feel free to ask for specifics if this is not enough to go on. Thanks.
for future readers experiencing the many unexplained holes in drupal, here is the complete hack I had to do to prevent this unannounced error:
In my custom view I had to check the size of $view->result and then redefine it if empty:
<?php if(sizeof($view->result) < 1): $view->result = array(0 => array()); ?>
<div class="no-results">
There are no results.
</div>
<?php else: ?>
--- normal view loop here ---
<?php endif; ?>
No, simply adding a count provision to the result loop was not working. I don't know how drupal processes the views, but if I allowed the result array to be empty it would not display the contents of this panel.
Down side - It still doesn't display any of the other content embedded in this panel, so if I had another embedded view beneath this one it would mysteriously vanish.
Oh well, I'll just tell the admins they can't populate this page with anything but a filterable index. Phooey, but that's drupal life... POS.

Drupal - 7 category/taxonomy with nodes in block

I am new in drupal 7 and I want to create one view blog in which I can list out taxonomy as category and in under that I want to display two articles and a read more link to that category. Can any one explain in details how can i do that.
If you use a content type with a Term reference field for your category, it wil automatically create pages for each category with the articles tagged with that category listed within it.
If you want to have more control over these pages generated by the Taxonomy module, you can turn on the Taxonomy Term example view in de Views UI and add and remove the fields you want to display. The layout of these pages can be edited by creating a custom template file in you themes template folder for the file page--taxonomy.tpl.php.
There you could als create an additional block display (I assume you mean block when you say blog), and in the Page settings area, you can turn on de More link, and this will display a more link when more articles are available then you have set you pager to display (i.e. Use pager - Display a specified number of items - Items per page = 2). Make sure you change de setting from For all displays to This block (override) to not override the other displays.
This block you can place in any region on any page via the Blocks UI and is should do what you want.

Resources