Page 1 of 1

[SOLVED] Smarty variable is empty in </__body>

Posted: Mon Feb 04, 2013 9:07 am
by atz6975
Hi,
i'm struggling with smarty variable scope, although I believe it should be straightforward...

I use cmsms 1.11.4 on Ubuntu 12.04 LTS with php 5.3.10

This Page template produces a page with 456, when I expect 123456
The <head> does contain the 123 comment as expected.

{process_pagedata}<!DOCTYPE html>
<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
{$test="123"}
<!-- {$test} -->
</head>
</__body>
{content assign="notused"}
{$test}456
<__body>
</__html>

Can anybody else reproduce this behaviour and maybe help me understand it?

Thank you very much.

Re: Smarty variable is empty in </__body>

Posted: Mon Feb 04, 2013 11:06 am
by manuel
Dear atz6975,

The reason for this is the "processing order".

You can read more about it here:
http://www.i-do-this.com/blog/75/Under- ... -Templates

Try defining the var at the top of the body instead of inside the head.

Greetings,
Manuel

Re: [SOLVED] Smarty variable is empty in </__body>

Posted: Mon Feb 04, 2013 2:36 pm
by atz6975
YES!
Thank you very much.