0

I am working on a project in Drupal 7 and the pager is not working properly. It will display on the block but not on the page no matter what I do. I have even tried changing the pager_id and that yields no results what so ever. We are using Template files but it works on other pages just not this one. I have checked the settings and all seem identical.

I have googled until I am blue in the face and nothing I do seems to make it work. If someone could help it would be great this is driving me nuts!

Here are the settings I have Block enter image description here

Page enter image description here

   <?php
  global $base_url;

  $view = views_get_view('mylab');
  $view->set_display('page_1');
  $view->execute();
  $mylabs = $view->result;
?>
<div id="wrapper" class="page">
<header id="header">
  <div class="container">
    <div class="row">
      <div class="col-logo">
        <div class="logo">
          <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
            <img src="<?php print $logo; ?>" alt="<?php print t('Climate Advocacy Lab'); ?>" />
              </a>
            </div>
      </div>
      <div class="col-navigation">
        <div class="top-bar">
        <?php print render($page['header']); ?>
        </div>
        <div class="navigation">
          <?php print render($page['main_nav']); ?>
        </div>
      </div>
    </div>
  </div>
</header>
<div id="mobile-header">
  <div class="mobile-logo">
    <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home">
      <img src="<?php echo $base_url . '/' . drupal_get_path('theme', 'ClimateLab') . '/images/logo-mini.png' ; ?>" />
    </a>
  </div>
  <div class="tools">
    <?php if (!$logged_in): ?>
      <h5 class="guest-message">Become a member?</h5>
    <?php endif; ?>
    <div class="user-controls">
      <?php print render($page['header']); ?>
    </div>
    <div class="user-menu">
      <a class="menu-open" href="#">
        <img src="<?php echo $base_url . '/' . drupal_get_path('theme', 'ClimateLab') . '/images/menu-icon.png' ; ?>" />
      </a>
      <a class="menu-close" href="#">
        <img src="<?php echo $base_url . '/' . drupal_get_path('theme', 'ClimateLab ') . '/images/menu-icon-close.png' ; ?>" />
      </a>
      <?php print render($page['main_nav']); ?>
    </div>
  </div>
</div>
<main id="main" role="main" accesskey="s">
  <div class="system-message">
    <?php print $messages; ?>
  </div>
  <div class="before-content container">
    <?php if ($page['highlighted']):
      print render($page['highlighted']);
    endif; ?>

    <?php if ($tabs): ?>
      <div class="tabs-wr">
        <?php print render($tabs); ?>
      </div>
    <?php endif; ?>
    <?php print render($page['help']); ?>
    <?php if ($action_links): ?>
      <ul class="action-links">
        <?php print render($action_links); ?>
      </ul>
    <?php endif; ?>
  </div>
  <div id="content" class="container">
    <h1 class="page-title"><?php echo $title; ?></h1>
    <div class="above-body">
      <h2>Your favorite resources from the Lab all in one place.</h2>
    </div>
    <div id="resources-panel">
      <div class="resources-result">
         <p style="max-width:650px;">Select the "+MyLab" button next to items in the Resource Library and State-level Data tools for quick and easy access to your favorite resources, all in one place.</p>  
        <?php
          foreach ($mylabs as $item):
            $resource = node_load($item->nid);
        ?>
          <?php print _view_resource_node($resource); ?>
        <?php endforeach;?>
      </div>
      <?php  if ($pager) {  print $pager;   }else{ echo("NO PAGER");} ?>
        
    </div>
  </div>
</main>
</div>
11
  • Have you checked that it's not being hidden? Strip all CSS with a browser extension/tool, can you see the pager?
    – No Sssweat
    Commented Nov 10, 2020 at 9:23
  • CSS wasn't hiding it, I disabled all css and there was no button for loading for content at all. I have also done the header output as recommended on other sites and it is seeing the right number of records 5 of 24
    – The Gugaru
    Commented Nov 10, 2020 at 9:28
  • Check if a views-view--page.tpl.php file exists, that file should have <?php if ($pager) { ?> <?php print $pager; ?> <?php } ?>
    – No Sssweat
    Commented Nov 10, 2020 at 9:29
  • I put in an else to put out a string and there doesn't seem to be a pager. So now I am really lost
    – The Gugaru
    Commented Nov 10, 2020 at 9:40
  • This is how it's suppose to be
    – No Sssweat
    Commented Nov 10, 2020 at 9:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.