OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Fatal error: Call to a member function wasEmpty()

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.

Fatal error: Call to a member function wasEmpty()

Postby rajiv » Wed Aug 28, 2013 10:04 pm

hi friends,
I want modify my OJS journal. So want change archives list come in left side bar, while click respective volume then their details come in adjacent fraame. so i put archives list source code into leftside bar place in common/header.tpl page. then after i getting following error:

"PHP Fatal error: Call to a member function wasEmpty() on a non-object in C:\inetpub\wwwroot\ojs\cache\t_compile\%%36^36E^36E89D0E%%header.tpl.php on line 226"

So please help me for solving this problem.

Thanks
Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: Fatal error: Call to a member function wasEmpty()

Postby asmecher » Thu Aug 29, 2013 9:16 am

Hi Rajiv,

Can you post the modifications here?

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

Re: Fatal error: Call to a member function wasEmpty()

Postby rajiv » Thu Aug 29, 2013 10:12 pm

hi Alec Smecher,

Following source code are modified code (archives list code replace of leftSidebarCode ) in header.tpl page.
Note: header.tpl file path [ ojs\lib\pkp\templates\common\header.tpl ]

Code: Select all
{if $leftSidebarCode || $rightSidebarCode}
   <div id="sidebar">
      {if $leftSidebarCode}
         <div id="leftSidebar">
             {*{$leftSidebarCode}*}                             
                                                             
                               <div id="issues">
                                {iterate from=issues item=issue}
   {if $issue->getYear() != $lastYear}
      {if !$notFirstYear}
         {assign var=notFirstYear value=1}
      {else}
         </div>
         <br />
         <div class="separator" style="clear:left;"></div>
      {/if}
      <div style="float: left; width: 100%;">
      <h3>{$issue->getYear()|escape}</h3>
      {assign var=lastYear value=$issue->getYear()}
   {/if}

   <div id="issue" style="clear:left;">
   {if $issue->getLocalizedFileName() && $issue->getShowCoverPage($locale) && !$issue->getHideCoverPageArchives($locale)}
      <div class="issueCoverImage"><a href="{url op="view" path=$issue->getBestIssueId($currentJournal)}"><img src="{$coverPagePath|escape}{$issue->getFileName($locale)|escape}"{if $issue->getCoverPageAltText($locale) != ''} alt="{$issue->getCoverPageAltText($locale)|escape}"{else} alt="{translate key="issue.coverPage.altText"}"{/if}/></a>
      </div>
      <h4><a href="{url op="view" path=$issue->getBestIssueId($currentJournal)}">{$issue->getIssueIdentification()|escape}</a></h4>
      <div class="issueCoverDescription">{$issue->getLocalizedCoverPageDescription()|strip_unsafe_html|nl2br}</div>
   {else}
      <h4><a href="{url op="view" path=$issue->getBestIssueId($currentJournal)}">{$issue->getIssueIdentification()|escape}</a></h4>
      <div class="issueDescription">{$issue->getLocalizedDescription()|strip_unsafe_html|nl2br}</div>
   {/if}
   </div>

{/iterate}
{if $notFirstYear}<br /></div>{/if}

{if !$issues->wasEmpty()}
   {page_info iterator=$issues}&nbsp;&nbsp;&nbsp;&nbsp;
   {page_links anchor="issues" name="issues" iterator=$issues}
{else}
   {translate key="current.noCurrentIssueDesc"}
{/if}
      {if $rightSidebarCode}
         <div id="rightSidebar">
            {$rightSidebarCode}
         </div>
      {/if}
   </div>
{/if}



Thanks
Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: Fatal error: Call to a member function wasEmpty()

Postby asmecher » Fri Aug 30, 2013 11:22 am

Hi Rajiv,

The problem is that the template code you've copied makes use of the $issues variable, which is not available to the sidebar template. You'll have to find the relevant PHP code that calls on the template and assign the issue data there. Generally speaking, I think the change would be best made in classes/template/TemplateManager.inc.php. (You may want to use something other than "$issues" for the variable, as that may clash with the same variable name being used elsewhere.)

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

Re: Fatal error: Call to a member function wasEmpty()

Postby rajiv » Sun Sep 01, 2013 11:44 pm

hi Alec Smecher,

Thanks for your reply. i am unable to understand what you given solution. please give more details.



Thanks
Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: Fatal error: Call to a member function wasEmpty()

Postby asmecher » Tue Sep 03, 2013 9:08 am

Hi Rajiv,

The way we use Smarty templates for view abstraction, it requires PHP to set up all the variables used in the templates, and then the templates take care of formatting them for display. Your modification adjusts the template, but it assumes that variables will be available to it that may not be present. (Also, some types of variables are intended for single use, after which they can't be used again, such as iterators.) You'll have to familiarize yourself with the PHP side of the code as well. The Technical Reference in the documentation section may help.

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

Re: Fatal error: Call to a member function wasEmpty()

Postby rajiv » Tue Sep 03, 2013 10:51 pm

hi Alec Smecher,

Thanks for saggestions gave to me



Thanks
Rajiv P
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am


Return to OJS Development

Who is online

Users browsing this forum: Google [Bot] and 1 guest