Moderators: jmacgreg, michael, John, vgabler
- Templates: Any plugin can keep templates in its plugin directory and
display them by calling:
$templateMgr->display($this->getTemplatePath() . 'templateName.tpl');
See the native import/export plugin for an example.
mcrider wrote:I think you're on the right path, and I also think this is a pretty good idea. Essentially you are going to want to wrap the code in the header.tpl file that you don't want with an if statement that will only execute if there isn't replacement code in the theme directory. I would suggest taking a look at how the sidebar code is called in the header file, and how hooks are registered in general. I think you'll need to add some registration code to your theme plugin, and when it is active (i.e. when the theme is selected), it should in turn call the templateMgr->display function showing your custom header code.
mcrider wrote:Hi again Spacewalk,
Sure, but instead of modifying the header file, you would have to modify, e.g. templates/index/journal.tpl. Where it says {include file="common/header.tpl"}, you would have to check for the hook you registered in your plugin, and if it is registered, to display your custom header.tpl (otherwise, include common/header.tpl). In any case, you're going to have to modify system template files.
Hope that helps,
Matt
spacewalk wrote:This person, for example, is detecting what OJS is displaying, and then invoking custom CSS for particular display situations.
viewtopic.php?f=8&t=3084&start=0#p11829
mcrider wrote:Hi again,spacewalk wrote:This person, for example, is detecting what OJS is displaying, and then invoking custom CSS for particular display situations.
viewtopic.php?f=8&t=3084&start=0#p11829
What this person is doing is selectively including css--I.e. he built his custom theme, but modified the activate function to only include certain css files when on certain pages (e.g load the editorSubmission.css when editors are viewing the submissions page). This won't be very useful for overriding templates.. {include file="common/header.tpl"} is hardcoded into the templates/index/site.tpl file and if you don't want OJS to include that file, you'll have to do what I suggested above.
The overridden activate function is a good place to register a hook, however! Sorry if i'm still not following your point...
Cheers,
Matt
Return to OJS Editorial Support and Discussion
Users browsing this forum: No registered users and 1 guest