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: [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: [Donna] Relevant infromation with links

Hi Donna

ok the link is working perfect, maybe I didnt explain properly previousley, sorry, This issue is the when I click the related news piece, the echo is seeing it from current item, so item 3 and its following this value through when linking to the related news so isnt displaying the correct related news piece once clicked. Its displating the value of the prvious item "3".

I need to extract the value from the related news so it can link to it, I am using a SQL query that looks like this:

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

Do i need the num of the related news piece

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