vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Include Html as Header (https://vborg.vbsupport.ru/showthread.php?t=268897)

MayerZwo 08-21-2011 10:55 PM

Include Html as Header
 
Hello

Im trying to include this as Header at my vB4.1.5.
I used this Tutorial but I?m getting two Errors:

[function.file]: failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in [path]/global.php(29) : eval()'d code (Zeile 1)

Warnung: implode() [function.implode]: Invalid arguments passed in [path]/global.php(29) : eval()'d code (Zeile 1)

Thanks for any Help.
Best Regards

MayerZwo 08-23-2011 03:17 PM

Okay, Error Messages are gone now, but the Header doesn`t show up.

What did I do so far:
  1. I made a Plugin called includedhtml with Hook global_start: $includedhtml = implode('', file('http://www.path/to/my_header.html'));
  2. I put {vb:raw includedhtml} at Top of the Header-Template.
I would be glad if someone could help me.
I simply just wanna show the following Header-Code at Top of the Site.

Header Code is:
Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en-us">
<head>
 
  <script type="text/javascript" src="http://www.terrarienbilder.com/parallax/jquery-1.2.6.min.js"></script>
  <script type="text/javascript" src="http://www.terrarienbilder.com/parallax/jquery.jparallax.js"></script>
  <link rel="stylesheet" type="text/css" media="screen" href="http://www.terrarienbilder.com/parallax/style.css">

  <script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#parallax').jparallax({});
});
  </script>
 
 

</head>

<body>

<hr size="1">
<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">

  <tbody>

    <tr>

      <td style="width: 24%;"></td>

      <td style="width: 802px; text-align: center; vertical-align: middle;">
      <div style="border: 1px solid ; position: relative; width: 800px; height: 150px;" id="parallax">

      <div style="width: 800px; height: 150px;"><img alt="" src="http://www.terrarienbilder.com/parallax/bg_1.png"></div>

      <div style="width: 990px; height: 180px;">
      <img style="position: absolute; top: -40px; left: 650px;" alt="" src="http://www.terrarienbilder.com/parallax/palm_1.png"></div>

      </div>

      </td>

      <td style="width: 24%;"></td>

    </tr>

  </tbody>
</table>

<hr size="1">
</body>
</html>

Best regards

Disasterpiece 08-23-2011 03:30 PM

what does the file function do and are you sure it returns an array?

I'm not sure if you actually know what you're doing with the implode and file functions there, otherwise you'd know what causes this, apparently file does not return an array, which implode expects.
Also: URL path instead of absolute path? weird

MayerZwo 08-25-2011 02:21 PM

Ok, I managed it to show the Header.
I simply added the Code directly into the Header-Template. :o

Well, one Problem stays.
The Header has an jparallax-Effect. As soon as I put the following Code into Header-Template I can`t save the Template. So I`m not able to get the jparallax working.
Code:

<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#parallax').jparallax({});
});
  </script>

Has anybody an Idea what`s wrong or where I should put this Code in ?
I tried headinclude-Template, doesn`t work.

Thanks in advance
MayerZwo

nhawk 08-25-2011 02:49 PM

Create a plugin that uses the 'parse_templates' hook.

Place this code in the plugin..
Code:

$template_hook['headinclude_javascript'] .= ' <script type="text/javascript" src="http://www.terrarienbilder.com/parallax/jquery-1.2.6.min.js"></script>
  <script type="text/javascript" src="http://www.terrarienbilder.com/parallax/jquery.jparallax.js"></script>
  <link rel="stylesheet" type="text/css" media="screen" href="http://www.terrarienbilder.com/parallax/style.css">
<script type="text/javascript">
jQuery(document).ready(function(){';
$template_hook['headinclude_javascript'] .= "jQuery('#parallax').jparallax({});
});
  </script>";

And remove any of the script information you might have pasted into the header template. Just leave this there...

HTML Code:

<hr size="1">
<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">

  <tbody>

    <tr>

      <td style="width: 24%;"></td>

      <td style="width: 802px; text-align: center; vertical-align: middle;">
      <div style="border: 1px solid ; position: relative; width: 800px; height: 150px;" id="parallax">

      <div style="width: 800px; height: 150px;"><img alt="" src="http://www.terrarienbilder.com/parallax/bg_1.png"></div>

      <div style="width: 990px; height: 180px;">
      <img style="position: absolute; top: -40px; left: 650px;" alt="" src="http://www.terrarienbilder.com/parallax/palm_1.png"></div>

      </div>

      </td>

      <td style="width: 24%;"></td>

    </tr>

  </tbody>
</table>

<hr size="1">


MayerZwo 08-25-2011 03:53 PM

Amazing nhawk !
Works Perfect. Thanks for helping an Noob. :up:

Best regards
MayerZwo


All times are GMT. The time now is 07:06 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.01367 seconds
  • Memory Usage 1,738KB
  • 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
  • (1)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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