View Full Version : Hook location for headinclude
Christos Teriakis
06-13-2013, 06:23 AM
Hello,
I want to add in headinclude a template (template_hook.headinclude_css), a template with some calls to external css files and javascripts but I can't find out which is the correct hook location. Tried all css relevant locations, global start, parse templates etc but none seems to work. Any idea??
Thank you
Christos
parse_templates should work, it's just before the header template is rendered.
Christos Teriakis
06-13-2013, 10:08 AM
parse_templates should work, it's just before the header template is rendered.
It's the first that I tried:cool: But didn't worked. I'll recheck the code, but the template that I'm trying to implement is very simple:.
<link rel="stylesheet" href="christeris/ratemysite/includes/jqModal.css" type="text/css" />
<script type="text/javascript" src="christeris/ratemysite/includes/jqModal.js"></script>
<script type="text/javascript">
$().ready(function() {
$('#userrate').jqm({trigger: 'a.userrate'});
});
</script>
Thank you
Lynne
06-13-2013, 02:26 PM
What is the code you are adding to the plugin? Perhaps that is incorrect.
Christos Teriakis
06-14-2013, 05:16 AM
What is the code you are adding to the plugin? Perhaps that is incorrect.
I've no experiance with hooks, so I used a similar way that I use to add menus in left sidebar in user settings page.
1.- Plugin code:
<plugin active="1" executionorder="10">
<title>RateMySite: Includes</title>
<hookname>parse_templates</hookname>
<phpcode><![CDATA[
$template_hook['headinclude_css'] .= vB_Template::create('ratemysite_headinclude')->render();
]]></phpcode>
</plugin>
2.- Template code:
<template name="ratemysite_headinclude" templatetype="template" date="1160112327" username="ChrisTERiS" version="1.0.0">
<![CDATA[
<script type="text/javascript" src="christeris/ratemysite/includes/jquery.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
<script type="text/javascript" src="christeris/ratemysite/includes/skinable_tabs.min.js"></script>
]]>
</template>
Thank you
Christos
Are you still having a problem with it? I tried creating a plugin using parse_templates with that code, and I created a template called ratemysite_headinclude with the code you posted, and it works for me (I didn't use a product xml file so I can't say that the xml you posted is exactly right).
Did you check the html source of a page to see if anything is there?
Christos Teriakis
06-14-2013, 09:31 AM
Are you still having a problem with it? I tried creating a plugin using parse_templates with that code, and I created a template called ratemysite_headinclude with the code you posted, and it works for me (I didn't use a product xml file so I can't say that the xml you posted is exactly right).
Did you check the html source of a page to see if anything is there?
Strange.... very strange... Yes, I'm sure for the code... I also cleared many times the cached. Also, except reading the page's output code, I used the search to find any of the script names. Nothing.
In any case thank you both for your help. I already released my mod yesterday, and I believe that is not good to add this plugin as will confuse the members who already manually added those links.
Christos
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.