Scanu
12-19-2011, 08:33 PM
Hi everybody! :) Let's start
Here what kh99
Unfortunately it's difficult, I could write pages and still not explain everything (partly because I don't fully understand it myself). But in this case I happen to have a mod that changes the SHOWTHREAD template. It uses the showthread_getinfo hook location and has code like this
$find = "some string";
$replace = "other string";
$vbulletin->templatecache['SHOWTHREAD'] = str_replace($find, $replace, $vbulletin->templatecache['SHOWTHREAD']);
but, $vbulletin->templatecache contains compiled templates so it doesn't look like what you see in the template editor. That makes it tricky to know what you can search for and match. You could look in the template table in the database, the "template" column shows the compiled template. Or what I usually do is put in temporary code to write the cached template string to a file, like
$fp = fopen("showthread.txt", "wb");
fwrite($fp, $vbulletin->templatecache['SHOWTHREAD']);
Then I open that file in my editor so I can refer to it.
I hope that makes some sense.
i need to know what's the code of the compiled template "forumhome_forumbit_level2_post"
I tried your code (FOR SHOWTHREAD) and it gets me a blank text file, so nothing
:( This is the code that i need to "convert"
<vb:comment><h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}">{vb:raw forum.title}</a></h2></vb:comment>
<h2 class="forumtitle"><div id="scanu"><a <vb:if condition="$show[\'forumdescription\']">title=\'<scanu>{vb:raw forum.description}</scanu>\'</vb:if> href="{vb:link forum, {vb:raw forum}}">{vb:raw forum.title}</a></div></h2>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="http://cdn.jquerytools.org/1.2.6/all/jquery.tools.min.js"></script>
<script>
$("#scanu a[title]").tooltip({
position: \'center right\',
effect: \'slide\'
});
</script>
<style>
scanu {
background:black;
color:white;
padding: 5px 10px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
filter:alpha(opacity=68);
-moz-opacity:.68;
opacity:.68;
}
</style>
how can i do? :)
thanks in advance :)
--------------- Added 1324331782 at 1324331782 ---------------
I see the database and i've tried this code
$find = '<h2 class="forumtitle"><a href="' . vB_Template_Runtime::linkBuild("forum", $forum) . '">' . $forum['title'] . '</a></h2>';
$replace = '
<h2 class="forumtitle"><div id="scanu"><a title=\'<scanu>' . $forum['description'] . '</scanu>\' href="' . vB_Template_Runtime::linkBuild("forum", $forum) . '">' . $forum['title'] . '</a></div></h2>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="http://cdn.jquerytools.org/1.2.6/all/jquery.tools.min.js"></script>
<script>
$("#scanu a[title]").tooltip({
position: \'center right\',
effect: \'slide\'
});
</script>
<style>
scanu {
background:black;
color:white;
padding: 5px 10px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
filter:alpha(opacity=68);
-moz-opacity:.68;
opacity:.68;
}
</style>';
$vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']);
But didn't work :(
--------------- Added 1324332260 at 1324332260 ---------------
$find = '' . $forum['title'] . '';
$replace = '';
$vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']);
This code would be delete the title of the forum but doesn't work! This code instead that would be delete the text "test" without variables works D:
$find = 'test';
$replace = '';
$vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']);
Here what kh99
Unfortunately it's difficult, I could write pages and still not explain everything (partly because I don't fully understand it myself). But in this case I happen to have a mod that changes the SHOWTHREAD template. It uses the showthread_getinfo hook location and has code like this
$find = "some string";
$replace = "other string";
$vbulletin->templatecache['SHOWTHREAD'] = str_replace($find, $replace, $vbulletin->templatecache['SHOWTHREAD']);
but, $vbulletin->templatecache contains compiled templates so it doesn't look like what you see in the template editor. That makes it tricky to know what you can search for and match. You could look in the template table in the database, the "template" column shows the compiled template. Or what I usually do is put in temporary code to write the cached template string to a file, like
$fp = fopen("showthread.txt", "wb");
fwrite($fp, $vbulletin->templatecache['SHOWTHREAD']);
Then I open that file in my editor so I can refer to it.
I hope that makes some sense.
i need to know what's the code of the compiled template "forumhome_forumbit_level2_post"
I tried your code (FOR SHOWTHREAD) and it gets me a blank text file, so nothing
:( This is the code that i need to "convert"
<vb:comment><h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}">{vb:raw forum.title}</a></h2></vb:comment>
<h2 class="forumtitle"><div id="scanu"><a <vb:if condition="$show[\'forumdescription\']">title=\'<scanu>{vb:raw forum.description}</scanu>\'</vb:if> href="{vb:link forum, {vb:raw forum}}">{vb:raw forum.title}</a></div></h2>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="http://cdn.jquerytools.org/1.2.6/all/jquery.tools.min.js"></script>
<script>
$("#scanu a[title]").tooltip({
position: \'center right\',
effect: \'slide\'
});
</script>
<style>
scanu {
background:black;
color:white;
padding: 5px 10px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
filter:alpha(opacity=68);
-moz-opacity:.68;
opacity:.68;
}
</style>
how can i do? :)
thanks in advance :)
--------------- Added 1324331782 at 1324331782 ---------------
I see the database and i've tried this code
$find = '<h2 class="forumtitle"><a href="' . vB_Template_Runtime::linkBuild("forum", $forum) . '">' . $forum['title'] . '</a></h2>';
$replace = '
<h2 class="forumtitle"><div id="scanu"><a title=\'<scanu>' . $forum['description'] . '</scanu>\' href="' . vB_Template_Runtime::linkBuild("forum", $forum) . '">' . $forum['title'] . '</a></div></h2>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="http://cdn.jquerytools.org/1.2.6/all/jquery.tools.min.js"></script>
<script>
$("#scanu a[title]").tooltip({
position: \'center right\',
effect: \'slide\'
});
</script>
<style>
scanu {
background:black;
color:white;
padding: 5px 10px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
filter:alpha(opacity=68);
-moz-opacity:.68;
opacity:.68;
}
</style>';
$vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']);
But didn't work :(
--------------- Added 1324332260 at 1324332260 ---------------
$find = '' . $forum['title'] . '';
$replace = '';
$vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']);
This code would be delete the title of the forum but doesn't work! This code instead that would be delete the text "test" without variables works D:
$find = 'test';
$replace = '';
$vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']);