1
josh_cui
A question about smarty variable
  • 2010/10/10 18:35

  • josh_cui

  • Just popping in

  • Posts: 2

  • Since: 2010/10/4


Hello Everyone,

I have the following problem with smarty variables.

In my toy example,

I have the following lines in xoops_version.php
// Templates

$modversion['templates'][1]['file'] = 'interface_index.html';

$modversion['templates'][1]['description'] = '';

I have the following lines in my index.php

$xoopsOption['template_main'] = 'interface_index.html';
.....

$xoopsTpl->assign('uid', $uid);
.....

And, I have the following definition in interface_index.html

<{$uid}>

Up to here, everything works fine. It outputs a userID.

BUT, if I change the variable name $uid in interface_index.html to, say $uid1,

then, the following will not work.

In index.php
$xoopsTpl->assign('uid1', $uid);

In interface_index.html
<{$uid1}>

There is not output.

Moreover, if I try the following line in index.php,
$xoopsTpl->assign('uid', $uid);

and the content of interface_index.html is STILL <{$uid1}>.

It will output the userID.

I just wonder if there is a buffer mechanism that remembers my first declaration of $uid in interface_index.html?

Please let me know what is wrong here.

Many thanks in advance,
Josh




2
zyspec
Re: A question about smarty variable
  • 2010/10/11 14:36

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Yes there is a cache. During development go to System>Preferences>General Settings and then set 'Check templates for modifications ?' to 'Yes'. This will disable template caching.

Don't forget to set this back to 'No' after you're done to help with overall system performance.

3
josh_cui
Re: A question about smarty variable
  • 2010/10/11 23:18

  • josh_cui

  • Just popping in

  • Posts: 2

  • Since: 2010/10/4


It worked!! Thank you very much, zyspec.

Login

Who's Online

361 user(s) are online (228 user(s) are browsing Support Forums)


Members: 0


Guests: 361


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits