{$smarty} reserved variable The PHP reserved {$smarty} variable can be used to access several enviroment and request variables. The full list of them follows. Request variables {* display value of page from URL ($_GET) phplessonstips.blogspot.in/index.php?page=foo *} {$smarty.get.page} {* display the variable "page" from a form ($_POST['page']) *} {$smarty.post.page} {* display the value of the cookie "username" ($_COOKIE['username']) *} {$smarty.cookies.username} {* display the server variable "SERVER_NAME" ($_SERVER['SERVER_NAME'])*} {$smarty.server.SERVER_NAME} {* display the system environment variable "PATH" *} {$smarty.env.PATH} {* display the php session variable "id" ($_SESSION['id']) *} {$smarty.session.id} {* display the variable "username" from merged get/post/cookies/server/env *} {$smarty.request.username} {$smarty.now} The current timestamp can be accessed with {$smarty.now} {* use the date_format modifier to show current date and time *} {$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'} {$smarty.version} Returns the version of Smarty the template was compiled with.
Showing posts with label Smarty Tips. Show all posts
Showing posts with label Smarty Tips. Show all posts
Monday, 1 September 2014
Smarty: Request variables and other useful smarty functions
Friday, 28 March 2014
Use of in_array function in smarty
use of in_array function in smarty
{if in_array($needle, $array)} {/if}
{if in_array($needle, $array)} {/if}
Wednesday, 24 April 2013
Smarty plugin FOR X CART
<?php
/*
* Smarty plugin BY happylifetruelife
* ————————————————————-
* File: function.recurse_array.php
* Type: function
* Name: recurse_array
* Purpose: prints out elements of an array recursively
* Author: happylifetruelife
* ————————————————————-
*/
function smarty_function_recurse_array($params, &$smarty)
{
if (is_array($params['array']) && count($params['array']) > 0)
{
$markup = '';
$markup .= '<ul>';
foreach ($params['array'] as $element)
{
$markup .= '<li>';$arrow = '';
if (isset($element['children']) && $element['parent'] > 0){
$arrow = 'sub-link-2';
}
$productcount = '';
if (array_key_exists('products_count', $element) && $element['parent'] > 0) {
$productcount = ' ('.$element['products_count'].')';
}
$markup .='<a id="tabSr'.$element['id'].'" class="main-tabs '.$arrow.'" href="'.$element['link'].'">'.$element['title'].$productcount.'</a>';
if (isset($element['children'])) {
$markup .= smarty_function_recurse_array(array('array' => $element['children']), $smarty);
}
$markup .= '</li>';
}
$markup.= '</ul>';
return $markup;
}
else {
return '';
}
}
/*
* Smarty plugin BY happylifetruelife
* ————————————————————-
* File: function.recurse_array.php
* Type: function
* Name: recurse_array
* Purpose: prints out elements of an array recursively
* Author: happylifetruelife
* ————————————————————-
*/
function smarty_function_recurse_array($params, &$smarty)
{
if (is_array($params['array']) && count($params['array']) > 0)
{
$markup = '';
$markup .= '<ul>';
foreach ($params['array'] as $element)
{
$markup .= '<li>';$arrow = '';
if (isset($element['children']) && $element['parent'] > 0){
$arrow = 'sub-link-2';
}
$productcount = '';
if (array_key_exists('products_count', $element) && $element['parent'] > 0) {
$productcount = ' ('.$element['products_count'].')';
}
$markup .='<a id="tabSr'.$element['id'].'" class="main-tabs '.$arrow.'" href="'.$element['link'].'">'.$element['title'].$productcount.'</a>';
if (isset($element['children'])) {
$markup .= smarty_function_recurse_array(array('array' => $element['children']), $smarty);
}
$markup .= '</li>';
}
$markup.= '</ul>';
return $markup;
}
else {
return '';
}
}
Subscribe to:
Posts (Atom)
List OF BANK PAN Numbers
List OF BANK PAN Numbers Bank/Home Loan Providers PAN Number Allahabad Bank AACCA8464F Andhra Bank AABCA7375C Axis Bank...
-
//Regular expression for validate eamil var email_reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/; var email = "sanjay@demo.com...
-
Create HomePageBanner Module for X cart in Few Steps Directory Structure. Catelog -admin -- home_banners.php (new file) ...
-
Function for DELETE ALL CHILDREN OF A PARENT CATEGORIES function deleteChildren($parentId) { $lochid = new Location(); $childr...