OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



OJS-2.3.7 Page Footer Display Problem

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.

OJS-2.3.7 Page Footer Display Problem

Postby fivos » Sat May 03, 2014 3:23 am

Hi everybody,

i have implemented a generic plugin that displays the article metadata in the page footer of each article. I have tested it in ojs-2.4.3 and it works fine. However i have to
apply it in ojs-2.3.7, and it doesn't work there. I cann't display anything in the page footer with my plugin. What could be wrong?
I cite some code in case it helps.

Code: Select all
   function register($category, $path) {
                $success = parent::register($category, $path);
               
                if ($success && $this->getEnabled()) {               
            $this->import('CustomViewDAO');
                               
            $customViewDao = &new CustomViewDAO($this->getName());
            $returner = &DAORegistry::registerDAO('CustomViewDAO', $customViewDao);
         HookRegistry::register( 'Templates::Article::Footer::PageFooter', array(&$this, 'callback'));
            //
         }
      return $success;
   }


Code: Select all
function callback($hookName, $args) {
                $journal =& Request::getJournal();
      $journalId = $journal?$journal->getId():0;
               
      if($this->getEnabled()){
                        $requestedPage = Request::getRequestedPage();
                       
                        $params =& $args[0];
         $smarty =& $args[1];
         $output =& $args[2];
                                 
            $customViewDao =& DAORegistry::getDAO('CustomViewDAO');            
            $views =& $customViewDao->getCustomViewsByJournalId($journal->getId());
                                $templateMgr = TemplateManager::getManager();
                                $article = $templateMgr->get_template_vars('article');                               
                               
            $output = '<h4>' . Custom View Plugin . '</h4>';
                               
                                while ($currentView =& $views->next())
                                {
                                   
                                        $this->import('CustomView');
                                        if($currentView->getDisplayTitle()==1){
                                            $output .= '<h4>' . $currentView->getTitleLabel() . '</h4>';                                                                               
                                            $output .= '</br>';
                                            $title = $article->getLocalizedTitle();
                                 .
                                 . 
                                 .




As soon as i complete it, i will post it in the Plugin Gallery

Thank you in advance!
fivos
 
Posts: 19
Joined: Thu Mar 06, 2014 4:12 am

Re: OJS-2.3.7 Page Footer Display Problem

Postby JasonNugent » Sat May 03, 2014 11:38 am

Hi fivos,

What happens in 2.3.7? Is it a blank screen, or do you just end up seeing the regular footer without the article metadata? Blank screens could mean a PHP error, or perhaps you're hitting a discrepancy between the two code bases. They are quite different.

If nothing is happening at all, with no errors, you may want to make sure that hook was present in 2.3.7. You can search the codebase for call_hook calls in the templates to see. If it isn't, then you'll need to hook against something else, like TemplateManager ::display.

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 910
Joined: Tue Jan 10, 2006 6:20 am

Re: OJS-2.3.7 Page Footer Display Problem

Postby fivos » Sun May 04, 2014 7:34 am

Thanks for your answer Jason!
There are no errors and nothing happens.
It's not a problem of ojs-2.3.7 version, because i just inserted one new journal (with article) in the ojs-2.4.3 and happened the same thing.
My plugin didn't display the article metadata of the new journal.

I have inserted 3 journals and my plugin works only for the 2 of them.
It should work for all journals. What could be wrong and the plugin displays the metadata (in the footer) only for some of the journals?


Thank you in advance!
fivos
 
Posts: 19
Joined: Thu Mar 06, 2014 4:12 am

Re: OJS-2.3.7 Page Footer Display Problem

Postby fivos » Mon May 05, 2014 2:48 am

Finally i found the mistake! The <class> name in the 'version.xml' file was not the same with the name of the main class of the plugin.
fivos
 
Posts: 19
Joined: Thu Mar 06, 2014 4:12 am

Re: OJS-2.3.7 Page Footer Display Problem

Postby JasonNugent » Mon May 05, 2014 2:56 am

Excellent, glad to hear that it worked out.

Cheers,
Jason
JasonNugent
Site Admin
 
Posts: 910
Joined: Tue Jan 10, 2006 6:20 am


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 3 guests