OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki


Problems and questions developing first plugin

The Plugin Gallery is a venue for users of PKP software to share their plugins.

Moderators: jmacgreg, michael, John

Forum rules
If you post a plugin here, please include information on which versions of which applications it is compatible with. Attach a tarball of the plugin (e.g. tar cvzf myPlugin-0.1.tar.gz plugins/generic/myPlugin). Thanks for contributing!

Problems and questions developing first plugin

Postby Garant » Wed Oct 24, 2012 5:21 am

Hi!
I don't have any experience in developing plugins for OJS additionally there are very few information about how to write your custom plugin.
The task is to output last article's data in the home page.
I took a CustomBlock Plugin as a example. Rewrote SQL and block.tpl to suit my needs.
The problems with which I've encountered are:
1). There is no any control buttons in Block Plugins area.
2). The plugin shows itself and loads only when I access Block Plugins menu. It's better to make that plugin should load only accessing home page.
3). I don't need a sidebar block as it works now. I need to place block.tpl in the home page area.
Can you please guide me through fixing these issues ?
P.S. I've attached the semi working project
Attachments
latestArticle.rar
(3.75 KiB) Downloaded 53 times
Garant
 
Posts: 85
Joined: Wed May 30, 2012 8:53 am

Re: Problems and questions developing first plugin

Postby Garant » Thu Oct 25, 2012 4:01 am

So, no one will help?
Garant
 
Posts: 85
Joined: Wed May 30, 2012 8:53 am

Re: Problems and questions developing first plugin

Postby Garant » Thu Oct 25, 2012 12:29 pm

If I'm right - the third problem could be done using:
Code: Select all
   function getBlockContext() {
       return BLOCK_CONTEXT_HOMEPAGE;
   }

But of problem nr.2 can't check it.
Garant
 
Posts: 85
Joined: Wed May 30, 2012 8:53 am

Re: Problems and questions developing first plugin

Postby asmecher » Thu Oct 25, 2012 2:45 pm

Hi Garant,

I don't think homepage blocks are currently implemented. Your best bet will be to make your plugin a generic plugin, and look at the hooks in the template files. (Look e.g. at the Templates::Index::journal hook, specified in templates/index/journal.tpl.)

As for why the plugin is only appearing on certain pages, have a look at http://pkp.sfu.ca/wiki/index.php/Writing_a_Block_Plugin, specifically the part about registering the plugin with the database.

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

Re: Problems and questions developing first plugin

Postby Garant » Fri Oct 26, 2012 1:24 am

Hi, asmecher !
Thank you for you reply!
I'll examine this!
Last edited by Garant on Fri Oct 26, 2012 3:18 am, edited 1 time in total.
Garant
 
Posts: 85
Joined: Wed May 30, 2012 8:53 am

Re: Problems and questions developing first plugin

Postby Garant » Fri Oct 26, 2012 3:18 am

Done!
Thank you!
Garant
 
Posts: 85
Joined: Wed May 30, 2012 8:53 am


Return to Plugin Gallery

Who is online

Users browsing this forum: No registered users and 1 guest