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

General project discussion. NOT for help questions.
Post Reply
atz6975
Forum Members
Forum Members
Posts: 34
Joined: Thu Jan 14, 2010 4:43 pm

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

Post 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.
Last edited by atz6975 on Mon Feb 04, 2013 2:36 pm, edited 2 times in total.
User avatar
manuel
Power Poster
Power Poster
Posts: 353
Joined: Fri Nov 30, 2007 9:15 am

Re: Smarty variable is empty in </__body>

Post 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
Do you like your open source cms? Buy from the CMSMS partners || Donate
atz6975
Forum Members
Forum Members
Posts: 34
Joined: Thu Jan 14, 2010 4:43 pm

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

Post by atz6975 »

YES!
Thank you very much.
Post Reply

Return to “General Discussion”