searchRows & _link

4 posts by 2 authors in: Forums > CMS Builder
Last Post: September 6, 2017   (RSS)

By petrogus - August 13, 2017

Hi All,

I create a search page with the results,

                  <?php foreach ($searchRows as $record): ?>
                     <a href="<?php echo $record['_link'] ?>"><strong><?php echo $record['_title'] ?></strong></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: #999;" ><?php echo $record['_link'] ?></a><br/><br/>
                  <?php endforeach ?>

and the link of the results look like as /news.php?6

but I would like to appear as /news.php?article=6

Could you help ! thank you in advance

P.

PetroGus

By Dave - August 14, 2017

Hi petrogus, 

Try replacing this: 

<a href="<?php echo $record['_link'] ?>" 

With this: 

<a href="/news.php?article=<?php echo $record['num'] ?>

Let me know if that works for you!

Dave Edis - Senior Developer
interactivetools.com

By petrogus - August 27, 2017 - edited: August 27, 2017

Hi David,

it works but the problem is that I have different results on search page.

For example <?php echo $record['_link'] ?> show me links like products.php?7 or news.php?2 or article.php?4

I need to create links like products.php?article=7 or news.php?article=2 or article.php?article=4.
Different php page for each results.

thank you for your help

PetroGus