This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Link to forums from article/news


avatar
mishima 144
From: -
Link to forums from article/news

Hello,

I would like to add a link next to the "comments" at the top of news/articles so that users can go straight to the coresponding thread on the forums. How can I do this?

Thanks

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Link to forums from article/news
avatar
Administrator
1340
From: Vienna, Austria
PHP part:
global $database;

$result = $database -> dbquery( "SELECT articlecat_name, articlecat_seo FROM " . DB_PREFIX . "esselbach_ct_articlescats WHERE articlecat_id = '" . $insert['article_category'] . "'" );
list( $insert['article_category'], $insert['article_category_seo'] ) = $database -> dbrow( $result );


HTML part:
<a href="https://www.contentteller.com/index.php{$insert['param_ct']}articles{$insert['param_action']}categories{$insert['param_page']}{$insert['article_category_seo']}.html">{$insert['article_category']}</a>
1 Re: Link to forums from article/news
avatar
OP 144
From: -
Thanks that works great Philipp. Just one thing, I wanted it to be a hyperlink and go to that category on the site. I had a think about how this may work but couldn't figure it out. I imagine it really isn't hard!! How would I do this?
1 Re: Link to forums from article/news
avatar
Administrator
1340
From: Vienna, Austria
You need to add the following PHP part to the articles_pages template:

global $database;

$result = $database -> dbquery( "SELECT articlecat_name FROM " . DB_PREFIX . "esselbach_ct_articlescats WHERE articlecat_id = '" . $insert['article_category'] . "'" );
list( $insert['article_category'] ) = $database -> dbrow( $result );


Then you can use {$insert['article_category']} in the HTML part
1 Re: Link to forums from article/news
avatar
OP 144
From: -
Just one other thing - how can I add the category that the article is in onto this area too please?
1 Re: Link to forums from article/news
avatar
OP 144
From: -
Thanks! Smiling Face
1 Re: Link to forums from article/news
avatar
Editor
0
From: -
You need to edit the templates news_story and news_story_extended

Add the following in the PHP part:
global $uwrapper;


$forum_link = $uwrapper -> getthreadlink( $insert[ 'newsstory_thread' ] );


Then you can use the variable $forum_link, which contains the link to the forum in the HTML part. For example:
<a href="https://www.contentteller.com/{$forum_link}">Discuss in forum</a>


For the articles module you need to edit the templates articles_summary and articles_pages.

The PHP part is slightly different:
global $uwrapper;


$forum_link = $uwrapper -> getthreadlink( $insert[ 'article_thread' ] );


Then you can use the same HTML part in the templates:
<a href="https://www.contentteller.com/{$forum_link}">Discuss in forum</a>

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.