Skip to content

Rewritten @smarty-php foreach variant that was invented for use in @XOOPS, but nowadays is used in some other PHP based CMS'es (like @ImpressCMS!)

License

Notifications You must be signed in to change notification settings

imponeer/smarty-foreachq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License GitHub release Maintainability PHP Packagist

Smarty ForeachQ

Rewritten (due that original use GPLv2+ license) Smarty foreach variant that was invented for use in XOOPS, but nowadays used in some other PHP based CMS'es (like ImpressCMS!).

See, original version of this smarty plugin in Xoops to see more accurate description why this plugin exists.

Installation

To install and use this package, we recommend to use Composer:

composer require imponeer/smarty-foreachq

Otherwise, you need to include manually files from src/ directory.

Registering in Smarty

If you want to use these extensions from this package in your project you need register them with registerPlugin function from Smarty. For example:

$smarty = new \Smarty();
$foreachqOpenPlugin = new \Imponeer\Smarty\Extensions\ForeachQ\ForeachQOpenTagCompiler();
$foreachqClosePlugin = new \Imponeer\Smarty\Extensions\ForeachQ\ForeachQCloseTagCompiler();
$smarty->registerPlugin('compiler', $foreachqOpenPlugin->getName(), [$foreachqOpenPlugin, 'execute']);
$smarty->registerPlugin('compiler', $foreachqClosePlugin->getName(), [$foreachqClosePlugin, 'execute']);

Using from templates

Example how to use it:

  {foreachq from=$data item=el}
    {$el}
  {/foreachq}

How to contribute?

If you want to add some functionality or fix bugs, you can fork, change and create pull request. If you not sure how this works, try interactive GitHub tutorial.

If you found any bug or have some questions, use issues tab and write there your questions.

About

Rewritten @smarty-php foreach variant that was invented for use in @XOOPS, but nowadays is used in some other PHP based CMS'es (like @ImpressCMS!)

Topics

Resources

License

Stars

Watchers

Forks

Languages