searchRows & _link

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

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

By Dave - September 6, 2017

Hi petrogus, 

I wanted to check if you got this resolved yet?  If not, let me know how you want to decide if the link is to product.php, news.php, etc.

Perhaps you have a field such as 'type' that lists the type of article then you could show the links like this: 

<?php
  $customLink = $record['_link']; // use default if no other option available
  if ($record['type'] == 'article') { $customLink = "/article.php?article=" . $record['num']; }
  if ($record['type'] == 'news')    { $customLink = "/news.php?article=" . $record['num']; }
?>

<a href="<?php echo $customLink; ?>"><strong><?php echo $record['_title'] ?></strong></a><br/>

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com