1 (edited by 2011-02-06 22:17:41)

Topic: [HACK] Linked Categries

Name: Linked Categories
Author: FUNimations
CuteNews Compatibility: 1.4.5 - * (no incompatibility reported yet)
Description: Adds the category names from an article to your post and clickable. Once clicked, all short stories for the clicked category will be shown.
Instructions:
in shows.inc.php find all

$output = str_replace("{category}", catid2name($news_arr[6]), $output);


add below

$cat_url = array();
                        $art_cat_arr = explode(",", $news_arr[6]);
                        if(count($art_cat_arr)==1)
                            $output = str_replace("{category-url}", "[url=?cid=]".catid2name($news_arr[6])."[/url]", $output);
                        else
                        {
                            foreach($art_cat_arr as $thiscat)
                                    {    $cat_url[] = "[url=?cid=]".catid2name($thiscat)."[/url] ";}
                            $output = str_replace("{category-url}", implode(", ", $cat_url), $output);
                        }

this should work for the articles in a single category too. And in case you're wondering, you're making a new tag here that you must use in the templates.

with your CN include code use

if(isset($_GET['cid']))
$category = $_GET['cid'];
elseif(!isset($_REQUEST['subaction']))
$category = "ID THAT SHOULD SHOW BY DEFAULT"