Software Hosting and Development Services available at PKP Publishing Services
As the developers of Open Journal Systems, Open Conference Systems, Open Harvester Systems, and Open Monograph Press, the PKP team are experts in helping journal managers and conference organizers make the most of their online publishing projects. PKP Publishing Services offers support for:
As a customer of PKP Publishing Services, you will not only receive direct, personalized support from the PKP Development Team, but will be contributing to the ongoing development of the PKP applications. All funds raised by PKP Publishing Services go directly toward enhancing our free, open source software. For more information, please contact us.
OJS development discussion, enhancement requests, third-party patches and plug-ins.
Moderators: jmacgreg, michael, jheckman, barbarah, btbell, bdgregg, asmecher
Forum rules
Developer Resources:Documentation: The
OJS Technical Reference and the OJS
API Reference are both available from the
OJS Documentation page.
Git: You can access our public Git Repository
here. Comprehensive Git usage instructions are available on the
wiki.
Bugzilla: You can access our Bugzilla report tracker
here.
Search: You can use our
Google Custom Search to search across our main website, the support forum, and Bugzilla.
Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the
OJS Editorial Support and Discussion subforum; if you have a technical support question, try the
OJS Technical Support subforum.
by MarieNyst » Thu Dec 13, 2012 10:06 am
Hi !
I would like to insert javascript in header. For this, I've my register function here :
- Code: Select all
function register($category, $path) {
if (parent::register($category, $path)) {
$this->addLocaleData();
if ($this->getEnabled()) {
// Insert header on every header (callback function checks if it addition is really need)
HookRegistry::register('TemplateManager::display',array(&$this, 'callback'));
}
return true;
}
return false;
}
and my callback function here :
- Code: Select all
function callback($hookName, $args) {
//First argument is a TemplateManager object.
$templateMgr =& $args[0];
//Getting some context.
$journal = &Request::getJournal();
$journalId = $journal->getJournalId();
$page = Request::getRequestedPage();
$op = Request::getRequestedOp();
$currentJournal = $templateMgr->get_template_vars('currentJournal');
//Add additionalHeader just in a few pages of the current Journal:
if (!empty($currentJournal))
{
//Extending template's head:
$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
$additionalHeadData .= "\n\n <!-- Keywords Headers -->\n";
$additionalHeadData .= $templateMgr->fetch('./plugins/generic/keywords/generatedFiles/keywordsChoiceScript.js.tpl');
$additionalHeadData .= " <!-- Keywords Headers -->";
$templateMgr->assign('additionalHeadData', $additionalHeadData);
}
return false;
}
and my script here :
- Code: Select all
{literal}<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<style>
a {color:#333; text-decoration:none}
a:hover {color:#ccc; text-decoration:none}
<!-- style doesn't mater -->
</style>
<script>
function keywordsSetOptions(chosen) {
<!-- script that I've already tested-->
}
$(document).ready(function() {
<!-- some other things I've tested -->
});
</script>{/literal}
Nothing happens, my headers are still the same... Did I make it wrong ?
-
MarieNyst
-
- Posts: 15
- Joined: Thu Nov 29, 2012 9:35 pm
by MarieNyst » Fri Dec 14, 2012 8:44 am
I made the upgrade and it works.
thank you
-
MarieNyst
-
- Posts: 15
- Joined: Thu Nov 29, 2012 9:35 pm
Return to OJS Development
Who is online
Users browsing this forum: No registered users and 0 guests