About Smarty

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 35
Joined: Fri Feb 29, 2008 3:05 am

About Smarty

Postby edithlin » Tue Apr 15, 2008 9:48 pm


Sorry that I'm not so familiar with Smarty and I have got 2 silly questions:

1. How can I truncate a translated string like this:
{translate key=$directorDecisionOptions.$decisionOption}
while $directorDecisionOptions.$decisionOption returns sth like 'director.paper.decision.invitePresentation' and after translating, we have 'Invite Presentation'. Now, what I want is 'Invite Pre...".
I tried to use this but I got an error.
{{translate key=$directorDecisionOptions.$decisionOption}|truncate:10:"..."|escape}

2. Say I defined this in locale.xml:
<message key="director.paper.decision.invitePresentation.abbv">IP</message>
How can I concatenate the output of $directorDecisionOptions.$decisionOption and 'abbv' to form director.paper.decision.invitePresentation.abbv and use it with {translate key=xxx}?
I tried this but again, failed!
{assign var="decisionOptionKey" value=$directorDecisionOptions.$decisionOption}
{translate key=$decisionOptionKey."abbv"}



Posts: 183
Joined: Thu Sep 06, 2007 7:01 pm

Re: About Smarty

Postby smiri » Wed Apr 16, 2008 11:27 pm

Hi Edith,

For number 1, you should be able to do something like this: {translate|truncate:10 key=$directorDecisionOptions.$decisionOption}

For number 2, you might be able to do it backward:

{assign var="abbv" value="abbv"}
{translate key=$directorDecisionOptions.$decisionOption.$abbv}


Return to “OCS Technical Support”

Who is online

Users browsing this forum: No registered users and 1 guest