Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: [MOD] Category and Article related "special" content  (Read 4181 times)

kuazo

  • Guest
[MOD] Category and Article related "special" content
« on: January 19, 2009, 02:54:48 pm »

If you want to add "special" content under a single article, you should put this into your template. It also works for categories.
This example works with contact. Just put more cases into that.

Maby if you want to change the header image on every article this is the right thing you need.
Also usefull for multiple css file and template-injection.

Quote
<?php 
global $categorySEF, $articleSEF;
 
$current=$categorySEF; 
if ($current=='') { 
 $current=$articleSEF; 

switch ($current) { 
case contact: 
 echo '<h4>Contact</h4><p>This shows if you HAVE clicked contact</p>'; 
 break; 
 default: echo '<h4>This should change</h4><p>... if you click contact</p>'; 
 break; 

?>


ps: code for 1.6 ...

Quote
<?php
   $current=get_id('category');
   if ($current==home) {
   $current=get_id('article');}
   switch ($current) {
...
...
...
?>
« Last Edit: January 19, 2009, 02:59:11 pm by kuazo »
Logged

centered

  • Guest
Re: [MOD] Category and Article related "special" content
« Reply #1 on: January 19, 2009, 03:25:53 pm »

why not use the extra function and include it in the article?

[func]extra('my_special_article_extra')[/func]
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: [MOD] Category and Article related "special" content
« Reply #2 on: January 19, 2009, 04:14:39 pm »

I liked it. Doeas exactly what I needed... Think of one thing though... it can not handle - characters in sef title of a category... like promoting-music, it has to be one word for some odd reason.
Logged
"It's only dead fish that goes with the flow... "
Updated

kuazo

  • Guest
Re: [MOD] Category and Article related "special" content
« Reply #3 on: January 19, 2009, 05:15:51 pm »

are you sure it doesn't work with - ? well, i dont have time to test this out right now.

why not using extra -> thats a good question. well i use this script for my header
to do individual h4 and h5 under the logo. my extra & content have got another position!
« Last Edit: January 19, 2009, 06:05:43 pm by kuazo »
Logged

Sasha

  • Hero Member
  • *****
  • Karma: 28
  • Posts: 938
    • cssanarchy.com
Re: [MOD] Category and Article related "special" content
« Reply #4 on: January 20, 2009, 05:53:02 pm »

equilni extra function suks big time in snews....i m using 1.6 snews and extra function is just stupid code...is not useful at all...chek your self before ask questions like that...
Logged
Every morning, I get up and look through the 'Forbes' list of the richest people in America. If I'm not there, I go to work. | If you love your job, you haven't worked a day in your life. snews with ♥

Joost

  • Guest
Re: [MOD] Category and Article related "special" content
« Reply #5 on: January 20, 2009, 06:02:22 pm »

equilni extra function suks big time in snews....i m using 1.6 snews and extra function is just stupid code...is not useful at all...chek your self before ask questions like that...

What's your point?
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: [MOD] Category and Article related "special" content
« Reply #6 on: January 20, 2009, 06:09:19 pm »

equilni extra function suks big time in snews....i m using 1.6 snews and extra function is just stupid code...is not useful at all...chek your self before ask questions like that...

What's your point?

I think Sasha's having a bad moment. His dad's seriously ill and he's off to take care of family matters.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

centered

  • Guest
Re: [MOD] Category and Article related "special" content
« Reply #7 on: January 20, 2009, 06:13:34 pm »

equilni extra function suks big time in snews....i m using 1.6 snews and extra function is just stupid code...is not useful at all...chek your self before ask questions like that...

How the fuck does that help the conversation or provide a solution.  If you have a fucking issue, state it, with detail!

« Last Edit: January 20, 2009, 06:28:34 pm by equilni »
Logged

Joost

  • Guest
Re: [MOD] Category and Article related "special" content
« Reply #8 on: January 20, 2009, 06:24:19 pm »

I think Sasha is referring to the extra functionality in 1.6.
To be clear on this: The extra functionality is improved in 1.7 thanks to Jason.
So:
- The method described by Jason will work in 1.7
- The method won't work in 1.6
Logged

centered

  • Guest
Re: [MOD] Category and Article related "special" content
« Reply #9 on: January 21, 2009, 03:50:35 am »

thanks for clarifying, I didn't read fully and reacted too quickly
Logged

kuazo

  • Guest
Re: [MOD] Category and Article related "special" content
« Reply #10 on: January 21, 2009, 12:45:39 pm »

1. thank you for off-topic^^

2. whats your solution to change header-images each article or category?
how to do that with extra, i would like to know. should use multiple-extra mod, right!?

this mod was for 1.6, i just rewrote it for partic. iam not using 1.7 so far.


of course there a multiple solutions for everything, iam open minded for yours :-)
« Last Edit: January 21, 2009, 12:48:06 pm by kuazo »
Logged

Sasha

  • Hero Member
  • *****
  • Karma: 28
  • Posts: 938
    • cssanarchy.com
Re: [MOD] Category and Article related "special" content
« Reply #11 on: January 22, 2009, 09:15:47 am »

Hey equilni sory for my post.I not mean to offend you in any way i just want to say that extra function in snews 1.6 is not that great function..If you found my comments to offend please accept my apology.I do not know how that function work in snews 1.7 (i not use 1.7 ,not yet) but Joost say is better then in 1.6...
Logged
Every morning, I get up and look through the 'Forbes' list of the richest people in America. If I'm not there, I go to work. | If you love your job, you haven't worked a day in your life. snews with ♥

centered

  • Guest
Re: [MOD] Category and Article related "special" content
« Reply #12 on: January 22, 2009, 01:14:04 pm »

NP Sasha.  I didn't realize the discussion was on 1.6 when in 1.7 forum.  My solution noted above was for 1.7.  1,6 was changed because it is limited.
Logged