Multisearch and permalinks

By Jesus - March 28, 2015

Hi,

Any ideas on how can I fix this? I'm seeing my database and it has the permalink value on it, I just can't display it.

Thanks for pointing me to the right direction here.

Jesus

By gregThomas - March 31, 2015

Hey Jesus, 

There is a way you can retrieve that value, the searchMultipleTables allows you to retrieve up to 10 fields per table in special fieldX keys. Here is an example of how to use them using a test blog section I've created:

<!-- STEP1: Load Record List (Paste this above other steps) -->
    <?php
      require_once "cmsb/lib/viewer_functions.php";
      $searchOptions = array();
      $searchOptions['keywords'] = @$_REQUEST['q'];
      $searchOptions['perPage']  = "10";
      $searchOptions['debugSql'] = "1";

      $searchTables = array();
      $searchTables['blog'] = array(
        'viewerUrl'       => 'blog.php',
        'titleField'      => 'title',
        'summaryField'    => 'content',
        'searchFields'    =>  array('title','content'),
        'useSeoUrls'      => true,
        'field1'          => 'permalink'
      );

      list($searchRows, $searchDetails) = searchMultipleTables($searchTables, $searchOptions);
    ?>
  <!-- /STEP1: Load Record List -->




<!-- show errors -->
    <?php if ($searchDetails['invalidPageNum']): ?>
      Results page '<?php echo $searchDetails['page']?>' not found, <a href="<?php echo $searchDetails['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/>
    <?php elseif ($searchOptions['keywords'] && $searchDetails['noRecordsFound']): ?>
      No records matched search query!<br/><br/>
    <?php elseif ($searchOptions['keywords'] == ""): ?>
      Enter a keyword to search.<br/><br/>
    <?php endif ?>

<!-- STEP2: Display Record List -->
  <?php foreach ($searchRows as $record): ?>
  <?php showme($record); ?>
     <a href="/<?php echo $record['field1'] ?>"><?php echo $record['_title'] ?></a><br/>
     <?php if ($record['_summary']): ?>
       <?php echo $record['_summary'] ?><br/>
      <?php else: ?>
        No description available for page.<br/>
      <?php endif ?>
     <a href="/<?php echo $record['field1'] ?>" style="color: #008000"><?php echo $record['field1'] ?></a><br/><br/>
  <?php endforeach ?>
  <!-- /STEP2: Display Record List -->

So you can have field1 - 10, and return up to 10 fields per table if you need. These fields are always returned, so it doesn't matter if you're only using one of the variables for a particular section. 

Let me know if you have any questions.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Jesus - March 31, 2015

Awesome Greg,

Let me try it!