Custom Template
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Custom Template
Hello community!
Aimeos seems to me a very interesting project. But the documentation is a bit confusing when referring to overwriting views.
Someone has a tutorial or I could give a guide on how to do?
Thank you.
Aimeos seems to me a very interesting project. But the documentation is a bit confusing when referring to overwriting views.
Someone has a tutorial or I could give a guide on how to do?
Thank you.
Re: Custom Template
The views itself are pretty straight forward: Just HTML with alternative PHP syntax.
You have access to all data that has been assigned by the HTML client which renders the view as well as all data that has been assigned by parent HTML clients, e.g.
|Client/Html/Catalog/Detail/Standard
| => template: catalog/detail/body-default.php
| => assigns: detailProductItem, detailProductMediaItems, etc.
|- Client/Html/Catalog/Detail/Basket/Standard
| => template: catalog/detail/basket-body-default.php
| => assigns: basketStockUrl, etc.
|-- Client/Html/Catalog/Detail/Basket/Selection/Standard
| => template: catalog/detail/basket-selection-body-default.php
| => assigns: selectionProducts, selectionAttributeItems, etc.
In the template of the selection HTML client, you have now access to selectionProducts, selectionAttributeItems, basketStockUrl, detailProductMediaItems, detailProductItem. You should have a look into the templates and the HTML clients to find out which data they assign.
To access the data in the view, you can use
Additionally, there are some view helpers available. They are located in:
https://github.com/aimeos/aimeos-core/t ... iew/Helper
To use the view helpers in the view, call e.g.
The example prints the generated URL for the given parameters. Use lower-case for all view helpers, i.e. "url()" for the view helper in the "Url" directory. The parameters for each view helper varies, so so should have a look into the interface or implementation of the view helper you want to use.
These are the view helpers that are available:
* block: Extend from parent templates like in Blade or Twig
* config: Access to the configuration settings
* content: Generate media URL
* csrf: CSRF security for form posts
* date: Localized dates
* encoder: Quoting output to avoid security breaches
* formparam: Generates values for the "name" attribute of input elements
* mail: Access to an e-mail message that can be filled
* number: Localized number format
* param: Access to get/post/url parameters
* partial: Renders the given sub-template
* request: PSR-7 request object
* response: PSR-7 response object
* url: Generates URLs
* value: Access values in multi-dimensional arrays in a simple way
Hope that helps a bit
You have access to all data that has been assigned by the HTML client which renders the view as well as all data that has been assigned by parent HTML clients, e.g.
|Client/Html/Catalog/Detail/Standard
| => template: catalog/detail/body-default.php
| => assigns: detailProductItem, detailProductMediaItems, etc.
|- Client/Html/Catalog/Detail/Basket/Standard
| => template: catalog/detail/basket-body-default.php
| => assigns: basketStockUrl, etc.
|-- Client/Html/Catalog/Detail/Basket/Selection/Standard
| => template: catalog/detail/basket-selection-body-default.php
| => assigns: selectionProducts, selectionAttributeItems, etc.
In the template of the selection HTML client, you have now access to selectionProducts, selectionAttributeItems, basketStockUrl, detailProductMediaItems, detailProductItem. You should have a look into the templates and the HTML clients to find out which data they assign.
To access the data in the view, you can use
Code: Select all
$this->get( 'selectionProducts', array() ); // second parameter is the default value if not available
$this->selectionProducts; // (throws an exception if not available)
https://github.com/aimeos/aimeos-core/t ... iew/Helper
To use the view helpers in the view, call e.g.
Code: Select all
echo $this->url( $target, $controller, $action, $params, $trailing, $config );
These are the view helpers that are available:
* block: Extend from parent templates like in Blade or Twig
* config: Access to the configuration settings
* content: Generate media URL
* csrf: CSRF security for form posts
* date: Localized dates
* encoder: Quoting output to avoid security breaches
* formparam: Generates values for the "name" attribute of input elements
* mail: Access to an e-mail message that can be filled
* number: Localized number format
* param: Access to get/post/url parameters
* partial: Renders the given sub-template
* request: PSR-7 request object
* response: PSR-7 response object
* url: Generates URLs
* value: Access values in multi-dimensional arrays in a simple way
Hope that helps a bit
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Custom Template
Yes, the templates are shared in all environments (Laravel, Symfony, Flow, TYPO3, etc.)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Custom Template
This article contains now detailed information and examples about the view helpers too:
https://aimeos.org/docs/Developers/Html ... iew_helper
https://aimeos.org/docs/Developers/Html ... iew_helper
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star