vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Hook location for headinclude (https://vborg.vbsupport.ru/showthread.php?t=299049)

Christos Teriakis 06-13-2013 06:23 AM

Hook location for headinclude
 
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

kh99 06-13-2013 09:29 AM

parse_templates should work, it's just before the header template is rendered.

Christos Teriakis 06-13-2013 10:08 AM

Quote:

Originally Posted by kh99 (Post 2427831)
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:.
Code:

<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

Quote:

Originally Posted by Lynne (Post 2427888)
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:
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:
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

kh99 06-14-2013 09:03 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?

Christos Teriakis 06-14-2013 09:31 AM

Quote:

Originally Posted by kh99 (Post 2428053)
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


All times are GMT. The time now is 05:25 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01053 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete