OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



keyword array

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.

keyword array

Postby downtheroad » Tue Jan 13, 2009 12:27 pm

I saw the following line of code in RThandler. Is there a variable that is an array of the keywords (with assumption that the keywords are semi-colon separated)?
I would like to loop the keywords in rt.

$templateMgr->assign('keywords', explode(';', $article->getArticleSubject()));

dr
downtheroad
 
Posts: 25
Joined: Tue Jan 13, 2009 9:48 am

Re: keyword array

Postby downtheroad » Wed Jan 14, 2009 10:40 am

To say this more clearly, is there a way to access the keywords variable defined in RThandler within rti.tpl? I also tried this:
{$article_arr->getArticleSubject()|explode:';'}
{foreach from=$article_arr item=item}
<br>{$item}
{/foreach}

but nothing returned. Is there another way to code this?

dr
downtheroad
 
Posts: 25
Joined: Tue Jan 13, 2009 9:48 am

Re: keyword array

Postby mcrider » Thu Jan 15, 2009 11:57 am

Hi there,

You could assign the keywords array to the template by calling
Code: Select all
$templateMgr->assign('keywords', explode(';', $article->getArticleSubject()));
in pages/article/ArticleHandler.inc.php::viewRst(). Then in the template, iterate through it with
Code: Select all
{foreach from=$keywords item=item}
<br>{$item}
{/foreach}


Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: keyword array

Postby downtheroad » Thu Jan 15, 2009 12:53 pm

ah, thanks Matt, that's awesome
downtheroad
 
Posts: 25
Joined: Tue Jan 13, 2009 9:48 am


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron