CuteNews

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> [HACK] Linked Categries, change category names into links
FUNimations
post Oct 31 2008, 01:48 PM
Post #1


CuteNews Support Crew Pimp
***

Group: Support
Posts: 16,501
Joined: 28-August 05
From: Belgium
Member No.: 5,662



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
CODE
$output = str_replace("{category}", catid2name($news_arr[6]), $output);

add below
CODE
$cat_url = array();
                        $art_cat_arr = explode(",", $news_arr[6]);
                        if(count($art_cat_arr)==1)
                            $output = str_replace("{category-url}", "<a href='?cid=".$news_arr[6]."'>".catid2name($news_arr[6])."</a>", $output);
                        else
                        {
                            foreach($art_cat_arr as $thiscat)
                                    {    $cat_url[] = "<a href='?cid=".$thiscat."'>".catid2name($thiscat)."</a>&nbsp;";}
                            $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
CODE
if(isset($_GET['cid']))
$category = $_GET['cid'];
elseif(!isset($_REQUEST['subaction']))
$category = "ID THAT SHOULD SHOW BY DEFAULT"


--------------------

General FAQ
Spam Protection In Cutenews
Comments get deleted
_______________________
<< If you appreciate my help
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 25th May 2013 - 11:32 PM