smarty

Disabling caching on the PHP Smarty templating engine?

For some reason I can't get Smarty to stop caching templates, which is really annoying when I'm making changes to templates during development. Can someone tell me where I'm going wrong in disabling all caching?: $smarty = new Smarty(); $smarty->template_dir = SMARTY_PATH."/templates"; $smarty->compile_dir = S...

how to validate an image array in php

<input name= "p_image[]" type="file" id="p_image[]"> i need that user upload atleast one image and if it doesn't it show error.. ...

Website crash (PHP Fatal error) while html coder saving smarty templates

Hello, We're running rather big website (~400K page views daily) and using Smarty as templates engine. HTML coder changes templates every day and every template change (almost every) causes website crash because of PHP Fatal error: Call to undefined function _smarty_tplfunc_f0cb5c08ca1726d224308f2f6bd56b4f_0() in ... PS: Yes, we're usi...

Converting tree-like object structure into an array and interating the whole thing

Hi. I have a tree-like object structure that consists of two types of objects: object of class Category object of class CategoryLink The structure is the following: The whole story begins with an array of Categories that have no parent Each Category has a few unimportant properties and a few important: $parent - containing an id of ...

User validation pattern in PHP with Smarty

I am using PHP and Smarty. I have a simple application that: Shows page header Checks if user is logged in -> check session Checks if user wants to log out -> then clear session If logged in shows a menu. If not logged in, then challenges user for id/password -> set session Shows page footer Now I want to add the following to header:...

Presta shop - smarty cache problem

The question is that has anyone setup the presta shop with cache true and compile false smarty options? If this options are enabled nothing is working as it schould the smarty ->assing can be done only once if you put other value to a placeholder only the first will be active. The adding to cart or deleteing is not working. Any ideas ...

how get swf file size in smarty?

Hi, i have swf file: www.link.com/file.swf How get height and width? Thanks ...

php and smarty var. value

smarty file {php} some php code... $php_var = "{/php}{$smarty_var}{php}"; echo $php_var; some php code ... {/php} smarty file Why '$php_var' value is: ?> How get $smarty_var value? Thanks ...

Using a smarty foreach variable within php tags

Hi, I have the following smarty code: {foreach from=$additional_fields item=v} {if $v.fieldid eq 5} {php} // several pounds of php code here $myfieldid = {$v.fieldid}; // this is wrong {/php} {/if} {/foreach} I'm trying to grab the current field id with my custom php code, in other words {$v...

two forms in smarty template

Hi, i have a feedback form in a website and that is included via a tpl file from a page. i am trying to include another tpl that has the contact us form. when i include this contact us form via .tpl file, the previous form(feedback) doesnt even show up. I tried having different form name, form fields are having different names. way both...

When can you call yourself PHP professional?

What makes you professional PHP programmer? When you know OOP, smarty, framework. I guess that's it, right? If not, then what else? ...

Smarty check if undefined

i am getting errors if smarty variable is undefined. Here is the code: < input type="text" value="{$data.allKeywords} id='keyId' /> I am getting the error: Undefined index: allKeywords. I know the variable - $data.allKeywords is undefined but should it not ignore it if a variable is undefined? Is there a way to check if it is unde...

Arrange list in reverse_array within {foreach}

Hello, I am using {foreach} within smarty like this {foreach key=num item=reply from=$replies} //something goes here. {/foreach} Currently I am getting replies arranged like... Older --> Old --> New --> Newer I want to arrange them in this order Newer --> New --> Old --> Older How to achieve this ? Thanks Solved Thanks to ts ...

theming language in shopify

how can i create my own themeing tags/language or whatever its called like shopify is using? smarty has it also, sorry i dont know what its called. for example in shopify if you type <h1> {{ product.title }} </h1> - this will print out the products title. what im wondering is how can i create my own language of this type using ph...

CSV generation in PHP Smarty

I have the PHP output, which is in table form, and I want that output in CSV format. How can I get that using PHP Smarty? ...

Drop down box depend on another drop down in php smarty

I have one drop down box,which represents company name.I want another drop down box depending on company selected,which represent project for that particular company. Can any 1 help me out. Here's the code <tr><td align="right" valign="top" style="text-align:right"><strong>Company:</strong></td> <td align="left" valign="top...

SmartyPants-PHP not working for string's submitted by post/get?

Finally gave up on my own pretty-quotes function to use SmartyPants-PHP's one-stop SmartyPants() ... except it seems that it doesn't do pretty curly-quotes (just straight quotes) for strings submitted from post forms or get url's. Tested curly quotes to show with SmartyPants on a string defined in the same doc. Replace that string with ...

passing array parameters to smarty PHP template include

On a PHP site using the smarty template engine (or at least a close relative of smarty), I am calling a template include file ("header.html") which contains this code excerpt, along with other HTML omitted here for clarity: <title>{$title|escape:"html"}</title> {if isset($META) && $META} {foreach from=$META item=m} <meta nam...

Caching smarty view render in Yii framework

I'm working with Yii framework and using smarty view render. I have to working with simpleXML_load_file to load simpleXML element and it's can not be cache using data caching with memcache provided by Yii. So I think may be using cache of smarty instead of caching data. Anyone here had caching smarty page in Yii framework give me some ad...

Generating {$num} inside {foreach}

Hello, I working on smarty template. I need to have numbers to my list array So I tried {foreach} {$num} {/foreach} Which prints 0 1 2 3 4 5 ........ I want my numbers to starts from 1 & not 0 How can I achieve this? OR Is there any other way to do it ? Thanks ...