Name: Add news title and/or category to <title>
Author: Ifa
Updated: 18.11.2008
Cutenews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: Adds the news title and/or category between your <title> tags
Instructions: This hack will add the news title and/or category that is currently viewed to the page title (<title></title>).
Add this code to your file that includes cutenews. Put this between the <head></head> tags. Change the $path = 'cutenews/data'; to match your cutenews folder. And change the <title>default title</title> to what you want the title to be when it's not the news title.
if (is_array($category)) $category = ' - '.implode(' - ', $category);
This line is for multiple categories. By default it seperates the categories with a -, ie "title - category1 - category2 - category3".
You can freely change both - to suit your needs, just keep the ' '. The same goes with the line below, only this is for a single category.else $cat = ' - '.$title_values[1];
$title_values = title_values($_GET['id'], TRUE); // Change TRUE to FALSE if you dont use a category
Like it says, if you don't want category in your title, change TRUE to FALSE. This only saves the script some extra work.<?PHP function title_values($id, $use_category) { $path = './cutenews/data';//CHANGE PATH TO THE CUTENEWS DATA DIRECTORY HERE if ($use_category) { $cat_lines = file($path.'/category.db.php'); foreach ($cat_lines as $cat_line) { $cat_array = explode('|', $cat_line); $my_cats[$cat_array[0]] = $cat_array[1]; } } $news_lines = file($path.'/news.txt'); foreach ($news_lines as $news_line) { $news_array = explode("|", $news_line); if ($news_array[0] == $id) { $title = strip_tags($news_array[2]); if ($use_category and !empty($news_array[6])) { if (strstr($news_array[6], ',')) { $cat_array = explode(',', $news_array[6]); foreach ($cat_array as $category) $category_arr[] = $my_cats[$category]; } else $category_arr = $my_cats[$news_array[6]]; } } } return array ($title, $category_arr); } if (isset($_GET['id'])) { $title_values = title_values($_GET['id'], true);//change true to false if the category doesn't need to be in the titlebar. $title = $title_values[0]; if (is_array($title_values[1])) $cat = ' - '.implode(' - ', $title_values[1]); else $cat = ' - '.$title_values[1]; echo '<title>'.$title.''.$cat.'</title>'; } else echo '<title>Default Title</title>'; ?>
52 2006-01-14 00:03:21
Re: Wishes for future versions of CuteNews (301 replies, posted in Script Feedback and Suggestion)
CuteFTP language packs!
53 2005-12-18 11:21:33
Re: CHMOD Newbie Craze (2 replies, posted in Hacks & Tricks / FAQ)
So changing CHMOD will not make an error message dissapear
To make things clear, in most cases it doesn't work, but in
Warning: fopen(X): failed to open stream: Permission denied in /www/site/folder on line #
The error will go away with proper chmod
54 2005-09-07 21:39:03
Re: Wishes for future versions of CuteNews (301 replies, posted in Script Feedback and Suggestion)
World Peace!
Oh and all bugs gone (major ones atleast)
55 2005-08-10 11:18:08
Re: [HACK] Use CuteNews' users.db.php on other pages (1 replies, posted in Hacks & Tricks / FAQ)
56 2005-03-07 23:39:27
Re: Wishes for future versions of CuteNews (301 replies, posted in Script Feedback and Suggestion)
rofl you guys
You can do that just by editing options.mdu. It's in there very begining of the file
All this talk about making a hack when it's in cutenews already
57 2005-02-23 01:04:53
Re: Wishes for future versions of CuteNews (301 replies, posted in Script Feedback and Suggestion)
I would like the next cutenews to have one feature... A magical button reads what I want from my mind and then does it... That would be so cool... :specool: