OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



code to include article's URL automatically in article

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.

code to include article's URL automatically in article

Postby nrj » Tue Jul 17, 2007 10:17 am

I'm hoping that you can tell me some html code I need to put in an article to get the OJS URL to display. First Monday wants the title, author and URL to display as the footer. Of course, they only started this practice in the last couple of years and the hard-coded URLs will break when they move to OJS soon.

Since you have this data in the system, I'm hoping some sort of SSI or php call from the article code (like what you do in the metadata reader tool) will make the system supply the data as it renders the article, rather than someone hand coding them individually.

Thanks!
Nancy
nrj
 
Posts: 20
Joined: Mon Feb 06, 2006 2:55 pm

Postby asmecher » Tue Jul 17, 2007 10:45 am

Hi Nancy,

Will these URLs need to appear in the article HTML? If so, yes, there is a way. You can use URLs like:
  • ojs://journal to refer to the current journal's homepage (or ojs://journal/[journalPathHere] to refer to another journal)
  • ojs://article/[articleIdHere] to refer to another article
  • ojs://issue/[issueIdHere] to refer to an issue or ojs://issue to refer to the current issue
  • ...and several other options for public files, supplementary files, etc.
You can use these URLs, for example, in link tags.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 8599
Joined: Wed Aug 10, 2005 12:56 pm

Postby nrj » Tue Jul 17, 2007 11:02 am

Maybe I wasn't clear. But what you responded is ALSO very useful.

What I really want is static rendering of the data like in the reader tools for citation and metadata.

The result look like:

Using OJS by Nancy John
First Monday, vol. 12, no. 12 (December 2007)
http://firstmonday.org/fm/article/view/131

The html code to render this might be

<p><text=[article_title]> by <text=[author]><br>
<text=[issueID]><br>
<text=[article URL]></p>

or maybe I'm not udnerstanding the ojs:journal etc. syntax.
nrj
 
Posts: 20
Joined: Mon Feb 06, 2006 2:55 pm

Postby asmecher » Tue Jul 17, 2007 11:06 am

Hi Nancy,

I see; where would this information be displayed? At the bottom of every article, for example?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8599
Joined: Wed Aug 10, 2005 12:56 pm

Postby nrj » Tue Jul 17, 2007 11:21 am

Exactly!

For an example, see their current site

http://www.firstmonday.org/issues/issue ... index.html

go to the bottom of the article.

Nancy
nrj
 
Posts: 20
Joined: Mon Feb 06, 2006 2:55 pm

Postby asmecher » Tue Jul 17, 2007 1:08 pm

Hi Nancy,

If you apply the patch at http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=2955, you'll be able to insert variable replacement tags in your HTML. For example, use {$issueTitle} for the issue title, {$journalTitle} for the journal title, and {$siteTitle} for the site title.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8599
Joined: Wed Aug 10, 2005 12:56 pm

Postby nrj » Tue Jul 17, 2007 1:17 pm

OK, Alec. We'll give it a try and see how it works. Back to you soon.
Nancy
nrj
 
Posts: 20
Joined: Mon Feb 06, 2006 2:55 pm

Postby nrj » Tue Jul 17, 2007 2:07 pm

That works great for journal and issue.

Now I assume if I can come up with the right corresponding variable name that I will be able to mimic your code to make a call for the article URL as well.

Thanks.
nrj
 
Posts: 20
Joined: Mon Feb 06, 2006 2:55 pm

Postby asmecher » Tue Jul 17, 2007 3:41 pm

Hi Nancy,

Edit classes/article/ArticleHTMLGalley.inc.php and find the following around line 80:
Code: Select all
$paramArray = array(
        'issueTitle' => $issue->getIssueIdentification(),
        'journalTitle' => $journal->getTitle(),
        'siteTitle' => $site->getTitle()
);
Change it to...
Code: Select all
$paramArray = array(
        'issueTitle' => $issue->getIssueIdentification(),
        'journalTitle' => $journal->getTitle(),
        'siteTitle' => $site->getTitle(),
        'currentUrl' => Request::getRequestUrl()
);
Now you can use {$currentUrl} as well. This will be included in version 2.2.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8599
Joined: Wed Aug 10, 2005 12:56 pm

Postby nrj » Wed Jul 18, 2007 9:07 am

Thanks so much, Alec. We have all this code working and wer'e almost there. Right now {currentURL} only gives us the root URL for our OJS system, but I'm guessing that this has to do with us (not you) because we are still using cgi URLS and that it will work correctly once the setting for the path_info variable is changed to 'disabling - off' . We'll be doing that as soon as one of our editors changes the URL in the redirect for his domain name.
Nancy
nrj
 
Posts: 20
Joined: Mon Feb 06, 2006 2:55 pm

Postby asmecher » Wed Jul 18, 2007 9:26 am

Hi Nancy,

Sounds good -- let me know if you have any further problems or questions.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8599
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 7 guests