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.

Adding css class to an element generated with \Phalcon\Tag in Volt

Hello I've been reading documentation and I've encountered that I can generate for example a link with a custom class name by <?= Tag::linkTo(array('products/edit/10', 'Edit', 'class' => 'edit-btn')) ?> in .phtml but I havent found any alternative using Volt. So is there a possibility of doing that? Thank you

edited Mar '14

This is the Solution:

{{ link_to('products/edit/10', 'Edit', 'class':'edit-btn') }}


5.9k
edited Mar '14

thank you very much! since I have this topic I have another question if you dont mind. Is there a possiblity to do
{{ link_to("login", ""}} around any element? Like for example if i can create a login button, so it would look like <a href="login"> <button class="btn">Login</button> </a>

edited Mar '14

Yes of course. It's possible like this:

{{ link_to('products/edit/10', '<button>botton text</button>') }}

BUT I think it's better to style the "A" tag like button with css instead of using this kind of markup.


For example in Twitter bootstrap we have "btn" class

<a href="#" class="btn">Link</a>.

Or you can style it yourself without using bootstrap or any other css framework.



5.9k
Accepted
answer
edited Mar '14

oh yes I havent think of that (the solution) I though it would strip the tags and stuff automaticaly so I could do that. Again thank you! and yea I'll use the boostrap aproach.