1

am try to echo this.

echo "<td><a href='{{ URL::to('index/watch/' . $tmpd) }}''>$tmpd </a></td>";

output must be http://localhost:8000/index/watch/myvar

but it also http://localhost:8000/%7B%7B%20URL::to(

what is my echo mistake

2
  • 7
    Don't mix blade template symantics {{...}} with PHP echo statements Commented Apr 29, 2016 at 13:48
  • 1
    I'm not sure if you've run across Laracasts yet (or if you have and you hate them (or if anyone else on the internet has and they hate them, in which case this comment will probably get downvoted into oblivion)) but Jeff put together what felt to me like a pretty solid intro to Blade which you might want to look into. I found the rest of the series helpful as well when I started with Laravel. Commented Apr 29, 2016 at 14:16

2 Answers 2

2

It is always good practice to use laravel helpers. The below code generates the html link that you are looking for.

echo '<td>'.link_to('index/watch/'.$tmpd.'', $tmpd).'</td>';
Sign up to request clarification or add additional context in comments.

1 Comment

You are welcome :) Check out these laravel helper funcitons laravel.com/docs/4.2/helpers#urls
2

As Mark Baker said don't include the whole statement in an echo but also for the url you need to use the unescaped tag {!! !!}:

<td><a href='{!! URL::to('index/watch/' . $tmpd) !!}'>{{ $tmpd }}</a></td>

3 Comments

can i use with php echo ??
no you cant, {{ }} (aka blade tags) are the php echo.
The point of using a template system like blade is so that you don't have to use echo statements.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.