OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Getting the url for a plugin

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.

Getting the url for a plugin

Postby christo » Tue Aug 21, 2007 12:49 am

Hi

How does one go about getting the baseurl for a plugin.

In particular, my problem: I have a sitewide plugin, but as far as i can tell, the manage() function of the plugin class is only called from a journal specific url: eg:
http://www.myojs.com/index.php/{journalPath}/manager/plugin/generic/{pluginName}/{verb}/{args}

it is {journalpath} that is causing the problems since i do not always have a journal specified when i might want to link to my plugin management functions; and replacing {journalpath} with index doesnt work either...

now, if i want to send someone to somewhere when no journal has been selected, i cant use Journal::getPath() ... because we are not currently on a journal path. and it is not ideal to have to randomly select a journal from the database simply to get a url that will work.

I have looked, but i dont see a function such as $plugin->getBaseUrl() ... there is $plugin->getTemplatePath(), but that is not what i am looking for...

What is the best way to do this?
christo
 
Posts: 22
Joined: Mon Jan 09, 2006 12:04 am
Location: Grahamstown, South Africa

Re: Getting the url for a plugin

Postby asmecher » Tue Aug 21, 2007 8:56 am

Hi Christo,

The best way to do this is use the LoadHandler hook to intercept incoming requests and create a new URL with which the plugin can be invoked. The LoadHandler hook is invoked from OJS's index.php wrapper. You'll be able to use the regular {url ...} function to create URLs to invoke it.

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


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 3 guests