This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

How to limit text length in blocks


avatar
error 232
From: -
How to limit text length in blocks

I want to know how to limit text length in fx. Latest News block?

Thanks

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: How to limit text length in blocks
avatar
Editor
0
From: -
Because of:

if ( strlen( $article_seo, $article_title ) > $length) 


You should change this line to this:

if ( strlen( $article_title ) > $length) 
1 Re: How to limit text length in blocks
avatar
OP 232
From: -
Why this doesn't work in article_latest block?


while( list( $article_seo, $article_title ) = $database -> dbrow( $results ) )
{

$length = 22;
if ( strlen( $article_seo, $article_title ) > $length)
{
$article_title = substr ( $article_title, 0, $length ) . "...";
}

$articles_latest .= "&middot; <a href=\"" . $seo_url . "articles" . $preferences[ 'param_action' ] . "summary" . $preferences[ 'param_page' ] . $article_seo . ".html\">" . htmlspecialchars( $article_title ) . "</a><br />";
1 Re: How to limit text length in blocks
avatar
OP 232
From: -
Thanks a lot.
:)
1 Re: How to limit text length in blocks
avatar
Editor
0
From: -
Open /blocks/news_latest.php in an editor and find this line:

                          $news_latest .= "&middot; <a href=\"" . $seo_url . "news" . $preferences[ 'param_action' ] . "story" . $preferences[ 'param_page' ] . $newsstory_seo . ".html\">" . htmlspecialchars( $newsstory_title ) . "</a><br />";


and then add before:

                               $length = 22;

if ( strlen( $newsstory_title ) > $length)
{
$newsstory_title = substr ( $newsstory_title, 0, $length ) . "...";
}

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.