Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Search found 47 matches
Smarty Forum Index
Author Message
  Topic: Modifier - get Smarty object?
kaitlyn2004

Replies: 2
Views: 8415

PostForum: Plugins   Posted: Tue Aug 16, 2011 1:34 pm   Subject: Modifier - get Smarty object?
It seems all plugins supply the template object EXCEPT the modifier plugin implementation.

Is there any (easy) way to write a modifier function but have access to the Smarty object?
  Topic: Plugin parameter without value?
kaitlyn2004

Replies: 2
Views: 8843

PostForum: Plugins   Posted: Mon May 02, 2011 3:20 pm   Subject: Plugin parameter without value?
Getting a smarty error when I want to add a function parameter without a value. Smarty core has this with the "nocache" option...

why can't I have {my_custom_function my_param}

Not eve ...
  Topic: Setting dynamic values...
kaitlyn2004

Replies: 0
Views: 3266

PostForum: General   Posted: Fri Apr 29, 2011 6:23 pm   Subject: Setting dynamic values...
Take for example:

viewproduct.tpl
{include file="header.tpl"}
... a whole bunch of markup/logic/etc.etc. to display a product page
{include file="footer.tpl"&# ...
  Topic: Cannot assign variable with hyphen in key?
kaitlyn2004

Replies: 5
Views: 18107

PostForum: Smarty 3   Posted: Thu Feb 17, 2011 4:51 pm   Subject: Cannot assign variable with hyphen in key?
Hmm.. this works!

{$meta.{"http-equiv"}.{"content-type"}="Testing!"}
  Topic: Cannot assign variable with hyphen in key?
kaitlyn2004

Replies: 5
Views: 18107

PostForum: Smarty 3   Posted: Thu Feb 17, 2011 4:40 pm   Subject: Cannot assign variable with hyphen in key?
I do believe that dash "-" is not a valid Smarty variable name, and that includes array keys. PHP highly discourages them because they appear as subtraction, and you have to enclose things i ...
  Topic: Cannot assign variable with hyphen in key?
kaitlyn2004

Replies: 5
Views: 18107

PostForum: Smarty 3   Posted: Thu Feb 17, 2011 4:40 pm   Subject: Cannot assign variable with hyphen in key?
Saw a couple of discussions saying don't use hyphens in keys..

Problem is I want to do something like:

{$meta.http-equiv.content-type="Test..."}

so that in my header it becomes < ...
  Topic: Cannot assign variable with hyphen in key?
kaitlyn2004

Replies: 5
Views: 18107

PostForum: Smarty 3   Posted: Thu Feb 17, 2011 4:32 pm   Subject: Cannot assign variable with hyphen in key?
It appears this does not work:

{$myvar.my-key.my-sub-key="Test"}

Howver,
$myvar = array(
'my-key' => array(
'my-sub-key' => 'Test'
)
);
is v ...
  Topic: Assign variables for header?
kaitlyn2004

Replies: 1
Views: 5392

PostForum: Smarty 3   Posted: Thu Feb 17, 2011 4:21 pm   Subject: Assign variables for header?
I have something like this:

{$title="My page title" scope="global"}
{$meta.name.keywords="meta keywords" scope="global"}
{$meta.na ...
  Topic: One templates_c dir and use of compile_id
kaitlyn2004

Replies: 3
Views: 5423

PostForum: General   Posted: Thu Feb 10, 2011 2:47 pm   Subject: One templates_c dir and use of compile_id
b) you need multiple compiled files for a single template

Hmm can you give an example when you would need this?
  Topic: One templates_c dir and use of compile_id
kaitlyn2004

Replies: 3
Views: 5423

PostForum: General   Posted: Thu Feb 10, 2011 2:29 pm   Subject: One templates_c dir and use of compile_id
I want to use a single templates_c dir and also a single templates dir

/templates
/templates/common/header.tpl
/templates/common/footer.tpl
/templates/section/file1.tpl
/templates/section/file2 ...
  Topic: str_repeat problem?
kaitlyn2004

Replies: 4
Views: 16095

PostForum: Smarty 3   Posted: Wed Mar 17, 2010 5:51 pm   Subject: str_repeat problem?
So before I would use:

{'&nbsp;'|str_repeat:4*$depth}

but now with smarty 3, my output is just a "0" and I had to change to:

{str_repeat('&nbsp;',4*$d ...
  Topic: Cache files in compile directory?
kaitlyn2004

Replies: 1
Views: 3819

PostForum: General   Posted: Tue Mar 09, 2010 9:42 pm   Subject: Cache files in compile directory?
I seem to have cache files in my compile folder, one for each file that gets included.

They look like:

[some md5 hash].file.[include file].cache.php

Should these files be here or have I messe ...
  Topic: {include} relative to template?
kaitlyn2004

Replies: 5
Views: 9947

PostForum: General   Posted: Mon Mar 08, 2010 6:49 pm   Subject: {include} relative to template?
Ok, looking at your 1st post again, looks like you will need

{include file='common/header.tpl'}

Ah, ya... doh!

Brain fart Smile
  Topic: {include} relative to template?
kaitlyn2004

Replies: 5
Views: 9947

PostForum: General   Posted: Mon Mar 08, 2010 6:44 pm   Subject: {include} relative to template?
Hmm, I have a line that is:

$smary->setTemplateDir(WEB_DOC_ROOT . '/templates');

which is why i am table to display('folder/file.tpl') and have it find the file properly...
  Topic: {include} relative to template?
kaitlyn2004

Replies: 5
Views: 9947

PostForum: General   Posted: Mon Mar 08, 2010 6:20 pm   Subject: {include} relative to template?
Say I have:

/folder/index.php
/templates/folder/file.tpl
/templates/common/header.tpl

in index.php, I display('folder/file.tpl');

in file.tpl, I want to have {include file='../common/header ...
 
Page 1 of 4 Goto page 1, 2, 3, 4  Next
All times are GMT
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP