Multisearch and permalinks

By Jesus - March 24, 2015 - edited: March 24, 2015

Hi,

I'm trying to get the multisearch function to work but have an issue with permalinks, as I don't want to have urls on search results like this: (http://domainame.com/category/article-detail.php?4)

My code looks like this:

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

      $searchTables = array();
      $searchTables['ofertas'] = array(
        'viewerUrl'       => 'ofertas-detail.php',
        'titleField'      => 'title',
        'summaryField'    => 'texto_promo_social',
        'searchFields'    =>  array('title','content'),
        'useSeoUrls'       => true,
      );


      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['_link'] ?>"><?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['_link'] ?>" style="color: #008000"><?php echo $record['_link'] ?></a><br/><br/>
  <?php endforeach ?>
  <!-- /STEP2: Display Record List -->

As you can see, because of this line:

<a href="<?php echo $record['_link'] ?>" style="color: #008000"><?php echo $record['_link'] ?></a><br/><br/>

I'm receiving this kind of results

Article Name 4
Article Summary 4
http://domainame.com/category/article-detail.php?4

Article Name 6
Article Summary 6
http://domainame.com/category/article-detail.php?6

Article Name 8
Article Summary 8
http://domainame.com/category/articles-detail.php?8

Etc.

On my code generator, I'm seeing this line:

permalink: <?php echo htmlencode($record['permalink']) ?><br/>

and I'm just trying to replace it, 

<a href="<?php echo htmlencode($record['permalink']) ?>" style="color: #008000"><?php echo htmlencode($record['permalink']) ?></a><br/><br/>

with no luck, as I'm seeing a white line and then this message on my logs.

E_NOTICE: Undefined index: permalink
/path/to/my/domain/html/category/multiSearch.php (line 69)
http://domainname.com/category/multiSearch.php?q=anyquesry&null=Search

I want to have results like this:

I'm receiving this kind of results

Article Name 4
Article Summary 4
http://domainame.com/category/permalink-url/

Article Name 6
Article Summary 6
http://domainame.com/category/permalink-url/

Article Name 8
Article Summary 8
http://domainame.com/category/permalink-url/

Thanks for pointing me on the right direction.

Jesus

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 Jesus - March 31, 2015

Awesome Greg,

Let me try it!