Conflict with 'allowSearch' => false,

4 posts by 3 authors in: Forums > CMS Builder
Last Post: April 17, 2017   (RSS)

By ross - April 14, 2017

Hi Tim

Could you post a copy of the whole file so I can see your code in context?  

Feel free to email it to me directly if you don't want to have it online in our forums.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By gregThomas - April 17, 2017

Hey Tim,

My guess is that you're using the permalinks plugin on this page? If so, the issue is most likely to be that the permalinks plugin artificially sets the page num value in $_REQUEST['num']. Then when you set allowSearch to true, the page is only trying to load records that have the num value of the permalink. 

The simplest way around this is to add the following to your code:

//If the permalinks plugin has set the num value in the request, unset it.
if(isset($_REQUEST['num'])) { unset($_REQUEST['num']); }

//Load the panel data
list($panelsRecords, $panelsMetaData) = getRecords(array(
  'tableName'   => 'panels',
  'where'       => 'pagesNum =' .$selectedCategory['num'],
  'loadUploads' => true,
  'allowSearch' => false,
  'leftJoin'    => array('includes' => 'include'),
));

This will detect if the num has been set by the permalinks, and unset it before the getRecords function runs.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Toledoh - April 17, 2017

That works - thanks Greg!

Cheers,

Tim (toledoh.com.au)