Is there a better way to link?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 28, 2013   (RSS)

By Jason - June 27, 2013

Hi Tim,

Your process looks right.  The only issue you would run into is if they selected values in more than 1 drop down, your code would produce multiple links.  You can try this method that would eliminate that possibility:

<?php

  $pageName  = "";
  $recordNum = coalesce($record['article'], $record['report'], $record['event'], $record['pages']);
  
  if ($record['article']) {
    $pageName = "articleDetails.php";
  }
  elseif($record['report']) {
    $pageName = "reportDetails.php";
  }
  elseif($record['event']) {
    $pageName = "eventDetails.php";
  }
  else {
    $pageName = "pages.php";
  }
  
?>

<a href = "<?php echo $pageName;?>?num=<?php echo $recordNum;?>" class = "actionButton">Read More</a>

Hope this helps

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Toledoh - June 28, 2013

Cool - thanks for that!

Cheers,

Tim (toledoh.com.au)