kvnirvana Posted August 31, 2011 Share Posted August 31, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/ Share on other sites More sharing options...
samshel Posted August 31, 2011 Share Posted August 31, 2011 try this. not tested but might work. <{assign var="title" value=$people->getShow()|cat:$people->getName()|escape}> Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264080 Share on other sites More sharing options...
kvnirvana Posted September 1, 2011 Author Share Posted September 1, 2011 It works :-) but how can I get a space between getShow and getName? Tried to do it like this but again I get an error <{assign var="title" value=$people->getShow()| cat:$people->getName()|escape}> Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264203 Share on other sites More sharing options...
cyberRobot Posted September 1, 2011 Share Posted September 1, 2011 Out of curiosity, what kind of code is this? Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264263 Share on other sites More sharing options...
jamesxg1 Posted September 1, 2011 Share Posted September 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264278 Share on other sites More sharing options...
cyberRobot Posted September 1, 2011 Share Posted September 1, 2011 This is PHP, ... Well I figured that much since they're posting in a PHP forum. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264284 Share on other sites More sharing options...
jamesxg1 Posted September 1, 2011 Share Posted September 1, 2011 This is PHP, ... Well I figured that much since they're posting in a PHP forum. 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. Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264293 Share on other sites More sharing options...
Adam Posted September 1, 2011 Share Posted September 1, 2011 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} Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264297 Share on other sites More sharing options...
kvnirvana Posted September 1, 2011 Author Share Posted September 1, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264347 Share on other sites More sharing options...
cyberRobot Posted September 1, 2011 Share Posted September 1, 2011 Does this help: http://www.smarty.net/docs/en/language.modifier.spacify.tpl If not, I'll butt out since I've never used Smarty before. Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264352 Share on other sites More sharing options...
kvnirvana Posted September 1, 2011 Author Share Posted September 1, 2011 I don't think I can use the spacify because I don't want to insert a space between every character, I only want a space between what the variable $people->getShow() outputs and what the variable $people->getName() outputs Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264357 Share on other sites More sharing options...
cyberRobot Posted September 1, 2011 Share Posted September 1, 2011 Have you tried Smarty's forum? http://www.smarty.net/forums/ Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264362 Share on other sites More sharing options...
kvnirvana Posted September 1, 2011 Author Share Posted September 1, 2011 No, I'll try that, thanks for the link :-) Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264364 Share on other sites More sharing options...
cyberRobot Posted September 1, 2011 Share Posted September 1, 2011 No, I'll try that, thanks for the link :-) Well, I would hate to see you leave...but they'll probably be better at answering your questions. Good Luck! Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264368 Share on other sites More sharing options...
Adam Posted September 1, 2011 Share Posted September 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/246116-title-problem/#findComment-1264399 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.