ChiNa
08-28-2012, 09:19 PM
Hi everyone, I am slowly moving to vB 4.x and I dont know much about how to use the replace and find variable, by making an XML PRODUCT... And I have only learned on here is to REPLACE, and only about and for vB3.8 versions.
I have done a few products using the replace for vB3.8 with help of an amazing member named "Scanu". And today I used the code he helped me with for vB4.x, It did the replace perfectly and added my code but after refreshing my forum,
But I got this error below:
Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: my_bar in [path]/includes/functions.php on line 4734
Warning: array_merge() [function.array-merge (https://vborg.vbsupport.ru/#)]: Argument #1 is not an array in [path]/includes/class_bootstrap.php(1419) : eval()'d code on line 3 ::::::::::::::::::::::::::::::::::
Below is the replace code i used on my vB3.8 which gave me the error on a vB 4.2 version, but it did replace, and it did work!
$replace = '<div class="above_body">';
$vbulletin->templatecache['header'] = str_replace('<div class="above_body">',fetch_template('my_bar'),$vbulletin->templatecache['header']);
::::::::::::::::::::::::::::::::::
And below is yet another code I use in my xml products, Now this code does the Installing, but nothing showes up.
<template name="My_Bar" templatetype="template" date="1516171819" username="ChiNaMan" version="1.0"><![CDATA[
<style type="text/css">
#SideBar li{
margin:9px 0 0 0;
line-height:0
}
#SideBar li:first-child{
margin-top:0
}
#SideBar a{
display:block;
width:24px;
}
#SideBar a span{
position:absolute;
top:-999em
}
</style>
<div class="above_body">
]]></template>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>My Bar</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[if ($vbulletin->options['my_bar_on'])
{
$replace = '<div class="above_body">';
$vbulletin->templatecache['header'] = str_replace($replace,$replace.'<div class="above_body">',$vbulletin->templatecache['header']);
}
]]></phpcode>
What am I doing wrong.. If someone could please explain short how to ADD a simple code inside a vB4.x template, or simply tell how to use the $replace which I did. So the vB3.8 code did work, but with the FETCH error, and the code below did the Install, but notthing is showing up!
My modification is a SIDEBAR with only 1 Button that should show up on my frontpage, RIGHT SIDE.. I think its about 15 to 20 lines of CSS and HTML!Thank you very much in advance,,
And a big thanks to Scanu for all his help this week!
I have done a few products using the replace for vB3.8 with help of an amazing member named "Scanu". And today I used the code he helped me with for vB4.x, It did the replace perfectly and added my code but after refreshing my forum,
But I got this error below:
Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: my_bar in [path]/includes/functions.php on line 4734
Warning: array_merge() [function.array-merge (https://vborg.vbsupport.ru/#)]: Argument #1 is not an array in [path]/includes/class_bootstrap.php(1419) : eval()'d code on line 3 ::::::::::::::::::::::::::::::::::
Below is the replace code i used on my vB3.8 which gave me the error on a vB 4.2 version, but it did replace, and it did work!
$replace = '<div class="above_body">';
$vbulletin->templatecache['header'] = str_replace('<div class="above_body">',fetch_template('my_bar'),$vbulletin->templatecache['header']);
::::::::::::::::::::::::::::::::::
And below is yet another code I use in my xml products, Now this code does the Installing, but nothing showes up.
<template name="My_Bar" templatetype="template" date="1516171819" username="ChiNaMan" version="1.0"><![CDATA[
<style type="text/css">
#SideBar li{
margin:9px 0 0 0;
line-height:0
}
#SideBar li:first-child{
margin-top:0
}
#SideBar a{
display:block;
width:24px;
}
#SideBar a span{
position:absolute;
top:-999em
}
</style>
<div class="above_body">
]]></template>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>My Bar</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[if ($vbulletin->options['my_bar_on'])
{
$replace = '<div class="above_body">';
$vbulletin->templatecache['header'] = str_replace($replace,$replace.'<div class="above_body">',$vbulletin->templatecache['header']);
}
]]></phpcode>
What am I doing wrong.. If someone could please explain short how to ADD a simple code inside a vB4.x template, or simply tell how to use the $replace which I did. So the vB3.8 code did work, but with the FETCH error, and the code below did the Install, but notthing is showing up!
My modification is a SIDEBAR with only 1 Button that should show up on my frontpage, RIGHT SIDE.. I think its about 15 to 20 lines of CSS and HTML!Thank you very much in advance,,
And a big thanks to Scanu for all his help this week!