{"id":20199256,"url":"https://github.com/cleatsquad/magento2-smarty","last_synced_at":"2025-03-03T08:40:25.185Z","repository":{"id":56953601,"uuid":"428266578","full_name":"CleatSquad/magento2-smarty","owner":"CleatSquad","description":"The module is an integration of the Smarty template engine in Magento2.","archived":false,"fork":false,"pushed_at":"2024-04-12T00:57:21.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-13T19:52:04.435Z","etag":null,"topics":["magento2","magento2-module","smarty","smarty-template-engine"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CleatSquad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-15T13:04:19.000Z","updated_at":"2024-04-12T00:38:16.000Z","dependencies_parsed_at":"2025-01-13T19:52:07.661Z","dependency_job_id":"a6982635-7399-41c3-ad48-42dfb770c298","html_url":"https://github.com/CleatSquad/magento2-smarty","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"1ca7e08fa91a7dfc8c42c1f657ff4902f3511ada"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleatSquad%2Fmagento2-smarty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleatSquad%2Fmagento2-smarty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleatSquad%2Fmagento2-smarty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleatSquad%2Fmagento2-smarty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleatSquad","download_url":"https://codeload.github.com/CleatSquad/magento2-smarty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241637147,"owners_count":19994925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["magento2","magento2-module","smarty","smarty-template-engine"],"created_at":"2024-11-14T04:36:40.203Z","updated_at":"2025-03-03T08:40:25.160Z","avatar_url":"https://github.com/CleatSquad.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CleatSquad Magento 2 Smarty\n\n[![Packagist Downloads](https://img.shields.io/packagist/dm/cleatsquad/magento2-smarty?color=blue)](https://packagist.org/packages/cleatsquad/magento2-smarty/stats)\n[![Packagist Version](https://img.shields.io/packagist/v/cleatsquad/magento2-smarty?color=blue)](https://packagist.org/packages/cleatsquad/magento2-smarty)\n[![Packagist License](https://img.shields.io/packagist/l/cleatsquad/magento2-smarty)](https://github.com/cleatsquad/magento2-smarty/blob/main/LICENSE)\n\n## Magento Version Support\n\n![Magento 2.4.6 and above](https://img.shields.io/badge/Magento-2.4%20and%20above-brightgreen.svg?style=flat)\n\n## Purpose\n\n`CleatSquad_Smarty` is a Magento 2 module is an integration of the [Smarty](https://www.smarty.net/) template engine in Magento2.\nTo use this package you need to write your Magento2 module, or you can write all your template files in Smarty.\nThis template engine is intended to be used in addition to the `.tpl` files.\n\n## Getting Started\n\nThis module is intended to be installed via [Composer](https://getcomposer.org/). To add it to your Magento 2 project, follow these steps:\n\n### Installation\n\n1. **Download the package**\n    ```bash\n    composer require cleatsquad/magento2-smarty\n    ```\n\n2. **Enable the module**\n    ```bash\n    ./bin/magento module:enable CleatSquad_Smarty\n    ./bin/magento setup:upgrade\n    ```\n\n## Magento 2 \n\n### Components\n\nA new engine has been added to this module which will allow you to use smarty. and this the injection of the new engine in the class Magento\\Framework\\View\\TemplateEngineFactory.\n\n### Frontend Integration\n\nYour template files must have the file extension `.tpl` to get automatically recognized.\n\nIn your layout xml files or blocks please specify the new template\n\n```xml\n\u003creferenceBlock name=\"page.main.title\" template=\"Magento_Theme::html/title.tpl\"/\u003e\n```\n\n#### Example header.phtml converted to header.tpl\n\n```php\n\u003c?php\n/**\n * @var $block \\Magento\\Theme\\Block\\Html\\Title\n */\n$cssClass = $block-\u003egetCssClass() ? ' ' . $block-\u003egetCssClass() : '';\n$titleHtml = '';\nif (trim($block-\u003egetPageHeading())) {\n    $titleHtml = '\u003cspan class=\"base\" data-ui-id=\"page-title-wrapper\" '\n        . $block-\u003egetAddBaseAttribute()\n        . '\u003e'\n        . $block-\u003eescapeHtml($block-\u003egetPageHeading())\n        . '\u003c/span\u003e';\n}\n?\u003e\n\u003c?php if ($titleHtml) : ?\u003e\n\u003cdiv class=\"page-title-wrapper\u003c?= $block-\u003eescapeHtmlAttr($cssClass) ?\u003e\"\u003e\n    \u003ch1 class=\"page-title\"\n        \u003c?php if ($block-\u003egetId()) : ?\u003e id=\"\u003c?= $block-\u003eescapeHtmlAttr($block-\u003egetId()) ?\u003e\" \u003c?php endif; ?\u003e\n        \u003c?php if ($block-\u003egetAddBaseAttributeAria()) : ?\u003e\n            aria-labelledby=\"\u003c?= $block-\u003eescapeHtmlAttr($block-\u003egetAddBaseAttributeAria()) ?\u003e\"\n        \u003c?php endif; ?\u003e\u003e\n        \u003c?= /* @noEscape */ $titleHtml ?\u003e\n    \u003c/h1\u003e\n    \u003c?= $block-\u003egetChildHtml() ?\u003e\n\u003c/div\u003e\n\u003c?php endif; ?\u003e\n\n```\n\n```tpl\n{if ($block-\u003egetCssClass())}\n    {assign var = \"cssClass\" value = {$block-\u003egetCssClass()}}}\n{else}\n    {assign var = \"cssClass\" value = ''}}\n{/if}\n\n\n{if (trim($block-\u003egetPageHeading()))}\n    {assign var = \"titleHtml\" value = '\u003cspan class=\"base\" data-ui-id=\"page-title-wrapper\" {$block-\u003egetAddBaseAttribute()}\u003e{$block-\u003eescapeHtml($block-\u003egetPageHeading())}\u003c/span\u003e'}\n{else}\n    {assign var = \"titleHtml\" value = ''}}\n{/if}\n{if ($titleHtml)}\n\u003cdiv class=\"page-title-wrapper{$block-\u003eescapeHtmlAttr($cssClass)}\"\u003e\n    \u003ch1 class=\"page-title\"\n        {if ($block-\u003egetId()) : ?\u003e id={$block-\u003eescapeHtmlAttr($block-\u003egetId())}\"{/if}\n        {if ($block-\u003egetAddBaseAttributeAria()) : ?\u003e\n            aria-labelledby=\"{$block-\u003eescapeHtmlAttr($block-\u003egetAddBaseAttributeAria())}\"\n        {/if}\u003e\n        {$titleHtml}\n    \u003c/h1\u003e\n    {$block-\u003egetChildHtml()}\n\u003c/div\u003e\n{/if}\n```\n\n```xml\n\u003creferenceBlock name=\"breadcrumbs\" template=\"Magento_Theme::html/breadcrumbs.tpl\"/\u003e\n```\n\n#### Example breadcrumbs.phtml converted to breadcrumbs.tpl\n\n```php\n\u003c?php if ($crumbs \u0026\u0026 is_array($crumbs)) : ?\u003e\n\u003cdiv class=\"breadcrumbs\"\u003e\n    \u003cul class=\"items\"\u003e\n        \u003c?php foreach ($crumbs as $crumbName =\u003e $crumbInfo) : ?\u003e\n            \u003cli class=\"item \u003c?php echo $crumbName ?\u003e\"\u003e\n            \u003c?php if ($crumbInfo['link']) : ?\u003e\n                \u003ca href=\"\u003c?php echo $crumbInfo['link'] ?\u003e\" title=\"\u003c?php echo $this-\u003eescapeHtml($crumbInfo['title']) ?\u003e\"\u003e\n                    \u003c?php echo $this-\u003eescapeHtml($crumbInfo['label']) ?\u003e\n                \u003c/a\u003e\n            \u003c?php elseif ($crumbInfo['last']) : ?\u003e\n                \u003cstrong\u003e\u003c?php echo $this-\u003eescapeHtml($crumbInfo['label']) ?\u003e\u003c/strong\u003e\n            \u003c?php else: ?\u003e\n                \u003c?php echo $this-\u003eescapeHtml($crumbInfo['label']) ?\u003e\n            \u003c?php endif; ?\u003e\n            \u003c/li\u003e\n        \u003c?php endforeach; ?\u003e\n    \u003c/ul\u003e\n\u003c/div\u003e\n\u003c?php endif; ?\u003e\n```\n\n```tpl\n{if $crumbs}\n    \u003cdiv class=\"breadcrumbs\"\u003e\n        \u003cul class=\"items\"\u003e\n            {foreach from = $crumbs key = crumbName item = crumbInfo}\n            \u003cli class=\"item {$crumbName}\"\u003e\n                {if $crumbInfo.link}\n                    \u003ca href=\"{$crumbInfo.link}\" title=\"{$crumbInfo.title}\"\u003e\n                        {$crumbInfo.label}\n                    \u003c/a\u003e\n                {elseif $crumbInfo.last}\n                    \u003cstrong\u003e{$crumbInfo.label}\u003c/strong\u003e\n                {else}\n                    {$crumbInfo.label}\n                {/if}\n            \u003c/li\u003e\n            {/foreach}\n        \u003c/ul\u003e\n    \u003c/div\u003e\n{/if}\n```\n\n#### Access helper methods\n\nWrite in your `.tpl` file:\n\n```tpl\n{assign var = \"directoryHelper\" value = $this-\u003ehelper(\"Magento\\Directory\\Helper\\Data\")}\n{$directoryHelper-\u003egetDefaultCountry()}\n```\n\n### Configurations\n\nConfiguration options can be found Stores -\u003e Settings -\u003e Configuration -\u003e Advanced -\u003e Developer -\u003e Smarty.\n\n| Section | Group | Field | Description | \n| ------ | ----- | ----- | ----------- |\n| dev | smarty | debug | Disable/Enable debug mode. |\n| dev | smarty| cache | Disable/Enable of the cache of smarty templates (cache stored in var/cache/smarty) |\n\n## Support\n\nIf you need help or have a question, you can:\n\n- Open an issue through GitHub for bug reports and feature requests.\n- Check the [Magento Community Forums](https://community.magento.com/) for general questions and support on Magento.\n- Check on [Magento Stack Exchange](https://magento.stackexchange.com/) for general programming questions.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/cleatsquad/magento-smarty/tags). \n\n## Authors\n\n- **Mohamed EL Mrabet** - *Initial work* - [mimou78](https://github.com/mimou78)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleatsquad%2Fmagento2-smarty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcleatsquad%2Fmagento2-smarty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleatsquad%2Fmagento2-smarty/lists"}