API - XOOPS 2.5.11 Beta 2
By monxoops.fr
|
Namespaces | |
namespace | Smarty |
Functions | |
smarty_modifier_truncateHtml ($string, $count=80, $etc='…') | |
smarty_modifier_truncateHtml | ( | $string, | |
$count = 80 , |
|||
$etc = '…' |
|||
) |
Smarty truncateHtml modifier plugin
Type: modifier Name: truncateHtml Purpose: Truncate an HTML string to a certain number of words, while ensuring that valid markup is maintained. Example: <{$body|truncateHtml:30:'...'}>
string | $string | HTML to be truncated |
integer | $count | truncate to $count words |
string | $etc | ellipsis |
The Yii framework is free software. It is released under the terms of the following BSD License.
Copyright © 2008-2018 by Yii Software LLC, All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Returns the number of bytes in the given string. This method ensures the string is treated as a byte array by using mb_strlen()
.
string | $string | the string being measured for length |
Returns the portion of string specified by the start and length parameters. This method ensures the string is treated as a byte array by using mb_substr()
.
string | $string | the input string. Must be one character or longer. |
int | $start | the starting position |
int | $length | the desired portion length. If not specified or null , there will be no limit on length i.e. the output will be until the end of the string. |
Returns the trailing name component of a path. This method is similar to the php function basename()
except that it will treat both \ and / as directory separators, independent of the operating system. This method was mainly created to work on php namespaces. When working with real file paths, php's basename()
should work fine for you. Note: this method is not aware of the actual filesystem, or path components such as "..".
string | $path | A path string. |
string | $suffix | If the name component ends in suffix this will also be cut off. |
Returns parent directory's path. This method is similar to dirname()
except that it will treat both \ and / as directory separators, independent of the operating system.
string | $path | A path string. |
Truncates a string to the number of characters specified.
string | $string | The string to truncate. |
int | $length | How many characters from original string to include into truncated string. |
string | $suffix | String to append to the end of truncated string. |
string | $encoding | The charset to use, defaults to charset currently used by application. |
bool | $asHtml | Whether to treat the string being truncated as HTML and preserve proper HTML tags. This parameter is available since version 2.0.1. |
Truncates a string to the number of words specified.
string | $string | The string to truncate. |
int | $count | How many words from original string to include into truncated string. |
string | $suffix | String to append to the end of truncated string. |
bool | $asHtml | Whether to treat the string being truncated as HTML and preserve proper HTML tags. This parameter is available since version 2.0.1. |
Truncate a string while preserving the HTML.
string | $string | The string to truncate |
int | $count | |
string | $suffix | String to append to the end of the truncated string. |
string | bool | $encoding |
Check if given string starts with specified substring. Binary and multibyte safe.
string | $string | Input string |
string | $with | Part to search inside the $string |
bool | $caseSensitive | Case sensitive search. Default is true. When case sensitive is enabled, $with must exactly match the starting of the string in order to get a true value. |
Check if given string ends with specified substring. Binary and multibyte safe.
string | $string | Input string to check |
string | $with | Part to search inside of the $string. |
bool | $caseSensitive | Case sensitive search. Default is true. When case sensitive is enabled, $with must exactly match the ending of the string in order to get a true value. |
Explodes string into array, optionally trims values and skips empty ones.
string | $string | String to be exploded. |
string | $delimiter | Delimiter. Default is ','. |
mixed | $trim | Whether to trim each element. Can be:
|
bool | $skipEmpty | Whether to skip empty strings between delimiters. Default is false. |
Counts words in a string.
string | $string |
Returns string representation of number value with replaced commas to dots, if decimal point of current locale is comma.
int | float | string | $value |
Encodes string into "Base 64 Encoding with URL and Filename Safe Alphabet" (RFC 4648).
Note: Base 64 padding
=
may be at the end of the returned string.=
is not transparent to URL encoding.
string | $input | the string to encode. |
Decodes "Base 64 Encoding with URL and Filename Safe Alphabet" (RFC 4648).
string | $input | encoded string. |
Safely casts a float to string independent of the current locale.
The decimal separator will always be .
.
float | int | $number | a floating point number or integer. |
Checks if the passed string would match the given shell wildcard pattern. This function emulates [[fnmatch()]], which may be unavailable at certain environment, using PCRE.
string | $pattern | the shell wildcard pattern. |
string | $string | the tested string. |
array | $options | options for matching. Valid options are: |
true
.true
.false
.