Slatan-ko
Slatan-ko

Reputation: 266

php laravel echo blade html mistake

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

Upvotes: 1

Views: 96

Answers (2)

Pitchinnate
Pitchinnate

Reputation: 7556

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>

Upvotes: 2

Shyam Naru
Shyam Naru

Reputation: 305

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>';

Upvotes: 2

Related Questions