Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Blesta-Addons/data_structure_html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

data_structure_html

php class to truncate HTML content ,

INSTALLATION

just upload the helpers folders to the blesta directory .

USAGE

inside the controller add :

$this->set("html", $this->DataStructure->create("html"));

in the template file .PDT you can use it as the fallowing code

$result = $html->truncate($text, $length = 150 , $strip_tags = true , $ending = ' ... ', $exact = false, $considerHtml = true );

you can sipmly you it as

$result = $html->truncate($this->Html->ifSet($vars->text), 180 );

the class support the fallowing param

 @param string $text HTML to truncate.
 @param integer $length Length of returned string, including ellipsis.
 @param boolean $strip_tags If true , $text will rendered without html tags 
 @param string $ending Ending to be appended to the trimmed string.
 @param boolean $exact If false, $text will not be cut mid-word
 @param boolean $considerHtml If true, HTML tags would be handled correctly

this class is taken from the CakePHP framework .

About

php class to truncate HTML content

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages