Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-19-2011, 08:33 PM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default "Compiled template"

Hi everybody! Let's start
Here what kh99

Quote:
Originally Posted by kh99 View Post
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
Code:
$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

Code:
$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"

Code:
<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 [DATE]1324331782[/DATE] at [TIME]1324331782[/TIME] ---------------

I see the database and i've tried this code
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 [DATE]1324332260[/DATE] at [TIME]1324332260[/TIME] ---------------

Code:
$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:
Code:
$find = 'test';
$replace = '';
$vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']);
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:44 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.13026 seconds
  • Memory Usage 2,919KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (24)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (21)post_thanks_box
  • (21)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (21)post_thanks_postbit_info
  • (21)postbit
  • (21)postbit_onlinestatus
  • (21)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete