OJS OCS OMP OHS

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
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Showing a block elsewere

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

Hi!
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 -->
[SHOW SOMETHING]

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

Thank you
XavierMcHot
 
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.
Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8453
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests