OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



[SOLVED] How do I... add a plugin display() too my footer?

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.

[SOLVED] How do I... add a plugin display() too my footer?

Postby mbria » Fri Jun 30, 2006 5:10 am

Hi community,

First, congratulations for the new web. Much more clear than the old one, as well as a more modern style... what is good to promote your wonderful applications.

I was looking into the cvs and I found a couple of great plugins there that I just copy in the plugins/global directory and after been enabled worked like a charm (congratulations also the the contibutors).

The point is that I like to modify one of this plugins (webfeed) that "by default" adds a block in the right side... but I like to have the feeders at the footer and I didn't find a nice way to do it.

Of course I can hack the plugin and force the FeedPlugin.php to show my data... but isn't polite and I like to respect OJS standards and good practies... so I though in using TemplateManager->display() for the task.

The original plugin attach the new templated block to the "sidebarTemplate" variable (that I suspect that after is taken by the common template sidebar.tpl) but how to do this if I like to attach this same template to the footer and I don't want to lose the OJS compativility?

Hope I did explain my self... :oops:

Thanks a lot in advance,

m.
Last edited by mbria on Mon Dec 04, 2006 4:50 am, edited 1 time in total.
mbria
 
Posts: 292
Joined: Wed Dec 14, 2005 4:15 am

Is this the right way?

Postby mbria » Fri Jun 30, 2006 9:19 am

Hi,

I did my best with this and this is my solution... feel free to comment better ways if you belive there is any.

1) I created my own linksFooter.tpl template: A modification of the links.tpl one that displays feeds in hortizontal instead of vertical. My template is as simple as this:

Code: Select all
<div class="logos">
    <!--RSS feeds-->
    <span>
        <a href="{url page="feed" op="atom"}">
        <img src="{$baseUrl}/plugins/generic/webFeed/templates/images/atom10_logo.gif" alt="ATOM feed" border="0" /></a>
    </span>
    &nbsp;
    <span>
        <a href="{url page="feed" op="rss2"}">
        <img src="{$baseUrl}/plugins/generic/webFeed/templates/images/rss20_logo.gif" alt="RSS2 feed" border="0" /></a>
    </span>
    &nbsp;
    <span>
        <a href="{url page="feed" op="rss"}">
        <img src="{$baseUrl}/plugins/generic/webFeed/templates/images/rss10_logo.gif" alt="RSS1 feed" border="0" /></a>
    </span>
    &nbsp;
    <!--br/-->
    <!--Validators-->
    <span>
        <a href="http://validator.w3.org/check?uri=referer">
            <img src="{$baseUrl}/plugins/generic/webFeed/templates/images/xhtml_Oxygen.png" alt="Valid XHTML 1.0 Transitional" border="0" />
        </a>
    </span>&nbsp;
    <span>
     <a href="http://jigsaw.w3.org/css-validator/">
            <img src="{$baseUrl}/plugins/generic/webFeed/templates/images/css_Oxygen.png" alt="Valid CSS !" border="0" />
     </a>
    </span>
</div>



2) Then I modified the FeedPlugin.inc.php replacing the following lines:
Code: Select all
if ($sidebarTemplate == "") {
  $templateManager->assign('sidebarTemplate', $imageLinks);
}


With:
Code: Select all
if ($footerTemplate == "") {
  $imageLinks = $this->getTemplatePath().'templates/linksFooter.tpl';
  $templateManager->assign('footerTemplate', $imageLinks);
}


3) Finally I added a call to my new template in common/footer.tpl (as far as no pluginsTemplate calls were definied in footer.tpl as sidebarTemplate could be used in sidebar.tpl). So it:

Code: Select all
    {if $pageFooter}
            {$pageFooter}
    {/if}


becomes:
Code: Select all
    {if $pageFooter}
            {$pageFooter}
    {/if}
    {if $footerTemplate}
        {include file=$footerTemplate}
    {/if}


That's all... 3 easy steeps, but the question still is: Is this the right way? I feel like I'm missing some compativility with further OJS versions.

BTW, webFeed plugin don't validate XHTML transactional 1.0, as far as adds image's atributes that are deprecated, and link tags are not closed.

Cheers,

m.
mbria
 
Posts: 292
Joined: Wed Dec 14, 2005 4:15 am

Postby asmecher » Fri Jun 30, 2006 9:32 am

Hi mbria,

This looks like a good approach; of course, ideally you shouldn't need to alter the codebase to use a plugin, and you may be able to work around this by writing a little bit of code in the plugin to fetch the output of a template and assign it to the pageFooter variable.

For OJS 2.1.1, we've started refactoring the template manager's relationship with templates in order to make customizations like this easier; we'll be continuing this with the following release.

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

Postby jalperin » Thu Jul 06, 2006 1:40 pm

Hi All.

I have started and progressed quite nicely with a sidebar manager plugin which I hope to make available by the time of the next release. My (still very much a proof of concept) plugin will allow users to rearrange the order of the different parts of the sidebar as well as add a left sidebar (creating a 3-column layout).

I like the idea of including the footer in this.
jalperin
 
Posts: 154
Joined: Thu Jul 06, 2006 1:03 pm
Location: Buenos Aires

Postby jalperin » Thu Jul 06, 2006 1:58 pm

I should also add that I have designed the plugin in such a way that it allows for other plugins to register "sidebar blocks" which can then be re-arranged and moved (or removed).

I have modified the WebFeed Plugin to do this and it works quite nicely. (Like I said, I do not have the footer included in this, but I will investigate the possibility of including it as well).

Juan Alperin
jalperin
 
Posts: 154
Joined: Thu Jul 06, 2006 1:03 pm
Location: Buenos Aires

thanks

Postby mbria » Mon Jul 24, 2006 4:55 am

Gracias Juan.

Please, keep us informed about your advances... they look really promissing.

Cheers,

m.
mbria
 
Posts: 292
Joined: Wed Dec 14, 2005 4:15 am


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron