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
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.

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: Google [Bot] and 2 guests