View previous topic :: View next topic |
Author |
Message |
_Will Smarty Rookie
Joined: 17 Apr 2003 Posts: 5
|
Posted: Wed Apr 23, 2003 4:47 pm Post subject: Moved servers, now things have gone wrong... |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Apr 23, 2003 4:52 pm Post subject: |
|
|
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 |
|
_Will Smarty Rookie
Joined: 17 Apr 2003 Posts: 5
|
Posted: Wed Apr 23, 2003 5:05 pm Post subject: |
|
|
Thanks for the quick reply but now I just get:
<title>'Array[sp].title' - By 'Array[sp].name'</title> |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Apr 23, 2003 5:12 pm Post subject: |
|
|
Use backticks, not single quotes. |
|
Back to top |
|
Tom Sommer Administrator
Joined: 16 Apr 2003 Posts: 47 Location: Denmark
|
Posted: Wed Apr 23, 2003 5:31 pm Post subject: |
|
|
backtick: `
Single Quote: '
|
|
Back to top |
|
_Will Smarty Rookie
Joined: 17 Apr 2003 Posts: 5
|
Posted: Wed Apr 23, 2003 6:01 pm Post subject: |
|
|
Ok, with back ticks I now get:
<title>`Array[sp].title` - By `Array[sp].name`</title>
|
|
Back to top |
|
Tom Sommer Administrator
Joined: 16 Apr 2003 Posts: 47 Location: Denmark
|
Posted: Wed Apr 23, 2003 6:06 pm Post subject: |
|
|
Show us the smarty code too.... |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Apr 23, 2003 6:09 pm Post subject: |
|
|
with 2.5.0 final this should work. you output looks like 2.5.0-RC2 ??? |
|
Back to top |
|
_Will Smarty Rookie
Joined: 17 Apr 2003 Posts: 5
|
Posted: Wed Apr 23, 2003 6:11 pm Post subject: |
|
|
Ok, big rush of blood to the cheeks time..
I had just tested with RC2 and forgot to go back to the latest before using the back-ticks.
Thanks for your time guys, all fixed now!
(Moral of the story for me: Read docs more carefully!) |
|
Back to top |
|
|