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.

Pages: 1 [2] 3

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

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #15 on: June 12, 2008, 02:26:44 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.

... then, intro is extracted from full article... I saw that mod and his variants (Vasile Rusnac), I tried to post there but I got MySQL error every time...

Good ideea with that checkbox. So, as you said, if I have a teaser (2: someone given to teasing (as by mocking or stirring curiosity) [syn: {tease}, {annoyer}, {vexer}]), then no need of intro. Else, always a intro is used? As in news papers... And more options for intro? As having only title or also a short part of full article? Of course, with info line as Keyrocks did with Rusnac mod... And that intro having (if some one wanted) an icon or thumbnail with same name as sefname of article?
But the name of article must NOT be controlled by intro function... because if you forgot to add a teaser and check box is not checked, then you have only infoline for that article or nothing at all...
Nice, I like it...
Logged

funlw65

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

Well, @Mosh, you must include a screenshot of THIS page on your first post... is great, looks perfect as layout and chromatics....
Logged

mosh

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

@funlw thank you   :D
updated link.

@equilni
lol, now you teas.

@philmoz
i made this as addon,
for i wanted the smallest footprint if any at core file.
i like to do simple.

we could add a new db field for teasers,
or to change the description to small text field.

all are good ways.

did i say i like it simple  ;D

awesome nite
« Last Edit: June 12, 2008, 10:26:45 pm by mosh »
Logged

Storkk

  • Newbie
  • *
  • Karma: 0
  • Posts: 17
    • صور مضحكة
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #18 on: October 21, 2009, 10:45:39 pm »


super addon , thx mosh

,,

how can i make a boxes :))
see img  plz
http://i34.tinypic.com/2ij6z6h.png



[func]intro:|:

<div id="smallbox">   
Image
</div>

[/func]
[break]
HERE WILL BE THE FULL ARTICLE VIEW.




^_^
Logged
Super >Junior> HTML/CSS      www.batooz.com صور مضحكة

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
I wish I could have done it by myself
« Reply #19 on: October 23, 2009, 01:17:00 pm »

Yeap: I'm tryin to mod that superb Mod ;D in order to display description_meta instead of $introtxt when browsing a category.
But, I can't extract the its content from the DB.
As usual, I need help. ::)

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #20 on: October 26, 2009, 06:30:57 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.

Yup, that's a useful thing. i thought about using this mod in one site but it won't work fully because I need/want the intro to display in full view as well as on the index page. On the other hand, I have another site in the works where this mod is perfect. So a checkbox would be a great solution.

@Sven -- it's possible that you could use $_DESCR to get at the description. Not sure how it can be worked into this mod though, sorry.

btw, the problem with using this mod in combination with (for example) Vasile Rusnac's "articles with intro text" mod -- to pull in say the latest three articles to the front page by their intros, is that it uses strip($text) which doesn't work with this mod... So a way to use them in combination(presumably by doing an alternate version of strip($text) would be useful. (Come to think of it, it may just be my own modded version of articles-with-intro-text-mod that uses strip($text), but anyway... Will need to check on that...)
« Last Edit: October 26, 2009, 08:43:54 pm by Fred K (agentsmith) »
Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #21 on: October 27, 2009, 07:52:55 am »

@Sven -- it's possible that you could use $_DESCR to get at the description. Not sure how it can be worked into this mod though, sorry.
Yes but it needs a query to extract it from the DB, and there  ???

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #22 on: November 03, 2009, 01:53:02 am »

Does anyone have a good idea how to use this mod when strip(text) is in play, like for example when the "latest article with intro text" mod is used?
That would be neat cause then it can be used even in a "special front page" context (it's a *special* layout, uses the onePage among other things...)
[func] doesn't get stripped out...
Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #23 on: November 03, 2009, 08:54:48 am »

Hum...
In another function I made this (adapted here with introtxt):
Code: [Select]
$introtxt = strlen($r['introtxt'])<28?$r['introtxt'].'...':substr($r['introtxt'],0,28).'...';Maybe it helps to find out how ???

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #24 on: November 03, 2009, 12:04:45 pm »

hello :)

@Sven
for display the description_meta if intro text left empty:

snews1.6:
open snews.php file,
in function center find:
Code: [Select]
while ($r = mysql_fetch_array($result)) {
add below:
Code: [Select]
        /////// intro mod ////
                        global $descrption;
$descrption=$r['description_meta']!=''?$r['description_meta']:'';
///////////////////

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

snews1.7:
in function articles find:
Code: [Select]
// get the rows for category
if ($_catID) {

we add to the second line  of the query_articles
Code: [Select]
,a.description_meta as dmeta
scroll down to    
Code: [Select]
while ($r = mysql_fetch_array($result)) {and add below:
Code: [Select]
/////// intro mod ////
                        global $descrption;
$descrption=$r['dmeta']!=''?$r['dmeta']:'';
///////////////////


new function for both versions snews1.6-1.7
add it to snews.php or index.php
Code: [Select]
<?php
/*
Very Simple Intro Mod for sNewsCMS v1.6/1.7 ( Auto Detected ).
by Moshe Gil Lamberger.
date: Nov 3, 2009 :: 13:00 ::
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;
}
global $descrption;
$teaser=$introtxt!=''?$introtxt:$descrption;

// Display the Intro if we are not in full article view
if( !$_ID ) {
echo '<div class="intro-Div">';
echo '<div class="intPad">';
echo $teaser;
echo '</div>';
echo '</div>';
}
//////
}



awesome day 2 all

« Last Edit: November 04, 2009, 08:47:17 pm by mosh »
Logged

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #25 on: November 03, 2009, 06:06:53 pm »


super addon , thx mosh

,,

how can i make a boxes :))
see img  plz
http://i34.tinypic.com/2ij6z6h.png



[func]intro:|:

<div id="smallbox">   
Image
</div>

[/func]
[break]
HERE WILL BE THE FULL ARTICLE VIEW.




^_^

hi storkk
you can use style to align the divs

Code: [Select]
<div class="smallbox">   
Image
</div>
<div class="smallbox">   
Image
</div>
<div class="smallbox">   
Image
</div>
<div class="smallbox">   
Image
</div>
<div class="smallbox">   
Image
</div>

.smallbox{float:left;width:20%;}

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #26 on: November 04, 2009, 04:35:53 am »

Hum...
In another function I made this (adapted here with introtxt):
Code: [Select]
$introtxt = strlen($r['introtxt'])<28?$r['introtxt'].'...':substr($r['introtxt'],0,28).'...';Maybe it helps to find out how ???

Thanks, Philippe. Didn't help though (no visible result).

When I use the latest article with short intro mod, to present snippets on the front page, and if intro($introtxt) is used in articles, then this code from latest articles mod
Code: [Select]
while ($r = mysql_fetch_array($result)) {
$date = date(s('date_format'), strtotime($r['date']));
$link = isset($r['xsef']) ? $r['xsef'].'/'.$r['csef'] : $r['csef'];
$text = $r['text'];
$finetext = strip_tags($text, '<a><hr /><br /><img><section><div><ul><ol>');
echo  '
<h4><a href="'._SITE.$link.'/'.$r['asef'].'/" title="'.$_DESC.'">'.$r['title'].'</a></h4>
'.substr($finetext,0,180).' ...</p>
<p><a href="'._SITE.$link.'/'.$r['asef'].'/" title="Full story">Read more »</a></p>
<hr />
';
}

Gives this result:
Quote
<h4>Headline</h4>
[func]intro:|:<img src="image.bla" />
<p>Text ...</p>
<p><a href="link/">Read more</a></p>

strlen($introtxt) does not stop [func]intro:|: ... from being printed in the snippet on the front page. On "normal" index page, the mod works perfectly, of course.

I guess there's no way to combine these two mods... (I've tried 54 different ways, none works.)
Should probably clarify that this is in 1.7... :o
« Last Edit: November 04, 2009, 04:38:03 am by Fred K (agentsmith) »
Logged

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #27 on: November 04, 2009, 08:18:40 pm »

Hum...
In another function I made this (adapted here with introtxt):
Code: [Select]
$introtxt = strlen($r['introtxt'])<28?$r['introtxt'].'...':substr($r['introtxt'],0,28).'...';Maybe it helps to find out how ???

Thanks, Philippe. Didn't help though (no visible result).

When I use the latest article with short intro mod, to present snippets on the front page, and if intro($introtxt) is used in articles, then this code from latest articles mod
Code: [Select]
while ($r = mysql_fetch_array($result)) {
$date = date(s('date_format'), strtotime($r['date']));
$link = isset($r['xsef']) ? $r['xsef'].'/'.$r['csef'] : $r['csef'];
$text = $r['text'];
$finetext = strip_tags($text, '<a><hr /><br /><img><section><div><ul><ol>');
echo  '
<h4><a href="'._SITE.$link.'/'.$r['asef'].'/" title="'.$_DESC.'">'.$r['title'].'</a></h4>
'.substr($finetext,0,180).' ...</p>
<p><a href="'._SITE.$link.'/'.$r['asef'].'/" title="Full story">Read more »</a></p>
<hr />
';
}

Gives this result:
Quote
<h4>Headline</h4>
[func]intro:|:<img src="image.bla" />
<p>Text ...</p>
<p><a href="link/">Read more</a></p>

strlen($introtxt) does not stop [func]intro:|: ... from being printed in the snippet on the front page. On "normal" index page, the mod works perfectly, of course.

I guess there's no way to combine these two mods... (I've tried 54 different ways, none works.)
Should probably clarify that this is in 1.7... :o


hi Fred,
to clean the func tags and it's content try this:

Code: [Select]
<?php
while ($r mysql_fetch_array($result)) {
$date date(s('date_format'), strtotime($r['date']));
$link = isset($r['xsef']) ? $r['xsef'].'/'.$r['csef'] : $r['csef'];
$text $r['text'];

////////////// clean [func]
$search '!\[func\](.+?)\[/func\]!is';
$text preg_replace($search''$text);
//////////////

$finetext strip_tags($text'<a><hr /><br /><img><section><div><ul><ol>');
echo  '
<h4><a href="'
._SITE.$link.'/'.$r['asef'].'/" title="'.$_DESC.'">'.$r['title'].'</a></h4>
'
.substr($finetext,0,180).' ...</p>
<p><a href="'
._SITE.$link.'/'.$r['asef'].'/" title="Full story">Read more »</a></p>
<hr />
'
;
}



awesome day/night  :)

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #28 on: November 04, 2009, 09:43:00 pm »

hi Fred,
to clean the func tags and it's content try this:

Thanks mosh, but I don't want to clean out the [func] and its content, I want to make sure that the text "[func]intro:|:" isn't printed on the page, but I still want the function... if you see what I mean. Plus, the code kills the other function as well so I get the full article instead of the shortened article. Unfortunately.
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: [MICRO-ADDON] INTRO CONTENT
« Reply #29 on: November 05, 2009, 03:10:59 am »

Actually, if I change mosh's suggested code to the code below, everything except snippet headline and the readmore link is stripped out, so that's a step in the right direction because the intro($introtext) mod still works, but it's not quite what I'm after.

Code: [Select]
while ($r = mysql_fetch_array($result)) {
$date = date(s('date_format'), strtotime($r['date']));
$link = isset($r['xsef']) ? $r['xsef'].'/'.$r['csef'] : $r['csef'];
$text = $r['text'];
// clean [func]
$search = '\[func\](.+?)\[/func\]!is';
$text = preg_replace($search, '', $text);
$finetext = strip_tags($text, '<a><hr /><br /><img><section><div><ul><ol>');
echo  '
<h4><a href="'._SITE.$link.'/'.$r['asef'].'/" title="'.$_DESC.'">'.$r['title'].'</a></h4>
'.substr($finetext,0,250).' ...</p>
<p><a href="'._SITE.$link.'/'.$r['asef'].'/" title="Full story">Read more »</a></p>
<hr />
';
}

Life is funny sometimes.
Logged
Pages: 1 [2] 3