OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Pulling Data from the Article Abstract

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

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

Forum rules
What to do if you have a technical problem with OJS:

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.

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 OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Pulling Data from the Article Abstract

Postby ajain » Tue Jun 19, 2007 9:32 pm

I was working with the issue.tpl file and i'm not too sure on how I would be able to pull the text data from the article abstract and display it on the main index page where the table of contents is laid out.

What I am looking to do is take around 200 characters from the abstract and display it as a teaser.

I've looked around and haven't been successful finding anything. This is what I have so far which is the default displayed.

Code: Select all
      {foreach from=$article->getAuthors() item=author name=authorList}
         {$author->getFullName()|escape}{if !$smarty.foreach.authorList.last},{/if}
      {/foreach}


I'm not sure what the variables would be for pulling the article abstract and then controlling the amount displayed.

Code: Select all
      {if $section.abstractsDisabled || $article->getAbstract() == ""}
         {assign var=abstractLabel value="article.details"}
      {else}
         {assign var=abstractLabel value="article.abstract"}
      {/if}


I hope I was clear as to what I'm looking for. :?
ajain
 
Posts: 2
Joined: Sun Apr 29, 2007 9:09 am
Location: Toronto

Postby asmecher » Tue Jun 19, 2007 10:09 pm

Hi ajain,

You'll want to insert something like the following:
Code: Select all
{$article->getArticleAbstract()|truncate:300|strip_unsafe_html|nl2br}
...where the 300 is the number of characters to display. (This might behave a little strangely in the case of nested HTML codes used in the abstracts.)

Regards,
Alec Smecher
Public Knowledge Project Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8470
Joined: Wed Aug 10, 2005 12:56 pm

Postby ajain » Tue Jun 19, 2007 11:09 pm

Hi Alec,

Just so I can properly understand what you did, basically what you are doing is calling the abstract. Where would I be able to learn more about the specific syntax used and how the journal functions? Can these specific details be found anywhere in your technical documentation?

Thanks,

Ankur
ajain
 
Posts: 2
Joined: Sun Apr 29, 2007 9:09 am
Location: Toronto

Postby asmecher » Wed Jun 20, 2007 9:30 am

Hi Ankur,

We haven't published any API documentation yet, which would be the best place to look for the kinds of functions that can be called on an article object. However, the code is documented with the intention of using an automatic documentation system like Doxygen to produce API documentation. I hope we'll be able to do this for the next release, but in the meantime you'll have to look in the code (e.g. in this case classes/article/Article.inc.php). Fortunately, the code is object-oriented and logically laid out, if voluminous.

If you'd like a top-down description of how OJS is designed, the OJS Technical Reference (available on the Documentation link from the OJS homepage) is a good place to start.

Regards,
Alec Smecher
Public Knowledge Project Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8470
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot] and 2 guests