We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How do I express in phtml {{url ('') }} ?

I want to use {{url ('')}} in my phtml forms but can not find the correct syntax as express this:

<div align="right">
    {{ link_to("spm_contacto/new", "<img src='{{ url('img/tolbar/Package-accept-icon.png') }}'> Añadir un nuevo Empleado") }}
</div>
edited Oct '15

for url

$this->url->get("products/search")

for link_to

$this->tag->linkTo("products/search", "Search")

https://docs.phalcon.io/en/latest/reference/tags.html#generating-links



81.2k

How to join the two because I want to put the address of the image within link_to I want a link with a static imgen in all directions?

Maybe you want this:

<div align="right"><a href="{{ url('spmcontacto/new') }}" alt="Añadir un nuevo Empleado"><img src="{{ url('img/tolbar/Package-accept-icon.png') }}" /></a></div>


16.0k
Accepted
answer
edited Oct '15

volt

{{ link_to("spmcontacto/new", "<img src='"~url("img/tolbar/Package-accept-icon.png")~"'> Anadir un nuevo Empleado) }}

phtml

<?php echo $this->tag->linkTo("spmcontacto/new", "<img src='" . $this->url->get("img/tolbar/Package-accept-icon.png") . "'> Anadir un nuevo Empleado") ?>


81.2k

Thank you, yes run as needed, but it seems it is easier to work with volt but due to the syntax checker phtml use netbeans