# \Thelia\Core\Template\Smarty\PluginsTheliaLoop

The class all Smarty Thelia plugin shoud extend

Class AbstractSmartyPlugin

## Summary

Methods
Properties
Constants
__construct()
getPagination()
theliaCount()
theliaLoop()
theliaElseloop()
theliaIfLoop()
theliaPageLoop()
setLoopList()
getPluginDescriptors()
getNormalizedParam()
getParam()
No public properties found
No constants found
checkEmptyLoop()
createLoopInstance()
_explode()
$pagination
$loopDefinition
$request
$dispatcher
$securityContext
$loopstack
$varstack
N/A
No private methods found
No private properties found
N/A

File
  Core/Template/Smarty/Plugins/TheliaLoop.php
Package
  \Default
Class hierarchy
  \Thelia\Core\Template\Smarty\AbstractSmartyPlugin
  \Thelia\Core\Template\Smarty\Plugins\TheliaLoop

## Tags

None found

## Properties

### $pagination

    $pagination

#

## Tags

None found

### $loopDefinition

    $loopDefinition

#

## Tags

None found

### $request

    $request

#

## Tags

None found

### $dispatcher

    $dispatcher

#

## Tags

None found

### $securityContext

    $securityContext

#

## Tags

None found

### $loopstack

    $loopstack

#

## Tags

None found

### $varstack

    $varstack

#

## Tags

None found

## Methods

### __construct()

    __construct(\Symfony\Component\HttpFoundation\Request $request, \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher, \Thelia\Core\Security\SecurityContext $securityContext)

#### Parameters

\Symfony\Component\HttpFoundation\Request | $request |
\Symfony\Component\EventDispatcher\EventDispatcherInterface | $dispatcher |
\Thelia\Core\Security\SecurityContext | $securityContext |

#

## Tags

None found

### getPagination()

    getPagination(mixed $loopId) : \PropelModelPager

#### Parameters

mixed | $loopId |

#### Returns

\PropelModelPager

#

static

## Tags

None found

### theliaCount()

    theliaCount( $params,  $template)

Process the count function: executes a loop and return the number of items found

#### Parameters

| $params |
| $template |

#

## Tags

None found

### theliaLoop()

    theliaLoop(\Thelia\Core\Template\Smarty\Plugins\unknown $params, \Thelia\Core\Template\Smarty\Plugins\unknown $content, \Thelia\Core\Template\Smarty\Plugins\unknown $template, \Thelia\Core\Template\Smarty\Plugins\unknown $repeat) : string

Process {loop name="loop name" type="loop type" .

.. } ... {/loop} block

#### Parameters

\Thelia\Core\Template\Smarty\Plugins\unknown | $params |
\Thelia\Core\Template\Smarty\Plugins\unknown | $content |
\Thelia\Core\Template\Smarty\Plugins\unknown | $template |
\Thelia\Core\Template\Smarty\Plugins\unknown | $repeat |

#### Throws

\InvalidArgumentException

#### Returns

string

#

## Tags

None found

### theliaElseloop()

    theliaElseloop(\Thelia\Core\Template\Smarty\Plugins\unknown $params, \Thelia\Core\Template\Smarty\Plugins\unknown $content, \Thelia\Core\Template\Smarty\Plugins\unknown $template, \Thelia\Core\Template\Smarty\Plugins\unknown $repeat) : \Thelia\Core\Template\Smarty\Plugins\Ambigous

Process {elseloop rel="loopname"} .

.. {/elseloop} block

#### Parameters

\Thelia\Core\Template\Smarty\Plugins\unknown | $params |
\Thelia\Core\Template\Smarty\Plugins\unknown | $content |
\Thelia\Core\Template\Smarty\Plugins\unknown | $template |
\Thelia\Core\Template\Smarty\Plugins\unknown | $repeat |

#### Returns

\Thelia\Core\Template\Smarty\Plugins\Ambigous —

<string, unknown>

#

## Tags

None found

### theliaIfLoop()

    theliaIfLoop(\Thelia\Core\Template\Smarty\Plugins\unknown $params, \Thelia\Core\Template\Smarty\Plugins\unknown $content, \Thelia\Core\Template\Smarty\Plugins\unknown $template, \Thelia\Core\Template\Smarty\Plugins\unknown $repeat) : \Thelia\Core\Template\Smarty\Plugins\Ambigous

Process {ifloop rel="loopname"} .

.. {/ifloop} block

#### Parameters

\Thelia\Core\Template\Smarty\Plugins\unknown | $params |
\Thelia\Core\Template\Smarty\Plugins\unknown | $content |
\Thelia\Core\Template\Smarty\Plugins\unknown | $template |
\Thelia\Core\Template\Smarty\Plugins\unknown | $repeat |

#### Returns

\Thelia\Core\Template\Smarty\Plugins\Ambigous —

<string, unknown>

#

## Tags

None found

### theliaPageLoop()

    theliaPageLoop(mixed $params, mixed $content, mixed $template, mixed $repeat) : string

Process {pageloop rel="loopname"} .

.. {/pageloop} block

#### Parameters

mixed | $params |
mixed | $content |
mixed | $template |
mixed | $repeat |

#### Throws

\InvalidArgumentException

#### Returns

string

#

## Tags

None found

### setLoopList()

    setLoopList(array $loopDefinition)

Injects an associative array containing information for loop execution

key is loop name value is the class implementing/extending base loop classes

ex :

$loop = array( "product" => "Thelia\Loop\Product", "category" => "Thelia\Loop\Category", "myLoop" => "My\Own\Loop" );

#### Parameters

array | $loopDefinition |

#### Throws

\InvalidArgumentException

  if loop name already exists

#

## Tags

None found

### getPluginDescriptors()

    getPluginDescriptors() : \Thelia\Core\Template\Smarty\an

#### Returns

\Thelia\Core\Template\Smarty\an —

array of SmartyPluginDescriptor

#

abstract

Inherited from
  \Thelia\Core\Template\Smarty\AbstractSmartyPlugin

## Tags

None found

### getNormalizedParam()

    getNormalizedParam(array $params, mixed $name, mixed $default) : mixed

Get a function or block parameter value, and normalize it, trimming balnks and making it lowercase

#### Parameters

array | $params | the parameters array
mixed | $name | as single parameter name, or an array of names. In this case, the first defined parameter is returned. Use this for aliases (context, ctx, c)
mixed | $default | the defaut value if parameter is missing (default to null)

#### Returns

mixed —

the parameter value, or the default value if it is not found.

#

Inherited from
  \Thelia\Core\Template\Smarty\AbstractSmartyPlugin

## Tags

None found

### getParam()

    getParam(array $params, mixed $name, mixed $default) : mixed

Get a function or block parameter value

#### Parameters

array | $params | the parameters array
mixed | $name | as single parameter name, or an array of names. In this case, the first defined parameter is returned. Use this for aliases (context, ctx, c)
mixed | $default | the defaut value if parameter is missing (default to null)

#### Returns

mixed —

the parameter value, or the default value if it is not found.

#

Inherited from
  \Thelia\Core\Template\Smarty\AbstractSmartyPlugin

## Tags

None found

### checkEmptyLoop()

    checkEmptyLoop(\Thelia\Core\Template\Smarty\Plugins\unknown $params, \Thelia\Core\Template\Smarty\Plugins\unknown $template)

Check if a loop has returned results. The loop shoud have been executed before, or an InvalidArgumentException is thrown

#### Parameters

\Thelia\Core\Template\Smarty\Plugins\unknown | $params |
\Thelia\Core\Template\Smarty\Plugins\unknown | $template |

#### Throws

\InvalidArgumentException

#

## Tags

None found

### createLoopInstance()

    createLoopInstance( $smartyParams) : \Thelia\Core\Template\Element\BaseLoop

find the loop class with his name and construct an instance of this class

#### Parameters

| $smartyParams |

#### Throws

\Thelia\Core\Template\Element\Exception\InvalidElementException
\Thelia\Core\Template\Element\Exception\ElementNotFoundException

#### Returns

\Thelia\Core\Template\Element\BaseLoop

#

## Tags

None found

### _explode()

    _explode(\Thelia\Core\Template\Smarty\unknown $commaSeparatedValues) : \Thelia\Core\Template\Smarty\multitype:

Explode a comma separated list in a array, trimming all array elements

#### Parameters

\Thelia\Core\Template\Smarty\unknown | $commaSeparatedValues |

#### Returns

\Thelia\Core\Template\Smarty\multitype:

#

Inherited from
  \Thelia\Core\Template\Smarty\AbstractSmartyPlugin

## Tags

None found

### TheliaLoop.php