PDA

View Full Version : Include Html as Header


MayerZwo
08-21-2011, 10:55 PM
Hello

Im trying to include this as Header (http://www.terrarienbilder.com/parallax/Parallax_3.html) at my vB4.1.5.
I used this Tutorial (https://www.vbulletin.com/docs/html/templates_externalfiles) 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:

I made a Plugin called includedhtml with Hook global_start: $includedhtml = implode('', file('http://www.path/to/my_header.html'));
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:
<!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.
<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..
$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...

<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