Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Sub String problem.

how can i write this in substring with phalcon

{{blog.description}}

plz help me.



7.8k

Can you explain more ? I don't know what you want to do.

i want ot view my description in upto 200 char. like this. <?php echo mb_strimwidth("Hello World", 0, 10, "..."); ?>

but don't know. how to show it with phalcon.

i'm print my description in this system.

{{blog.description}}



50.7k
Accepted
answer

You can add mb_strimwidth as a Volt function, but the simplest might be to just use plain PHP in your Volt template - that is possible. {{blog.description}}, when referenced in straight PHP is $blog->description.

edited Sep '15

solution for substring....

<?php
if($blog->description) { echo substr($blog->description, 0,200); } ?>