PHP code example of yepsua / smartwig

1. Go to this page and download the library: Download yepsua/smartwig library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yepsua / smartwig example snippets

 php
oader = new Twig_Loader_Filesystem('templates'); 
$twig = new Twig_Environment($loader, array(
    'cache' => 'cache',
	'debug' => true // Only for dev enviroment.
));

$coreExt = new Yepsua\SmarTwig\Twig\Extension\UICoreExtension();
$coreExt->setBuilders(array(
          "ui.html" => "YsHTML",
          "ui.jqueryCore"  => "YsJQuery",
          "ui.dialog"  => "YsUIDialog",
          "ui.tabs"  => "YsUITabs",
          "ui.accordion"  => "YsUIAccordion",
          "ui.progressbar"  => "YsUIProgressbar",
          "ui.slider"  => "YsUISlider",
          "ui.autocomplete"  => "YsUIAutocomplete",
          "ui.datepicker"  => "YsUIDatepicker",
          "ui.datetimepicker"  => "YsUIDateTimepicker",
          "ui.button"  => "YsUIButton",
          "ui.multiselect"  => "YsUIMultiSelect",
          "ui.picklist"  => "YsUIPickList",
          "ui.popup"  => "YsUIPopUp",
          "ui.selectmenu"  => "YsUISelectMenu",
          "ui.expander"  => "YsUIExpander",
          "ui.splitter"  => "YsUISplitter",
          "ui.dynaselect"  => "YsUIDynamicSelect",
          "ui.menu"  => "YsUIMenu",
          "ui.panel"  => "YsUIPanel",
          "ui.tooltip"  => "YsUITooltip",
          "ui.draggable"  => "YsUIDraggable",
          "ui.droppable"  => "YsUIDroppable",
          "ui.resizable"  => "YsUIResizable",
          "ui.effect"  => "YsUIEffect",
          "ui.video"  => "YsUIVideo"
));

$uiAddonsExt = new Yepsua\SmarTwig\Twig\Extension\UIAddonsExtension();
$uiAddonsExt->setBuilders(array(
	"ui.block" => "YsBlockUI",
	"ui.box" => "YsJQBox",
	"ui.colorpicker" => "YsJQColorPicker",
	"ui.notify" => "YsPNotify",
	"ui.hotkey" => "YsKeys",
	"ui.monitor" => "YsJQMonitor",
	"ui.keypad" => "YsJQKeypad",
	"ui.calculator" => "YsJQCalculator",
	"ui.layout" => "YsJLayout",
	"ui.mask" => "YsJQMask",
	"ui.formWizard" => "YsFormWizard",
	"ui.ajaxForm" => "YsJQForm",
	"ui.validation" => "YsJQValidate",
	"ui.booklet" => "YsJQBooklet",
	"ui.cycle" => "YsJQCycle",
	"ui.ring" => "YsJQRing",
	"ui.upload" => "YsUpload",
));

//Set all extension to Twig

$twig->setExtensions(array(
	new Yepsua\SmarTwig\Twig\Extension\HTMLExtension(),
	new Yepsua\SmarTwig\Twig\Extension\JsSintaxExtension(),
	new Yepsua\SmarTwig\Twig\Extension\JQueryCoreExtension(),
	new Yepsua\SmarTwig\Twig\Extension\UIWidgetExtension(),
	$coreExt,
	$uiAddonsExt
));
 php
oader = new Twig_Loader_Filesystem('templates'); 
$twig = new Twig_Environment($loader, array(
    'cache' => 'cache',
	'debug' => true // Only for dev enviroment.
));

$twig->setExtensions(
	Yepsua\SmarTwig\Twig\Extension\SmarTwigExtension::getAllExtensions()
);

 php
oader = new Twig_Loader_Filesystem('templates'); 
$twig = new Twig_Environment($loader, array(
    'cache' => 'cache',
	'debug' => true // Only for dev enviroment.
));

$twig->setExtensions(
	Yepsua\SmarTwig\Twig\Extension\SmarTwigExtension::getAllExtensions()
);

echo $twig->render('index.html', array('name' => 'Fabien'));