You are viewing the PKP Support Forum | PKP Home Wiki

Showing a block elsewere

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

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.

Showing a block elsewere

Postby XavierMcHot » Mon Jun 17, 2013 7:39 am

I'm trying to remove the left-right sidebar, for showing the website in a fullscreen mode. Anyway, what I like to do it's to show the single block, like the user block, the notification block, in others place, like footer. What is (and there is) the way to call and show single block? For example, if I modified templates/common/footer.tpl , I can use this par

{call_hook name="Templates::Common::Footer::PageFooter"}
</div><!-- content -->

to show something inside the footer content. But how to call, for example, only the single user block, or the search?

Thank you
Posts: 2
Joined: Mon Jun 17, 2013 5:57 am

Re: Showing a block elsewere

Postby asmecher » Mon Jun 17, 2013 8:37 am

Hi XavierMcHot,

Block plugins are currently only coded to go in the right or left sidebars; to get them to display elsewhere, you'll have to modify the parent class to support additional contexts, and the setup tools to allow for that configuration. An alternate and potentially easier way is to code a GenericPlugin that uses hooks directly to add content (see e.g. the registration to Templates::Common::Footer::PageFooter in plugins/generic/googleAnalytics/GoogleAnalyticsPlugin.inc.php) but that depends on a hook appearing precisely where you need it.

If no hook appears precisely where you need it in the template, the situation becomes more difficult. You have two options OTOH:
  • Modify the template to include a new hook. This will somewhat taint your plugin, as it'll require a modification to apply, but the modification will be simple and clean.
  • Use a Smarty postfilter to filter the footer template's output with string manipulation functions, and insert the markup you want to add at the correct place. This will be somewhat brittle (if the footer markup changes, it may throw your plugin off) but it won't require modification to the system.
Alec Smecher
Public Knowledge Project Team
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 2 guests