Skip to content

block888dev/Smarty_into_MODX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

This is an example of how the Smarty can be used on the MODX frontend. Why use Smarty in MODX? If there is some data in PHP array then MODX can't loop through it inside a chunk or template if you pass this data into the frontend But having loaded the Smarty templator it can easily loop through it as follows:

BACKEND:
var_dump($data)
Array
(
[0] => stdClass Object
    (
        [id] => 1
        [agency_name] => Agency #1
        [created_date] => 2015-03-25 20:23:44
    )

[1] => stdClass Object
    (
        [id] => 2
        [agency_name] => gggg
        [created_date] => 2015-03-25 21:26:06
    )

)
$smarty->assign('results', $data);

{foreach from=$results item=result}
{$result->id}
{/foreach}

About

Load Smarty templator into MODX custom snippet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published