You are viewing the PKP Support Forum | PKP Home Wiki

displaying contents of one page in another

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.

displaying contents of one page in another

Postby katkade » Mon Sep 18, 2006 1:49 pm


I am trying to do the following

I have a page called editorialTeam.tpl in the templates\about folder, which is handled by AboutHandler class defined in pages\about.

I want to display the information contained in editorialTeam.tpl into my header, and hence I am trying to modify templates\common\header.tpl

I have tried various smarty functions like
Code: Select all
{include file="editorialTeam.tpl "}
{display_template template="editorialTeam.tpl"}
(i coped the editorialTeam.tpl into the templates\common directory)

However, nothing is showing up in my final page.

The original pages\about\index.php page included the handler as
Code: Select all
define('HANDLER_CLASS', 'AboutHandler');

How do I include this handler to be a part of my header.tpl, or such that header.tpl can refer to this handler. Basically, how do I display the contents as shown in editorialTeam.tpl in the file header.tpl

Posts: 2
Joined: Mon Sep 18, 2006 1:34 pm

Postby asmecher » Tue Sep 19, 2006 4:29 am

Hi Katkade,

You'll need to copy the code from AboutHandler::editorialTeam into a common place, such as TemplateManager::TemplateManager(). Some modifications to this code will be necessary, e.g. to make sure that you're viewing a page in the context of a journal. For performance reasons, you'll probably want to add some caching -- as noted in AboutHandler::editorialTeam, the query used to fetch the editorial team information is fairly inefficient and if it's called on every request there will be performance penalties.

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

Postby mgoay » Tue Sep 19, 2006 4:34 pm

Hi Alec,

How would one add caching? Pointer to some documentation will be greatly appreciated.

Posts: 3
Joined: Wed Jul 19, 2006 7:57 pm

Postby asmecher » Wed Sep 20, 2006 12:20 am

Hi Michael,

Caching is a little tricky, but there are a number of ways you could go about it:

1. Use ADODB caching to cache the results of the relevant SQL queries on the filesystem;
2. Use OJS's FileCache class (classes/cache/FileCache.inc.php), or
3. Use Smarty's template caching mechanism.

In this case, I think the best approach would be the FileCache class, as OJS currently doesn't use Smarty template caching (although it does use precompiled templates). There are many examples of the cache classes in action, such as in classes/journal/JournalSettingsDAO.inc.php; in particular, look at JournalSettingsDAO::_getCache, _cacheMiss, getSetting, and updateSetting.

You'll also need to add a line or two of code to RoleDAO and GroupDAO and GroupMembershipDAO to flush the cache, as these classes are responsible for changing the data that you'll be caching.

I assume you've seen the technical reference, available on the Documents page under the OJS website.

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

Return to OJS Technical Support

Who is online

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