Jump to content

Title problem


kvnirvana

Recommended Posts

On one of my pages I set the title like this

<{assign var="title" value=$people->getShow()|escape}>

 

The problem is I want the title to say getShow and getName

 

Tried to do it like this but I get an internal 500 error

<{assign var="title" value=$people->getShow()|escape}$people->getName()|escape}>

How can I make this work?

 

Thanks in advance

Link to comment
Share on other sites

Out of curiosity, what kind of code is this?

 

This is PHP, this is more than likely rendered through an MVC framework or CMS system to finalize the output.

 

EG:

<{assign var="title" value=$people->getShow()|cat:$people->getName()|escape}>

assign var="title" // This would make a variable named title ($title)
value=$people->getShow()|cat:$people->getName() // This would make the variable $title have the value $people->getShow()|cat:$people->getName()
|escape // This would escape the string.

Maybe try

<{assign var="title" value=$people->getShow()  | cat:$people->getName()|escape}>

 

I'm not sure if it will work but it's worth a shot!

 

James.

Link to comment
Share on other sites

This is PHP, ...

 

Well I figured that much since they're posting in a PHP forum. :P

 

Thanks!

 

Haha! My bad LOL! I must admit the logic is a little strange, the rendering time on this must be somewhat stunted by the complexity of a simple variable assignment process... LOL

 

James.

Link to comment
Share on other sites

It's SMARTY I believe. The templates are compiled into pure PHP templates, that are then re-used on subsequent requests. I'm not sure why there's angle brackets at each side of an assignment though? I'll add as well, there's no need to really assign the value to a variable here. @kvnirvana why not just display them separately..?

 

{$people->getShow()|escape} {$people->getName()|escape}

Link to comment
Share on other sites

Yes it's SMARTY

None of the suggestions worked. I tried jamesxg1 suggestion like this

<{assign var="title" value=$people->getShow()  | cat:$people->getName()|escape}>

 

And I tried Adams suggestion like this

<{assign var="title" value={$people->getShow()|escape} {$people->getTitle()|escape}>

 

Both of them gave me an intern 500 error

 

Link to comment
Share on other sites

And I tried Adams suggestion like this

<{assign var="title" value={$people->getShow()|escape} {$people->getTitle()|escape}>

 

That was not my suggestion? I posted:

 

{$people->getShow()|escape} {$people->getName()|escape}

 

Use that wherever you want the values to be shown; don't assign them to a variable! I would always hesitate to assign a variable within SMARTY, there's generally always a better way.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.