Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: [MOD] Always display the category description somewhere in the template.  (Read 4648 times)

gomisan

  • Full Member
  • ***
  • Karma: 0
  • Posts: 194
    • http://fish-cam.net/

I'm building a site at the moment, and each category needs a small 'paragraph' or 'blurb' that stays at teh top of the center area at all times.

Any ideas on how to achieve this? I'd be happy to have a seperate function for it. basically I want the category description filed to be made visible.

Logged
Check out my sNews powered Tropical Fishtank site, live Fish-Cam !!

George Antoniadis

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 479
[MOD] Always display the category description somewhere in the template.
« Reply #1 on: April 28, 2006, 03:21:14 pm »

easy one I think...

try adding a function like:
Code: [Select]
// DISPLAY CATEGORY DESCRIPTION
function category_description() {
$category = get_id('category');
if (isset($category)) {
if (($category==strtolower(l('home'))) OR ($category=='')) {
echo 'Main category'; //CHANGE THIS FOR DEFAULT CATEGORY DESCRIPTION.
} else {
$query = "SELECT * FROM " .s('prefix'). "categories WHERE seftitle = '".$category."'";
$result = mysql_query($query);
while ($r = mysql_fetch_array($result)) {
echo $r['description'];
}
}
}
}

just add it let's say before // DISPLAY CATEGORIES
... ;)
then add
and then change the main category description to change the default category echo! :P
Logged
How I feel like I'm starless, I'm ready to fade now.
And how I feel like I'm starless, I'm hopeless and greyed out.

gomisan

  • Full Member
  • ***
  • Karma: 0
  • Posts: 194
    • http://fish-cam.net/
[MOD] Always display the category description somewhere in the template.
« Reply #2 on: April 28, 2006, 03:27:37 pm »

Quote from: analyzerx

and then change the main category description to change the default category echo! :P


sorry but it's been a long day... what do you mean by this?
Logged
Check out my sNews powered Tropical Fishtank site, live Fish-Cam !!

George Antoniadis

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 479
[MOD] Always display the category description somewhere in the template.
« Reply #3 on: April 28, 2006, 03:30:38 pm »

in the fucntion there is a line:
Code: [Select]
echo 'Main category'; //CHANGE THIS FOR DEFAULT CATEGORY DESCRIPTION.the 'Home' category that is hardcoded into snews.php doesn't have a description to show.

so we write one there...
in the main snews index there is no set category and the script uses home... (or whatever you selected on $l['home'])...
Logged
How I feel like I'm starless, I'm ready to fade now.
And how I feel like I'm starless, I'm hopeless and greyed out.

gomisan

  • Full Member
  • ***
  • Karma: 0
  • Posts: 194
    • http://fish-cam.net/
[MOD] Always display the category description somewhere in the template.
« Reply #4 on: April 28, 2006, 03:33:52 pm »

gotchya... sorry, having a 'blonde' moment, as my girlfriend would say.
Logged
Check out my sNews powered Tropical Fishtank site, live Fish-Cam !!

George Antoniadis

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 479
[MOD] Always display the category description somewhere in the template.
« Reply #5 on: April 28, 2006, 03:36:45 pm »

hehehe! ^_^ no worries mate! :)
I'll rename your post if you don't mind so other ppl can find this mod ok?
Logged
How I feel like I'm starless, I'm ready to fade now.
And how I feel like I'm starless, I'm hopeless and greyed out.

gomisan

  • Full Member
  • ***
  • Karma: 0
  • Posts: 194
    • http://fish-cam.net/
[MOD] Always display the category description somewhere in the template.
« Reply #6 on: April 28, 2006, 05:51:42 pm »

Good idea. It's getting on towards 2am here, and I've been hammering at teh same website allll day (well since about 10am) so you'll excuse me I hop eif i don't implement this until tomorrow.

(ohh and this also offers a 'pseudo' sticky article feature, just put your article in the category description!)
Logged
Check out my sNews powered Tropical Fishtank site, live Fish-Cam !!

gomisan

  • Full Member
  • ***
  • Karma: 0
  • Posts: 194
    • http://fish-cam.net/
[MOD] Always display the category description somewhere in the template.
« Reply #7 on: April 29, 2006, 08:00:35 am »

Thanks, I've used it on my clients site, and it works perfectly. Now I just need them to supply some copy to put in those descriptions!
Logged
Check out my sNews powered Tropical Fishtank site, live Fish-Cam !!

George Antoniadis

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 479
[MOD] Always display the category description somewhere in the template.
« Reply #8 on: April 29, 2006, 08:56:51 am »

what? o_O Don't get it!
Logged
How I feel like I'm starless, I'm ready to fade now.
And how I feel like I'm starless, I'm hopeless and greyed out.

gomisan

  • Full Member
  • ***
  • Karma: 0
  • Posts: 194
    • http://fish-cam.net/
[MOD] Always display the category description somewhere in the template.
« Reply #9 on: April 30, 2006, 12:35:14 pm »

What's not to get. I used it, it works, client needs to supply copy.

'copy' is the term used for content. Basically, they haven't given me the text to put in the descriptions yet.
Logged
Check out my sNews powered Tropical Fishtank site, live Fish-Cam !!

George Antoniadis

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 479
[MOD] Always display the category description somewhere in the template.
« Reply #10 on: April 30, 2006, 05:53:08 pm »

owwwwwwwwwwwwwwwwwh! :P
ok! :P didn't get the copy part hehe
Logged
How I feel like I'm starless, I'm ready to fade now.
And how I feel like I'm starless, I'm hopeless and greyed out.