2 yabba Nov 13, 2006 07:28

in your skins _main.php you should see a block of code that looks similar to this :-
<h3 class="bTitle"><?php $Item->title(); ?></h3>
<div class="bText">
<?php $Item->content(); ?>
<?php link_pages() ?>
</div>
Change it to look like this :-
<h3 class="bTitle"><?php $Item->title(); ?></h3>
<div class="bText">
<?php
if( !empty( $s ) )
{
$Item->content = implode( ' ', array_slice( explode( ' ', $Item->content ), 0, 50 ) );
}
$Item->content();
?>
<?php link_pages() ?>
</div>
¥
Thanks a lot. I have it set up...
An extra feature - would be to have a "Read More" type of link so that people can click to get the full article.
Right now, they have the "Permalink" icon but that is not too obvious.
I tried adding
<a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>">READ MORE</a>
This creates a "Read More" link all the way at the top of the first line. I would want this type of link on the middle of the page after the last last character of the blog.
Even Better, it would be nice to make the "Blog Title" a Link to the full article...Like Google does.
Is this possible?
I realize you've helped a lot already so thanks a lot for this...
Edgar.
Making it jump to "+ 50 words" on clicking read more is probably more coding effort than it's worth, but if you want to give it a shot then you can probably do it like this (sorry, I can't test this as I don't have a 0.9.1 blog anywhere)
<h3 class="bTitle"><a href="<?php $Item->permalink(); ?>&myMore=1#myMore"><?php $Item->title(); ?></a></h3>
<div class="bText">
<?php
if( !empty( $s ) )
{
$Item->content = implode( ' ', array_slice( explode( ' ', $Item->content ), 0, 50 ) );
}
elseif( param( 'myMore', 'integer' ) )
{
$Item->content = implode( ' ', array_slice( explode( ' ', $Item->content ), 0, 50 ) ).'<a id="myMore"></a>'.implode( ' ', array_slice( explode( ' ', $Item->content ), 50 ) );
}
$Item->content();
?>
<?php link_pages() ?>
</div>
¥
Hey - I just updated to 1.8.5 so I am not sure if your code will work. In any case, I will try it and let you know.
Related to this, did you ever see this request? I think the two are related
http://forums.b2evolution.net/viewtopic.php?t=8301&highlight=search+results
I tested the code and it also works on 1.8.5
I tried creating the "Read More" link right after the first 40 characters...but somehow the link kept appearing on the top of the blog text...
<?php
if( !empty( $s ) )
{
$Item->content = implode( ' ', array_slice( explode( ' ', $Item->content ), 0, 40 ) );
$Item->content = $Item->content . $Item->permanent_link('Read More') ;
}
$Item->content();
?>
<?php link_pages() ?>
Not a biggie but if you have a chance to review and help - it will be great.
There's also a "google highlight search [url=http://b2evo.astonishme.co.uk/index.php?title=search-hi-lite-plugin&more=1&c=1&tb=1&pb=1#comments]here at astonishme.co.uk[/url] but it didn't work for me.
<?php
if( !empty( $s ) )
{
$Item->content = implode( ' ', array_slice( explode( ' ', $Item->content ), 0, 40 ) ).'< a href="'.$Item->permanent_url().'">Read More</a>';
}
$Item->content();
?>
<?php link_pages() ?>
We haven't updated the search highlighter yet, hopefully we'll get a chance soon.
¥
Anyone tried?
I have tried, but not worked
I'm hoping this is the right place for this question.
I'm building a 400 x 300 Text Area in my main page.
In there, I want to place the text of my "last post".
To display one post is simple. I have my blog configure to show only one post.
What I can't seem to figure out is how to limit the amount of characters returned:
is there a way to have b2evo 2.4 return only the X number of text characters, and then output the "Read More" button?
The code above doesn't follow the format of the new skins. The _item_content.inc.php doesn't include a $Item-> clause.
Thanks for the help...
There's a function in the RSS Reader plugin that will cut content at ## words whilst preserving tags, you might be able to play with it to suit your needs ;)
¥
You could try something like this in your skin (where you currently only have $Item->content() )
¥