How can I get the value 'name' under 'rekenplichtige' in my Blade template? If I do this: {{ $vestiging->rekenplichtige->name }} I get the following error: ErrorException Trying to get property of non-object
That syntax is working to get the 'naam' under 'gemeente'. I have no idea about what's going wrong.
{{ $vestiging->rekenplichtige}}
since "name" inside an array, you should array notation to get name. Like below
{{ $vestiging->rekenplichtige['name'] }}
{{ $vestiging->rekenplichtige()->first()->name }}
This is working.
Related
I am using Youtube package
I added this on app.php
Alaouy\Youtube\YoutubeServiceProvider::class,
&
'Youtube' => Alaouy\Youtube\Facades\Youtube::class,
now i m trying in view like this
{{ Youtube::getVideoInfo('rie-hPVJ7Sw') }}
but getting error
"htmlspecialchars() expects parameter 1 to be string, object given
(View: C:\xampp\htdocs\guru\resources\views\admin\video\index.blade.php)"
how can I fix this?
i Tried
#foreach($videos as $video)
{{ var_dump(Youtube::getVideoInfo($video->videoid)) }}
#endforeach
its showing me everything
Here is Screenshot
As per the docs,
// Return an STD PHP object
$video = Youtube::getVideoInfo('rie-hPVJ7Sw');
so you could do,
{{ var_dump(Youtube::getVideoInfo('rie-hPVJ7Sw')) }}
to print out the object or assign it to a variable and access the respective object properties
EDIT
To show only the embed html you could use the following code
#foreach($videos as $video)
{!! Youtube::getVideoInfo($video->videoid)->player->embedHtml !!}
#endforeach
I am trying to use the url Twig function with Silex to generate a route, but when I use the variable name that I have passed to the template it generates a warning that I have not supplied the parameter.
This is the array I am passing to the template:
[
"total_pages" => $pages,
"current_page" => $page,
"route_name" => "gallery_album",
"route_parameter" => "groupname",
"route_value" => $groupname
]
And in the template I am trying to use:
{{ url(route_name, {route_parameter: route_value, 'page': page} ) }}
(The page variable value is worked out in the template)
This is part of a pagination template that I am building so I need the parameter to be a variable so it can be applied to different pages. This is the error I get when I run this:
I feel this is something that is very simple, I am just missing something fundamental.
It thinks that route_parameter is a string key name and not a variable:
You can do for example:
{% set params = {'page': page, (route_parameter): route_value } %}
{{ url(route_name, params) }}
You can use {{ app->path}} or {{ app->url }}
if you using Silex\Application\UrlGeneratorTrait in you Application class
or alternative using this
{{ app.url_generator.generate('homepage') }}
Here is my regular code in the blade
{{ $Blog->BlogTitle }}
I want to do something like
{{ HTML::link('http://test.com', null, array('id' => 'linkid'))}}
I mean i want to do it in the laravel way..
How can i do this ?
Try the following code
{{ HTML::link(url().'/blog'.$Blog->id, $Blog->BlogTitle)}}
I am new to phalcon framework. I have set the variable email in my TblUserController's edit action as
$tbl_user = TblUser::findFirstByuser_id($user_id);
$this->view->setVar("email", $tbl_user->email);
and in tbl_user/edit.volt I write like:
{{ tbl_user.email }}
but it gives error
Undefined variable: tbl_user
I'm not familiar with Phalcon but I think you need to do:
$this->view->setVar("email", $tbl_user->email);
And use:
{{ email }}
Or
$this->view->setVar("tbl_user", $tbl_user);
And use:
{{ tbl_user.email }}
I need to input text name and id dynamically and I am trying as below
{{ Form::text('practice', $practice->name, array('class' => 'large-2','id'=<?php echo $inputTextName;?>)) }}
But it is not parsing PHP here. Even I tried 'id'={{$inputTextName}} but it is giving error.
Can you try this,
{{ Form::text('practice', $practice->name, array('class' => 'large-2','id'=>$inputTextName)) }}