smarty

Constructing arrays in Smarty PHP

Hi, Is it possible to construct an array in Smarty, for example I have tried {def $totalitems[0]=3} But that doesn't seem to work. Is it possible in Smarty? Thanks. ...

how to assign an object to smarty templates?

i created a model object in PHP class User { public $title; public function changeTitle($newTitle){ $this->title = $newTitle; } } How do i expose the property of a User object in smarty just by assigning the object? I know i can do this $smarty->assign('title', $user->title); but my object has something like over 20 p...

php smarty template structure

Hello i new to smarty and i am creating simple php application with using smarty i have file header, left ,body, and footer. main index.php and tpl file in templates folder containig templates.tpl other design tpl i am calling in templates.tpl in index.php index file contains url encode code. i have also folder shop which ha...

smarty path problem

here is my folder index.php smartyhere -Smarty.class.php admin -index.php -users.php in index.php -> $smarty->display('index.tpl'); in admin/index.php -> $smarty->display('adminindex.tpl'); got error Smarty error: unable to read resource: "adminindex.tpl" any idea ? thx ...

if an object property is another object, how do i access that object-property's property or method in smarty?

class A { public $property1; public $objB; public __construct(){ $this->property1 = 'test'; $this->objB = new B(); } } class B { public $title; public __construct(){ $this->title = 'title1'; } } so now i do this in the .php file $a = new A(); in my .tpl i want to display $a->objB->title how do i do that...

Tooltips problem, making this javascript work with my smarty foreach loop, help pelase!

I am using an example of tooltips from http://www.dynamicdrive.com/dynamicindex5/stickytooltip.htm on www.euroworker.no/order I have this code here to work with, but it just doesn't seem to work correctly, I've tried everything I can think of (not a lot of things) Here's the code. {foreach from=$cart.cartItems item="item" name="c...

How to Debug Variables in Smarty like in PHP var_dump()

I have some variables inside a template and i dont know where i assigned them, so i need to know what inside this variable is say i have a var in smarty called member i tryed with {debug} but it didnt work, no popup was shown. How can i debug smarty variables using something like var_dump() inside the templates ? ...

Facebook PHP API with Zend Framework

Hi I am using Zend_Framework's Zend_Controller_Action to build a facebook application. I followed the step by step of this blog for guide : http://blog.madarco.net/91/build-a-facebook-application-with-zend-framework/ public function indexAction() { require_once('facebook.php'); $fb = new Facebook('1234567', '7654321'); $user_i...

Making tooltips in dynamically generated lists

At www.euroworker.no/order I have been trying to add a tooltip function but it seems I have misunderstood it. Is there a simple tooltip I can use in this list? IT needs to display image and text. ...

How do i Convert a Select to a Checkbox

That sounds pretty odd but i have this cod and i need to convert it to checkbox, with the same functionalities <select onchange="document.getElementById('reasonDiv{$test->id}').style.display = ''; document.getElementById('reason{$test->id}').value = this.value;" name='reasonId{$test->id}' id='reasonId{$test->id}'> <option value=''...

How to Create an Array an Look if a value is in Array

How do I create an array in smarty from a given string like 22||33||50 and look if the given number is like the numbers above in smarty ? I have a string say {$test->strings} // contains 33||12||80 I want to look if one of the numbers in {$test->strings} is equal to {$test->myday} how can I do that? ...

How can i use cron job in Social engine?

Hi All, I am new with cron job in php,basically i want to send email to user on certain time of period.i want to send email daily,weekly,monthly,quarterly,yearly,or specific amount of days. In smarty template i want to use this type of function Can any body know how to do tihs? ...

THE FASTEST Smarty Cache Handler

Does anyone know if there is an overview of the performance of different cache handlers for smarty? I compared smarty file cache with a memcache handler, but it seemed memcache has a negative impact on performance. I figured there would be a faster way to cache than through the filesystem... am I wrong? ...

Removing double quotes in Smarty PHP

Hi, Im attempting to remove double quotes passed in a request parameter string. I know Smarty has a escape:'html' function however Id rather just remove all ". Thanks. ...

How to define a variable with random values in Smarty

I need to assign a variable which will be used to create the id label for some html elements. And it needs to be unique. I tried {assign var=unique_id value=`10|mt_rand:20`} and {math equation='rand(10,100)'} But I don't know how to use the result I don't have any other ideas ...

What's the most efficient way to setup a multi-lingual website

Hi, I'm developing a website that will be available in different languages. It is a LAMP (Linux, Apache, MySQL, PHP) setup, and it makes use of Smarty, mostly for the template engine. The way we currently translate is by a self-written smarty plugin, which will recognize certain tags in the HTML files, and will find the corresponding ta...

Smarty html_options

For smarty's html_options function, is there a way to avoid having to do this (other than not using smarty that is)? {if $smarty.post} {html_options name=option_1 options=$options selected=$smarty.post.option_1} {else} {html_options name=option_1 options=$options} {/if} I realize that it won't show up in the template, but it s...

My -tpl file won't update!

Hi, I am running the site at www.euroworker.no, it's a linux server and the site has a backend editor. It's a smarty/php site, and when I try to update a few of the .tpl's (two or three) they don't update. I have tried uploading through FTP and that doesn't work either. It runs on the livecart system. any ideas? Thanks! ...

Passing a Smarty variable into Javascript link "src" attribute

I've assigned a Smarty variable: {assign var="siteurl" value="http://website.com"} I can successfully use it in my header.html file to call a CSS link: <link rel="stylesheet" type="text/css" href="{$siteurl}/style.css" /> displays <link rel="stylesheet" type="text/css" href="http://website.com/style.css" /> However, when I do th...

CakePHP Smarty View with theming support (i.e. Themed Smarty View)

Hi folks, I use Smarty View, but want to benefit from theme options. Since for theming cake use Theme View, I cant use both Smarty and Theme at the same time. Perhaps can combine the code but am not that familar with View eingine core. Already have a lot views done with smarty and do not want to recreate all of them with plain php. Is ...