����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 18.188.99.196 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/ideyshare.name.ng/app/libraries/vendor/twig/extensions/doc/ |
Upload File : |
The Text Extension ================== The Text extension provides the following filters: * ``truncate`` * ``wordwrap`` Installation ------------ First, :ref:`install the Extensions library<extensions-install>`. Next, add the extension to Twig:: $twig->addExtension(new Twig_Extensions_Extension_Text()); Wrapping Words -------------- Use the ``wordwrap`` filter to split your text in lines with equal length. .. code-block:: jinja {{ "Lorem ipsum dolor sit amet, consectetur adipiscing"|wordwrap(10) }} This example would print:: Lorem ipsu m dolor si t amet, co nsectetur adipiscing The default separator is "\\n", but you can easily change that by providing one: .. code-block:: jinja {{ "Lorem ipsum dolor sit amet, consectetur adipiscing"|wordwrap(10, "zz\n") }} This would result in:: Lorem ipsuzz m dolor sizz t amet, cozz nsectetur zz adipiscing Truncating Text --------------- Use the ``truncate`` filter to cut off a string after limit is reached .. code-block:: jinja {{ "Hello World!"|truncate(5) }} The example would output ``Hello...``, as ``...`` is the default separator. You can also tell truncate to preserve whole words by setting the second parameter to ``true``. If the last Word is on the the separator, truncate will print out the whole Word. .. code-block:: jinja {{ "Hello World!"|truncate(7, true) }} Here ``Hello World!`` would be printed. If you want to change the separator, just set the third parameter to your desired separator. .. code-block:: jinja {{ "Hello World!"|truncate(7, false, "??") }} This example would print ``Hello W??``.