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

Moved servers, now things have gone wrong...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
_Will
Smarty Rookie


Joined: 17 Apr 2003
Posts: 5

PostPosted: Wed Apr 23, 2003 4:47 pm    Post subject: Moved servers, now things have gone wrong... Reply with quote

I moved servers recently and think this could be something to do with some different php settings.

Anyway, when calling my header.tpl I send it a variable/s to construct the <title> </title> tags. Sometimes it is an array, sometimes just a single variable.

I'd call it from one of my main template files like this:

Code:
{section name=sp loop=$results}
{include file="header.tpl" title="$results[sp].title - By $results[sp].name"}
{/section}


And the header file is:

Code:
<title>{$title|truncate:100|default:"Some default text"}</title>


As you can see when I'm calling the include file in the template, I'm sending it the results from an array. This causes the title to show up when the template is parsed as "Array.title - By Array.name". However, if I've sent just a single variable to the header, it works fine.

Any ideas?
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Apr 23, 2003 4:52 pm    Post subject: Reply with quote

with 2.5.0 you have to use backticks inside "" to glue
complex variables together:

Code:

{section name=sp loop=$results}
{include file="header.tpl" title="`$results[sp].title` - By `$results[sp].name`"}
{/section}


with 2.5.0-RC2 this was still
Code:
"$`results[sp].title`"
but this has changed before the release. use 2.5.0 final or the head of cvs with this
Code:
"`$results[sp].title`"
syntax.

HTH
messju
Back to top
View user's profile Send private message Send e-mail Visit poster's website
_Will
Smarty Rookie


Joined: 17 Apr 2003
Posts: 5

PostPosted: Wed Apr 23, 2003 5:05 pm    Post subject: Reply with quote

Thanks for the quick reply but now I just get:

<title>'Array[sp].title' - By 'Array[sp].name'</title>
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Apr 23, 2003 5:12 pm    Post subject: Reply with quote

Use backticks, not single quotes.
Back to top
View user's profile Send private message Visit poster's website
Tom Sommer
Administrator


Joined: 16 Apr 2003
Posts: 47
Location: Denmark

PostPosted: Wed Apr 23, 2003 5:31 pm    Post subject: Reply with quote

backtick: `
Single Quote: '

Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
_Will
Smarty Rookie


Joined: 17 Apr 2003
Posts: 5

PostPosted: Wed Apr 23, 2003 6:01 pm    Post subject: Reply with quote

Ok, with back ticks I now get:

<title>`Array[sp].title` - By `Array[sp].name`</title>

Confused
Back to top
View user's profile Send private message
Tom Sommer
Administrator


Joined: 16 Apr 2003
Posts: 47
Location: Denmark

PostPosted: Wed Apr 23, 2003 6:06 pm    Post subject: Reply with quote

Show us the smarty code too....
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Apr 23, 2003 6:09 pm    Post subject: Reply with quote

with 2.5.0 final this should work. you output looks like 2.5.0-RC2 ???
Back to top
View user's profile Send private message Send e-mail Visit poster's website
_Will
Smarty Rookie


Joined: 17 Apr 2003
Posts: 5

PostPosted: Wed Apr 23, 2003 6:11 pm    Post subject: Reply with quote

Ok, big rush of blood to the cheeks time.. Embarassed

I had just tested with RC2 and forgot to go back to the latest before using the back-ticks. Laughing

Thanks for your time guys, all fixed now!

(Moral of the story for me: Read docs more carefully!)
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


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