Hot answers tagged

17

I can't (yet) answer your question, but I can see where I think it's going wrong. The Views JS is loading for your site, but the Views classes aren't being applied the same on your site and the test I'm using. I expect if you swap to another theme, you'll see the View start working. (That doesn't mean you need to abandon your theme, but it may help you ...


13

There are some examples on drupal.org of adding a pager to the page, if you want to use the one that core uses: https://api.drupal.org/api/drupal/core%21includes%21pager.inc/function/pager_default_initialize/8.2.x The second example should work for you: $page = pager_find_page(); $num_per_page = \Drupal::config('mymodule.settings')->get('...


12

This can have a whole bunch of reasons. I'm just providing the imho most probable non-obvious one: Go to "pager settings" (on your screenshot click "Paged, 5 items") and change the "pager id". Docs say this is only needed when there is more than one view on a page, but i saw live examples where this fixed a non-showing pager on a single-view page.


11

I came across this issue recently since upgrading to views 3.8. for me the issue was caused by views_php module as discussed here: https://www.drupal.org/node/2276165 there is also a patch available to fix it.


10

Views comes with a nice default glossary view out of the box. Go to /structure/views/view/glossary/edit, enable it and set it to filter for your content type. viola. And in case you are wondering where the Magic happens then you would find it in the contextual filter MORE options.


9

Yes, you can do that with Views. In the pager settings for the View, select to expose the number of items to the user. Make sure the textfield with available items per page options includes the default number of items per page.


9

Try some thing like this and see if it helps function views_pag_views_pre_build(&$view) { if ($view->name == "pagination") { $view->init_pager(); $view->set_items_per_page('10'); } }


8

After researching for quite some time, I´ve found this reply in the Omega issue queue that gave me the answer. Even when the answer has nothing to do with the theme layer. In short: When this happens to you, it´s probably because the pager is conflicting with a views block with it´s own pager activated, all in the same page. You actually fix this by giving ...


8

I suspect the only thing you're missing is adding the return from theme('pager') to the content you're building. This is a small example that shows teasers for all nodes in the system, with 10 per page. You would use this in a page callback function: $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node') ->pager(10); $...


7

Does pager(10) in EntityFieldQuery automatically invoke the pager? Yes; it even avoids the usual problem of multiple pagers on a single page conflicting, by getting a new delta from the PagerDefault class. Should it be displayed with print(theme('pager'))? Yes (but obviously only if there is more than one page worth of results to display). Is this ...


7

The object returned from $views->pager() is an object implementing ViewsPluginInterface and extending PagerPluginBase. If you look at the parameters PagerPluginBase::render() accepts, you will see they are: $input: Any extra GET parameters that should be retained, such as exposed input. If you look at Full::render(), you have an idea of how that ...


6

You can configure each block's pager to have a different pager ID and then they will/should only update the one you clicked on.


6

With the existing pager class I don't think you can get that data without running the count query again. The total count is queried directly and saved to a local var before being passed off to pager_default_initialize()...it's not saved anywhere. One option would be to extend the default class and use that for your pager queries. This is un-tested but I ...


6

No it's not detrimental (well, not in the way you're thinking at least) - the standard pager links are hidden with infinite scroll, but still in the markup, so there's no problem from that perspective. Google will find and visit the subsequent pages as with a normal views pager. The only question is whether Google apply some sort of penalty to the pages ...


6

/** * Implements hook_block_info(). */ function custommodule_block_info() { $blocks = array(); $blocks['latest_news'] = array( 'info' => t('Latest News'), 'cache' => DRUPAL_NO_CACHE, ); return $blocks; } /** * Implements hook_block_view(). */ function custommodule_block_view($delta = '') { $block = array(); ...


6

As pointed out in my comment above, most of the details are wrong in your implementation above. Fortunately in Drupal 7, there are six theming functions for the pager: theme_pager() theme_pager_first() theme_pager_link() theme_pager_last() theme_pager_previous() theme_pager_next() These should allow you to make most of the customizations that you need. ...


6

As of now there is no way to display total page count in views rest export. But you can get total pages, current page, items per page and total number of items using new custom style in your custom module which extends existing Serializer class as shown below: <?php namespace Drupal\custom_module\Plugin\views\style; use Drupal\rest\Plugin\views\style\...


5

In Pager options There is a field named Pager ID. Setting a different value for each view should solve the problem.


5

Yes. See drupal_page_get_cache() in bootstrap.inc: if (drupal_page_is_cacheable()) { $cache = cache_get($base_root . request_uri(), 'cache_page'); if ($cache !== FALSE) { $cache_hit = TRUE; } return $cache; } request_uri() returns the whole path including any GET arguments.


5

extend() isn't chain-able, it returns a new extended query object, so you need to assign the result back to the query object, e.g. $query = $query->extend('PagerDefault')->limit(10); Otherwise the query won't actually be extended and won't have the limit() method, hence the error you're getting.


5

You need to override theme_pager function in your template.php You need to do couple of changes, Use global $pager_limits variable, use in pager list rendering links to alter text data Use below code which works function YOURTHEMENAME_pager($variables) { $tags = $variables['tags']; $element = $variables['element']; $parameters = $variables['...


5

You can achieve pager using View Slideshow by following steps: Step 1: In view, add Global: View result counter field and mark it as Exclude from display. Step 2: Now click on Slideshow format settings, go to Pager part and select Global: View result counter field as a Pager Type. Step 3: To give perfect bullets effect, you will have add some CSS as ...


4

Your query with the GROUP BY is incorrect, MySQL is lax enough to let you write this kind of queries but it is by no way recommended. When you use a GROUP BY clause you should group all the columns without an aggregate function. Also if you put a GROUP BY in your query, you should also include it in your count query. Generally a brutal way to make the count ...


4

The best way to achieve this is to create a separate page display for all content on a single page. Then add a Footer to the title display with a link to the full page display.


4

Also been having some trouble with this - debugging statements initializePager showed that the optional $element parameter was being set to 1 rather than 0. If there is only one pager being displayed, try setting it explicitly to 0. $query->pager(10, 0);


4

First check which Drupal version you are using if using Drupal 7 the use see below given example <?php $result = db_select('table_name', 'table_alias') ->fields('table_alias',array('column_name1', 'column_name2', 'column_name1', .....))//SELECT the fields from user ->condition('type', 'article') ->extend('PagerDefault') ->...


4

Have you looked at theme_pager_link in Drupal 7. Your site's theme can customize any pager link by implementing YOURTHEME_pager_link and then add additional logic into a copied version of that function to embed anchors as needed. You can probably embed the anchor as a parameter to the link to be inserted into the querystring: parameters: An associative ...


4

The following steps might help you to extract the pager out of a view conatiner with a help of small css fix, 1 : Override the view template file I have created a view called extract pager and created a custom tpl for the same views-view--extract-pagertpl.php 2 : The data-members for pager will be available in the above tpl file copy and place the code ...


4

Have you investigated the Page Title module? It, among other things, features Pagination Suffix: One of the things you may noticed about Drupal in terms of SEO is that whenever you go through a paged list of content, the page title never changes. Google Webmaster Tools will flag this up as a problem as you essentially have several different pages all ...


4

It would seem that at the point you're trying to modify the quantity, the pager items have already been generated so your quantity value doesn't have any effect. Similar to Drupal 7, I believe you're going to need to implement the full pager function, just copying the core pager function to your theme and changing the quantity. function ...


Only top voted, non community-wiki answers of a minimum length are eligible