Is it possible to defining arrays in config files in smarty?? for example I want have small data base in config file (located in /configs) - few (about 20) products descriptions: title, price, description. After that I want to list it via foreach or section.
How can I define that array in Smarty without MySql or other db engine. Can I do...
<a href="" onClick="return select_item(<embed src=\"player.swf\" allowfullscreen=\"true\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" FlashVars=\"id=&flv=1257568908_.flv\" type=\"application/x-shockwave-flash\" width=\"450\" height=\"371\"></embed>')>
The above returns an "unterminated string literal" e...
Hello,
How can i make the selected link from the List below, bold, that you see you are on Page ex. 3 or 5
With this code if you click on a Link you dont know on which page you are.
The smarty code looks like this;
{section name="sitelinks" start=0 loop=$total->sitelinks}
<span class='tag'>
<a href='/member/{$campaign->id}?start={$...
Hi,everyone. I am working on a site with smarty templates using php and a mysql database.
This is a more specific question than my first one which asked how to pass methods to a class. I thought it would be easier to repackage the question than edit the old one.
I have written a paginator script for my image gallery which displays imag...
I want to do something like:
class Name{
function assign($name,$value){
}
}
Which is pretty much the same as assign in smarty
$smarty->assign('name',$value);
$smarty->display("index.html");
How to implement this?
...
$smarty->assign('name',$value);
$smarty->display("index.html");
So that it automatically replaces $variables in index.html which saves a lot of echo?
...
We use Smarty and time to time it really takes a lot of time for it to render a template. Normally it works fine, but sometimes (like 1 random pageview out of 1 000) it takes about 5 seconds to render a template. We don't use smarty functions or plugins, just simple variables. What might be wrong, where to look? Templates are already com...
Hi i am trying to do concatenation in smarty. Here is an example of how i would like to use the code. The php assigns
$smarty->assign('myvar',array(1,5,6,4));
$smarty->assign('myvar2',array('a1'=>1,'a2'=>2,'a3'=>3,'a4'=>4));
And the template page
{foreach from=$myvar item=v}
{if $v == $myvar2.a+$v}
match
{else}
no mat...
Is it possible to check for a session with out starting one?
The reason that I ask is, the app I am developing has an integrated admin interface. So when an admin is logged in they browse the same pages as the users to make their edits. Fields and options are shown based on the users privs.
This is causing two problems.
One is Becau...
I'm currently using the Smarty templating system for our production site, but am curious how much of a performance hit I'm taking by using this templating engine. Are there faster alternatives? Is there a way to code so I may not have to use such a templating system? Thank you!
...
Hi guys!
A man wants me to redesign a site run in PHP (VideoCMS). But when I asked him to send me the source he has given me *.tpl files instead of *.php. There is some code inside them:
{include file='header.tpl' p="article"}
<br />
<table width="886" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" valign="top...
Hmm.. thats realy different problem
I fetch $links from db
linke this
$links = $db->GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS = '2' AND CATEGORY_ID = ".$db->qstr($id)." {$feat_where} {$expire_where} ORDER BY {$sort_cols[$sort]} {$sort_ord[$sort]} {$limit}");
The array looks like this
array(28) {
["ID"]=>
str...
I'm working on a modification from a theme in the open source project "gallery2".
Here is the code that I am looking at:
For anyone familiar with it, its in the SearchShowAll.tpl file in the search module in the modules section of the download.
<ul class="giInfo">
{foreach from=$result.fields item=field }
<li>
...
I probably should have, but I've never seen this before. Ran into it when looking over the documenation of a Smarty Plugin.
$smarty =& new Smarty;
The =& sign in particular. If you enter it in Google, it gets ignored, just like any other search engine. What is this used for?
Same goes for this function signature:
function connect(&$...
Variable assigned in my template is {$testVariable_123}, where 123 is auto generated and is also assigned to template as {$autoValue}
So in my template I want to get value of above variable.
{assign var="anotherValue" value="testVariable_"|cat:$autoValue}
So if I print {$anotherValue} instead of value I get string 'testVariable_123'
...
I have assigned a smarty variable as such in my php file:
$smarty->assign('companyname', $_SESSION['companyname']);
How to mix regular html string with smarty variable?
I want to do something like:
<a href="/${companyname}/hello" class="mainMenu"/>
But the smarty template engine fails to evaluate properly the variable companyname
...
Hey Guys,
I am having an issue modifying a smarty variable by reference. Here is what I am trying to do:
class foo {
$property;
public function getProperty(){
return $this->$property;
}
public function index(&$smarty){
$smarty->assign('test',$this->getProperty());
}
}
$smarty = new Smarty();
$foo ...
Hey,
I am going to start using codeigniter, but since it only offers to cache everything or nothing (which would not work, because I have logins, and other areas which cannot be cached) I was wondering whether it is a good idea to use Smarty.
The only concern I have in this question is speed. (No yes/no smarty general question.)
My Qu...
<?LANG(no_download, 'you are not allowed to download')
instead of
$lang[no_download]
I have what I think is a better approach for embedding language strings in templates.
In almost all the PHP applications, the predominant language placeholder format is like <?=$lang['no_download']?> or {{no_download}}. Other designers/developers/t...
There is a simple table of news articles: [ id | title | body | created ].
What is the best way to create a simple news archive using smarty from a full collection of articles ordered by created date?
In the format:
2009
12.11. Title
03.03. Title
01.01. Title
2008
11.12. Title
04.03. Title
02.03. Title
16.02. Title
2007
...
...
...