Display a block only in frontend pages

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.
mgscano
Posts: 72
Joined: Tue Jan 27, 2009 3:22 am
Location: Brescia, Italy
Contact:

Display a block only in frontend pages

Postby mgscano » Sat Apr 03, 2010 3:09 am

Hi there,
thanks to the latest implementation of jQuery, I was able to create a small images rotator block, so also my sponsors are pleased to see their logos on the site main page.

This is okay, and works smoothly, but I defintely need to get rid of that (and all the other fancy stuff), from the already slow backend pages, i.e. the Journal Manager, Editor, Section Editor, and specific roles involved in Peer Review and Editorial process.

It was quite easy to hide it to all logged in users, recycling the {userLoggedIn} Smarty function, but it's not what I want. I need to separate the "frontend" pages from the "backend" ones, does anyone has an idea I can work with?

Thanks

jmacgreg
Posts: 4191
Joined: Tue Feb 14, 2006 10:50 am
Contact:

Re: Display a block only in frontend pages

Postby jmacgreg » Wed Apr 07, 2010 11:41 am

Hi Marco,

I believe you'll find the speed of the backend pages will be much faster in the upcoming OJS 2.3.2 release (see these bugs, for example). If you're willing to test our optimizations we'd greatly appreciate it -- just shoot me an email at jmacgreg at gmail dot com, and I'll let you know when testing begins.

Otherwise, I'm not sure how to accomplish what you want -- but I'll pass the question on to the developers, who should.

Cheers,
James

mcrider
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Display a block only in frontend pages

Postby mcrider » Wed Apr 07, 2010 5:10 pm

Hi Marco,

One way to do this is to pass Request::getRequestedPage(); from your plugin's display function to its template, and put a big if statement around the template's code, with something like
{if page != 'editor' && page != 'manager'...} (and any other pages you don't want displayed). This way, the plugin won't display if the user is on any of those pages. A similar example is the 'donationEnabled' variable in the Donation block plugin.

BTW, feel free to share your plugins in our plugin gallery :)

Cheers,
Matt


Return to “OJS Development”

Who is online

Users browsing this forum: No registered users and 0 guests