Relevant infromation with links

6 posts by 3 authors in: Forums > CMS Builder
Last Post: September 22, 2008   (RSS)

Hi

I am using the List value to select relevant information on each content item, I have the following that pulls the information from the database:

SELECT CONCAT_WS(" ", related_title, summary_short), CONCAT_WS(" ", related_title, summary_short) FROM cms_news

and the PHP value on the actual page that looks like this:
<a href="<?php echo $record['num'] ?>"><?php echo $record['related_news'] ?></a>

I cant seem to get the related new item to link through to that item,

Any suggestions
Cheers
Simon

Re: [sjenko] Relevant infromation with links

By Donna - September 18, 2008

Hi sjenko!

Thanks for your post. :)

It looks like your link is missing the actual filename that you're linking to, and it's instead just trying to link to a file called "4" (or whatever record number applies.)

So, you'll need to fill in the actual filename of the page you're linking to, for example:

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

If you're still having trouble, can you send me the link to the page that you're working with?
Donna

--
support@interactivetools.com

Re: [Donna] Relevant infromation with links

Hey Donna.

Thanks for the reply.

I have implemented what you suggested, which seems to work to a degree, apart from the related item is referencing the num value of the page its beingdisplayed on and not the value of itself.

Here is the code now:
<a href="../../../news/news_article.php/-<?php echo $record['num'] ?>/"><?php echo $record['related_news'] ?></a>

So the record 'number' is referencing the page it resides and not the item itself.

Thanks
Simon

Re: [sjenko] Relevant infromation with links

By Donna - September 19, 2008

Hi there,

The number needs to be part of the query string itself, rather than trying to be pulled in as a separate page. So, it would be more like this:

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

The final output when it's viewed through a browser should be something like this (with the correct record number showing of course):

<a href="../../../news/news_article.php?4">Link Title</a>

Does that make sense?
Donna

--
support@interactivetools.com

Re: [sjenko] Relevant infromation with links

By Dave - September 22, 2008

Using straight SQL is pretty advanced but yes, you need the record number in order to link to it. Perhaps like this:

SELECT num, CONCAT_WS(" ", related_title, summary_short) FROM cms_news
Dave Edis - Senior Developer
interactivetools.com