OJS OCS OMP OHS

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
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.

displaying contents of one page in another

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

Hi,

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');
import('pages.about.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

Thanks
katkade
 
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.

Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
Posts: 9050
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.

Thanks,
Michael
mgoay
 
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.

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


Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 4 guests