Pass custom Entity data into base.blade.php template
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Pass custom Entity data into base.blade.php template
Hello,
I'm using Laravel package with Aimeos 2022.10
I'd like to know how to pass data from a custom Entity into my extension's base.blade.php template.
In this way, I can include this data in the header of my site so that it appears on all pages.
Please note that I'm not using a controller for this template.
I've seen some information about Decorators, but I'm not sure if this is what I need, or how to implement it.
Do you have any suggestions on how to accomplish this?
Thanks in advance
I'm using Laravel package with Aimeos 2022.10
I'd like to know how to pass data from a custom Entity into my extension's base.blade.php template.
In this way, I can include this data in the header of my site so that it appears on all pages.
Please note that I'm not using a controller for this template.
I've seen some information about Decorators, but I'm not sure if this is what I need, or how to implement it.
Do you have any suggestions on how to accomplish this?
Thanks in advance
Re: Pass custom Entity data into base.blade.php template
Do you want to add something like contact information in the header/footer?
If it's something simple like that, I keep it in the site config (Settings).
All you need to do is add more form fields with new names like this name="item[locale.site.config][my-field]".
To add more fields, you need to override this file in your extension:
templates/admin/jqadm/settings/item.php
Then in base.blade.php:
If you need to add something more complex, you should go with a component.
In base.blade.php add a @yield('your_component') where you want your component to appear.
Create the component:
https://aimeos.org/docs/2022.x/frontend ... omponents/
If you want to add your component to the home page, you need to override this file in your extension:
/views/catalog/home.blade.php
Add your component's section:
If it's something simple like that, I keep it in the site config (Settings).
All you need to do is add more form fields with new names like this name="item[locale.site.config][my-field]".
To add more fields, you need to override this file in your extension:
templates/admin/jqadm/settings/item.php
Then in base.blade.php:
Code: Select all
@php
$context = app( 'aimeos.context' )->get();
$myconf = $context->config()->get( 'my-field' );
@endphp
<p>{{ $myconf ?? '' }}</p>
In base.blade.php add a @yield('your_component') where you want your component to appear.
Create the component:
https://aimeos.org/docs/2022.x/frontend ... omponents/
If you want to add your component to the home page, you need to override this file in your extension:
/views/catalog/home.blade.php
Add your component's section:
Code: Select all
@section('your_component')
<?= $aibody['yourcomponent'] ?? '' ?>
@stop
Re: Pass custom Entity data into base.blade.php template
Hello,
Thanks for your feedback kdim95.
Your second solution worked. I created a component and added the section to my blade.php template.
Thanks again!
Thanks for your feedback kdim95.
Your second solution worked. I created a component and added the section to my blade.php template.
Thanks again!