1 rendeto Dec 08, 2008 22:38
3 rendeto Dec 10, 2008 00:30
Hi, thanks for the reply!
I'll go and read about the rss plugin and then after I have the new information I'll infrom everyone if there are answers right for me...
P.S. I was wondering if there is functionality like in Codeigniter where I can work with lets say the third URL variable - in my case http://dimitrov.eu.org/blog/en/general/christmas So in Codeigniter I can catch this variable by $url[3], which will be "christmas". And I would like to check if $url[3]!=NULL or $url[3]!=''
That is how I know that the user is looking at the main page... I hope I explained it as I wanted to...
4 yabba Dec 10, 2008 10:44
There are ways of detecting if you're on the main page or not, but the chances are you just need to look at $disp
<?php
switch( $disp )
case 'posts' : // chances are this is where you want to show teasers ;)
// do teaser stuff
break;
case 'single' :
default : // chances are this is where you want to show full post
// do full post stuff
break;
}
?>
Alternatively you can create a _posts.main.php && _single.main.php in your skins/[skin]/ folder and then just change the relevant bits ;)
¥
5 rendeto Feb 22, 2009 20:39
Thanks to the help of ¥åßßå I've managed to finish the content preview only on MAIN pages. I've cloned the "content_teaser" function in ../inc/items/model/_item.class.php, renamed it to content_preview, and added one additional function wordlimit:
function wordlimit($string, $length = 100, $ellipsis = " [...]")
{
$words = explode(' ', $string);
if (count($words) > $length)
return implode(' ', array_slice($words, 0, $length)) . $ellipsis;
else
return $string;
}
function content_preview( $params )
{
// Make sure we are not missing any param:
$params = array_merge( array(
'before' => '',
'after' => '',
'disppage' => '#',
'stripteaser' => '#',
'format' => 'htmlbody',
), $params );
$r = $this->get_content_teaser( $params['disppage'], $params['stripteaser'], $params['format'] );
$r = $this->wordlimit($r);
if( !empty($r) )
{
echo $params['before'];
echo $r;
echo $params['after'];
}
}
Finaly I've modified _item_content.inc.php in the "skins" directory as replacing
$Item->content_teaser( array(
'before' => '',
'after' => '',
) );
with the folowing:
switch( $disp ) {
case 'posts' : // chances are this is where you want to show teasers ;)
// do teaser stuff
$Item->content_previewer( array(
'before' => '',
'after' => '',
) );
break;
case 'single' :
default : // chances are this is where you want to show full post
$Item->content_teaser( array(
'before' => '',
'after' => '',
) );
break;
}
Thanks ¥åßßå , thanks all. Cheers!
Would I be right in guessing that you want to automate ## words of teaser before a "read more" kinda link?
If so then you might want to have a meander through our rss plugin, it's got a word count thing that might help you
¥