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.

Pages: [1] 2 3

Author Topic: [MICRO-ADDON] INTRO CONTENT  (Read 10977 times)

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
[MICRO-ADDON] INTRO CONTENT
« on: June 07, 2008, 11:24:48 pm »

Hey all  :D
want to add Intro content easy ?
this lil addon will display your intro content while on category page ( teaser ),
when article is in full view this content will not show.
For sNews v17 just add the function and use the FUNC in
article editor to call the function and to add your Teaser.

For sNews v1.6 Best Use with - [MOD] Function use in articles (snews1.6)  by philmoz,
Read here How to install http://snewscms.com/forum/index.php?topic=4583.0

Code: [Select]
<?php
/*
Very Simple Intro Mod for sNewsCMS v1.6/1.7 ( Auto Detected ).
by Moshe Gil Lamberger.
date: Jun 7, 2008 :: 23:12 ::
        website: http://www.cms-zen.com
Note: For v1.6 Best use with (  built in 17 )
[MOD] Function use in articles (snews1.6)  by philmoz.  
        location:  http://snewscms.com/forum/index.php?topic=4583.0
*/
function intro($introtxt=''){
// test if we are on sNews v.16 else we are on sNews v.17 , and set A Var for article id.
if (function_exists('get_id')) {
$_ID get_id('article');
} else {
global $_ID;
}
// Display the Intro if we are not in full article view
if( !$_ID ) {
if(!empty($introtxt)) {
echo '<div class="intro-Div">';
echo '<div class="intPad">';
echo $introtxt;
echo '</div>';
echo '</div>';
}
}
//////
}
?>


Style for use with function, can be changed to your needs.
Code: [Select]
<style type="text/css">
.intro-Div{  }
.intPad{  }
.intro-Div img { padding:1%; }
.intro-Div a img {  border:1px solid #f5f5f6; }
.intro-Div a:hover img {  border:1px solid #ccc; background:#f4f4f5;}
.intro-Div p { padding:2px 1%; border-left:12px solid #00FF33; }
</style>

In article editor, use the func button to add content.
add [break] tag after [/func] tag.

EG:
Code: [Select]
[func]intro:|:
   <p>Image and Text Content Go Here</p>
[/func]
[break]
HERE WILL BE THE FULL ARTICLE VIEW.

Demo http://cms-zen.com/site/art-gallery/
Demo http://cms-zen.com/site/music-and-video-clips/

Note: do not use the chart ( , ) with in the function,
one of snews function cut the text if this chart is used.

Update: as philmoz solution for the comma spliter,
fix: in snews.php find function file_include(), almost at the end of the file,
find this line
Code: [Select]
        $returned = call_user_func_array($func[0],explode(',',$func[1]));
replace it with
Code: [Select]
        $returned = call_user_func_array($func[0],explode('^',$func[1]));

in language variables find
Code: [Select]
$l['parameters']='Parameters - if more than one required, separate with a comma. Do not use quotes for empty parameters.';
Change
Code: [Select]
$l['parameters']='Parameters - if more than one required, separate with the control symbol ( ^ ) . Do not use quotes for empty parameters.';

after this change no need to warry about the comma no more :)

Hope will be useful :)
awesome nite
« Last Edit: June 12, 2008, 10:25:33 pm by mosh »
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #1 on: June 08, 2008, 12:26:22 am »

Very neat indeed.
Logged
Of all the things I have lost, it is my mind that I miss the most.

centered

  • Guest
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #2 on: June 08, 2008, 03:02:18 am »

Haven't tried it out but I see other potential in the way you have done this.  good job!
Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #3 on: June 08, 2008, 04:22:49 am »

Excellent toy Moshe, good work! Karma!
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #4 on: June 08, 2008, 01:30:56 pm »

Note: do not use the chart ( , ) with in the function,
one of snews function cut the text if this chart is used.
Mosh, do you mean that the comma (,) is being stripped?
Logged
Of all the things I have lost, it is my mind that I miss the most.

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #5 on: June 08, 2008, 01:54:57 pm »

He he, another elegant way to flag a bug?  :D
In what version? I suppose 1.7 ...
« Last Edit: June 08, 2008, 01:57:03 pm by funlw65 »
Logged

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #6 on: June 08, 2008, 02:07:33 pm »

@ philmoz thank you,
the text after the comma getting chopped lol,
i hevent had the brain to look where yet  :P

@funlw thank you,
this "Micro" addon is more like Power Tool/Toy  ;D

its not a bug funlw, hehe its a feature,
one of the other cleaner functions cut the text  :'(

in snews 16 and 17 ( i guess philmoz will spot it in a sec   :P  )

@equilni thank you,
and i really would like to see what will cooked up under your creative shop.  :D

awesome day

omg my spelling **** hehe, ty phil ;D
« Last Edit: June 08, 2008, 11:54:57 pm by mosh »
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #7 on: June 08, 2008, 06:58:35 pm »

IMO no bug involved - works just as designed in relation to ','
Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #8 on: June 08, 2008, 08:30:01 pm »

Aaaa, it's about PARAMETERS!!! Content being send as parameter to 'insert function'...   :P :P :P. If you insert a comma, then is considered as second parameter  :P - my slow 'computer'

Quote from Philmoz post:
Quote
$l['function']='Function Name - no brackets.';
$l['parameters']='Parameters - if more than one required, separate with a comma. Do not use quotes for empty parameters.';

@Philmoz, then, another character can be used for separating parameters... maybe two vertical bars || ...
« Last Edit: June 08, 2008, 08:40:06 pm by funlw65 »
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #9 on: June 08, 2008, 10:48:42 pm »

yup, was my first suspicion that the paramater list (if multiple) was seperated by comma, so what happens is, the text gets split at those points.

Obvious solution is to alter the parameter divisors in my mod.
(I hadn't accounted for someone wanting to us the parameters in this way ;) , mind you, that mod has been used in some very inventive ways -- I'm chuffed with it  :P )

@Mosh,
So, in this situation, in the insert function mod,
locate
Quote
$returned = call_user_func_array($func[0],explode(',',$func[1]));
Invent some seperator, as funlw65 suggested, like |%| or :*: or something else that wouldn't normally be be seen, and replace the comma above with it, and note it in the lang var so that you won't forget it when using it.
Quote
$l['parameters']='Parameters - if more than one required, separate with a comma. Do not use quotes for empty parameters.';

I would suggest that you add this alteration to you little mod's first post. In most circumstances, seperation by a comma is perfectly ok.
« Last Edit: June 08, 2008, 10:51:37 pm by philmoz »
Logged
Of all the things I have lost, it is my mind that I miss the most.

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #10 on: June 09, 2008, 12:18:55 am »

@philmoz thank you for the fast solution.
Top Post updated.

awesome nite/day 2 all

centered

  • Guest
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #11 on: June 10, 2008, 04:46:54 pm »

@equilni thank you,
and i really would like to see what will cooked up under your creative shop.  :D

I have a few things cooking... some issues right now, but I have something soon as a package release some may enjoy
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #12 on: June 11, 2008, 11:35:18 am »

I've toyed with idea to make [break] optionally as a 'teaser' which isn't displayed in full, or as currently.
Sometimes, you just want it that way.
Logged
Of all the things I have lost, it is my mind that I miss the most.

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #13 on: June 11, 2008, 01:33:30 pm »

Using two edit areas as in Drupal?
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #14 on: June 12, 2008, 12:13:26 pm »

nope, checkbox in edit screen. -->  Show intro in full article.

If using a descriptive teaser that isn't shown in full article, you don't need an intro text that is shown in the full article.
Logged
Of all the things I have lost, it is my mind that I miss the most.
Pages: [1] 2 3