Per Page Issue

7 posts by 3 authors in: Forums > CMS Builder
Last Post: June 3, 2013   (RSS)

By s2smedia - May 30, 2013

U hve use the per page feature many times and nevr had an issue.. but for some reason.. only on homepage.. it is not working.. when I click next.. it takes me to a broken link:

http://tpanc.com/Athletics/index.php

Same code is being used here http://tpanc.com/Athletics/news.php and works perfectly.

By Steve99 - May 30, 2013

Hi,

Can you post your "load record" code?

Also, do you have any special rules in your htaccess file?

- Steve

By s2smedia - May 30, 2013

code below..

this works fine on the news page (same site) just not the  homepage

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

  // load viewer library
  $libraryPath = 'admin/lib/viewer_functions.php';
  $dirsToCheck = array('XXXXXXXXXXXX/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records
  list($news_eventsRecords, $news_eventsMetaData) = getRecords(array(
    'tableName'   => 'news_events',
 'perPage'     => '2',
  ));

?> 

<?php foreach ($news_eventsRecords as $record): ?>
      <div style="padding:15px; margin-bottom:20px; border-style:solid; border-color:#C13239; border-width:0px 0px 1px 0px">
       <b style="font-size:18px"><?php echo $record['title'] ?></b><br/>
      <span style="color:#C13239; font-size:14px; text-transform:uppercase"><?php echo date("M j", strtotime($record['date'])) ?></span><br/>
      
      <?php echo $record['content'] ?></div>
      <?php endforeach ?>
        <?php if (!$news_eventsRecords): ?>
      No News at this time<br/>
      <br/>
    <?php endif ?></div>
<div style="margin:20px 15px 20px 25px; text-align:center">  <?php if ($news_eventsMetaData['prevPage']): ?>
      <a href="<?php echo $news_eventsMetaData['prevPageLink'] ?>">&lt;&lt; prev</a>
    <?php else: ?>
      &lt;&lt; prev
    <?php endif ?>

    - page <?php echo $news_eventsMetaData['page'] ?> of <?php echo $news_eventsMetaData['totalPages'] ?> -

    <?php if ($news_eventsMetaData['nextPage']): ?>
      <a href="<?php echo $news_eventsMetaData['nextPageLink'] ?>">next &gt;&gt;</a>
    <?php else: ?>
      next &gt;&gt;
    <?php endif ?></div>

By Steve99 - May 30, 2013

Hi again,

So it's the exact same code? Everything looks proper to me in your code.

For your "prev" and "next" links, I see you are using the default CMSB setup. By any chance do you have your "list page" and "detail page" viewer URLs set in CMSB to be the news page? If so, you might want to try hard coding "news.php" and "index.php" in your "prev" and "next" links with the page var appended since it's being used in multiple areas of your site. I'm thinking there is some relation, give it a shot and let me know how you make out. Let me know if you have any questions.

- Steve

By gregThomas - May 31, 2013

Hi, 

Very odd! I've done a quick bit local testing but couldn't replicate the issue. Would it be possible to upload the full pages code? 

Thanks

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By gregThomas - June 3, 2013

Hi,

I've had a look at your code, but couldn't see anything that would stop the page system from working. Please could you fill out a second level support request for me? You can find the form here:

https://www.interactivetools.com/support/email_support_form.php

Then I can take a closer look at what might be causing the problem.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com