You are viewing the PKP Support Forum | PKP Home Wiki

Explanation of Syntax?

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

Explanation of Syntax?

Postby mark » Tue Sep 30, 2008 6:25 pm

Could someone give me hand with some code here. An explanation of the code syntax is needed.
Here's the context of the code from: issue.tpl

Code: Select all
 {if $hasAccess}
                {foreach from=$article->getGalleys() item=galley name=galleyList}
                        <a href="{url page="article" op="view" path=$article->getBestArticleId($currentJournal)|to_array:$galley->getGa\
lleyId()}" class="file">{$galley->getLabel()|escape}</a>

Specifically, I'm studying .....
Code: Select all
{url page="article" op="view" path=$article->getBestArticleId($currentJournal)|to_array:$galley->getGa\

I know url is a customize function in TemplateManager, as is to_array. I know what $article and $gallery are too.
I've learned that to_array is basically a call to func_get_args (I read up on this, but I'm not sure how it functions in a smarty template file)

but I can't figure out

Code: Select all

What do the "|" and ":" do? Is that Smarty syntax or PHP syntax? It's very hard to search for their meaning because most search engines seem to ignore "|" and ":" as search terms.

Overall, I'm working on code that wants to emulate what the above code does with a slight twist. But I can't seem to make it work in the same way.

Posts: 31
Joined: Fri Jul 11, 2008 10:57 am

Re: Explanation of Syntax?

Postby jmacgreg » Wed Oct 01, 2008 10:34 am

Hi Mark,

Actually, this is a good excuse for me to dig a little deeper into Smarty syntax. I came up with the following explanation from http://www.smarty.net/manual/en/language.modifiers.php:

Variable modifiers can be applied to variables, custom functions or strings. To apply a modifier, specify the value followed by a | (pipe) and the modifier name. A modifier may accept additional parameters that affect its behavior. These parameters follow the modifer name and are separated by a : (colon). Also, all php-functions can be used as modifiers implicitly (more below) and modifiers can be combined.

There are a number of examples on the above page.

Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Return to OJS Development

Who is online

Users browsing this forum: Google [Bot] and 1 guest