You are viewing the PKP Support Forum | PKP Home Wiki

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
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

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: 35
Joined: Fri Feb 29, 2008 3:05 am

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}

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

Return to OCS Technical Support

Who is online

Users browsing this forum: No registered users and 2 guests