php - Hyperlink Symfony in twig -


i have table movie :

 1. id  2. title  3. content  4. links_id (foreign key) 

and have table links:

 1. id     2. name    3. url 

and have page index.html.twig :

{% link in movie.links %}       <a href="#{{ link.url }}" >{{ link.url }}</a> {% endfor %} 

i view url linked table movie , allowed me redirect site based on url. example have data in table links :

id:1 name : website1 url : www.website1.com id:2 name : website2 url : www.website2.com 

and have data in table movie :

id : 1  title : title1 content : content1 links_id : 1 

when dispaly movie links try :

{% link in movie.links %}       <a href="{{ link.url }}" >{{ link.url }}</a> {% endfor %}  

when click on www.website1.com appears me url :

http://localhost/download/web/app_dev.php/downloads/movie/show/www.website1.com

i redirect in : www.website1.com

you need add schemes url.

<a href="http://{{ link.url }}" >{{ link.url }}</a> 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -