The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Find Replace into Template PlugIn Code
Hi all,
in vb3 i use that code to make changes to templates (parse_templates hook) PHP Code:
Thanks in Advance SorentoUltimate --------------- Added [DATE]1307191611[/DATE] at [TIME]1307191611[/TIME] --------------- can someone help me on the above? i need to make automatic template edits into plugins with code. |
#2
|
|||
|
|||
Have you tried this in vb4? I haven't tried it but all the same functions/variables seem to be there.
|
#3
|
||||
|
||||
i try that code:
PHP Code:
Quote:
|
#4
|
||||
|
||||
Lynne has a modification here you should view the .xml and see where your going wrong, will help you visualize how it's done in vB4 .
https://vborg.vbsupport.ru/showthread.php?t=229290 |
#5
|
||||
|
||||
Hi again,
Here are the Templates and Plugin Code to help me solve the problem : a.Template "greeklish2greek_SHOWTHREAD_fnd" Code:
<div class="blockfoot actionbuttons"> <div class="group"> <span id="qr_posting_msg" class="hidden"> <img src="{vb:stylevar imgdir_misc}/progress.gif" alt="{vb:rawphrase posting_quick_reply_please_wait}" /> <strong>{vb:rawphrase posting_quick_reply_please_wait}</strong> </span> <vb:if condition="$show['fb_publishcheckbox']"> {vb:raw fbpublishcheckbox} </vb:if> <input type="submit" class="button" value="{vb:rawphrase post_quick_reply}" accesskey="s" title="(Alt + S)" name="sbutton" tabindex="1" id="qr_submit" onclick="clickedelm = this.value" /> <input type="submit" class="button" value="{vb:rawphrase go_advanced}" accesskey="x" title="(Alt + X)" name="preview" tabindex="1" id="qr_preview" onclick="clickedelm = this.value" /> <input type="reset" id="qr_cancelbutton" class="button" style="display:none;" value="{vb:rawphrase cancel}" accesskey="c" title="(Alt + C)" name="cancel" tabindex="4" onclick="qr_reset();" /> </div> </div> b.Template "greeklish2greek_SHOWTHREAD_rpl" Code:
<div class="blockfoot actionbuttons"> <div class="group"> <span id="qr_posting_msg" class="hidden"> <img src="{vb:stylevar imgdir_misc}/progress.gif" alt="{vb:rawphrase posting_quick_reply_please_wait}" /> <strong>{vb:rawphrase posting_quick_reply_please_wait}</strong> </span> <vb:if condition="$show['fb_publishcheckbox']"> {vb:raw fbpublishcheckbox} </vb:if> <input type="button" class="button" value="{vb:rawphrase greeklish2greek}" accesskey="g" title="(Alt + G)" name="greeklish2greek" tabindex="1" onClick="greeklish2greek_message('vbform', 'quick_reply', '2');" /> <input type="submit" class="button" value="{vb:rawphrase post_quick_reply}" accesskey="s" title="(Alt + S)" name="sbutton" tabindex="1" id="qr_submit" onclick="clickedelm = this.value" /> <input type="submit" class="button" value="{vb:rawphrase go_advanced}" accesskey="x" title="(Alt + X)" name="preview" tabindex="1" id="qr_preview" onclick="clickedelm = this.value" /> <input type="reset" id="qr_cancelbutton" class="button" style="display:none;" value="{vb:rawphrase cancel}" accesskey="c" title="(Alt + C)" name="cancel" tabindex="4" onclick="qr_reset();" /> </div> </div> c.Part of Template "SHOWTHREAD" Code:
..... <vb:if condition="$show['quickreply']"> <div id="qr_defaultcontainer" class="blockfoot floatcontainer qrcontainer<vb:if condition="$show['qr_require_click']"> qr_require_click</vb:if>"> <form class="vbform" name="quick_reply" id="quick_reply" method="post" action="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}newreply.php?do=postreply&t={vb:raw threadid}" onsubmit="return qr_prepare_submit(this, {vb:raw vboptions.postminchars});"> <div id="qr_error_tbody" class="block errorblock hidden"> <h3 class="blockhead">{vb:rawphrase errors}</h3> <div class="blockbody formcontrols"> <h3 class="blocksubhead">{vb:rawphrase errors_occured_when_submitted}</h3> <div class="blockrow error" id="qr_error_td"></div> </div> <div class="blockfoot actionbuttons"><div class="group"><a href="javascript://" class="textcontrol" onclick="return qr_hide_errors()">{vb:rawphrase okay}</a></div></div> </div> <div class="fullwidth"><h3 id="quickreply_title" class="blockhead"><img src="{vb:stylevar imgdir_button}/reply_40b.png" alt="{vb:rawphrase quick_reply}" style="float:{vb:stylevar left};padding-{vb:stylevar right}:{vb:stylevar padding}"/> {vb:rawphrase quick_reply}<a name="quickreply"></a> <img style="display:none" id="progress_newreplylink_bottom" src="{vb:stylevar imgdir_misc}/progress.gif" alt="" /></h3></div> <div class="wysiwyg_block"> <div class="blockbody formcontrols"> <div class="blockrow"> {vb:raw messagearea} </div> <vb:if condition="$bbuserinfo['signature']"> <div class="blockrow"> <ul class="checkradio group"> <li><label for="cb_signature"> <input type="checkbox" name="signature" id="cb_signature" value="1" checked="checked" tabindex="1" /> {vb:rawphrase show_your_signature} </label></li> </ul> </div> </vb:if> <vb:if condition="$show['openclose']"> <div class="openclose"> <ul class="checkradio"> <li><label for="cb_openclose"> <input type="checkbox" name="openclose" id="cb_openclose" value="1" tabindex="1" /> <vb:if condition="$show['closethread']">{vb:rawphrase close_this_thread}<vb:else />{vb:rawphrase reopen_this_thread}</vb:if> </label></li> </ul> </div> </vb:if> </div> <div class="blockfoot actionbuttons"> <div class="group"> <span id="qr_posting_msg" class="hidden"> <img src="{vb:stylevar imgdir_misc}/progress.gif" alt="{vb:rawphrase posting_quick_reply_please_wait}" /> <strong>{vb:rawphrase posting_quick_reply_please_wait}</strong> </span> <vb:if condition="$show['fb_publishcheckbox']"> {vb:raw fbpublishcheckbox} </vb:if> <input type="submit" class="button" value="{vb:rawphrase post_quick_reply}" accesskey="s" title="(Alt + S)" name="sbutton" tabindex="1" id="qr_submit" onclick="clickedelm = this.value" /> <input type="submit" class="button" value="{vb:rawphrase go_advanced}" accesskey="x" title="(Alt + X)" name="preview" tabindex="1" id="qr_preview" onclick="clickedelm = this.value" /> <input type="reset" id="qr_cancelbutton" class="button" style="display:none;" value="{vb:rawphrase cancel}" accesskey="c" title="(Alt + C)" name="cancel" tabindex="4" onclick="qr_reset();" /> </div> </div> </div> <input type="hidden" name="fromquickreply" value="1" /> <input type="hidden" name="s" value="{vb:raw session.sessionhash}" /> <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" /> <input type="hidden" name="do" value="postreply" /> <input type="hidden" name="t" value="{vb:raw threadid}" id="qr_threadid" /> <input type="hidden" name="p" value="{vb:raw qrpostid}" id="qr_postid" /> <input type="hidden" name="specifiedpost" value="0" id="qr_specifiedpost" /> <input type="hidden" name="parseurl" value="1" /> <input type="hidden" name="loggedinuser" value="{vb:raw bbuserinfo.userid}" /> <input type="hidden" name="posthash" value="" /> <input type="hidden" name="poststarttime" value="" /> <vb:if condition="!is_browser('ie') AND $show['wysiwyg']"> <!-- Mozilla work around for focusing on QR in WYSIWYG mode --> <div id="qr_scroll"></div> </vb:if> </form> </div> </vb:if> ..... d.Plugin "parse_templates" Code Code:
$find_string = vB_Template::fetch_template_raw('greeklish2greek_SHOWTHREAD_fnd'); $repl_string = vB_Template::fetch_template_raw('greeklish2greek_SHOWTHREAD_rpl'); $vbulletin->templatecache['SHOWTHREAD'] = str_replace($find_string, $repl_string, $vbulletin->templatecache['SHOWTHREAD']); but not work, i need your help !!!! |
#6
|
||||
|
||||
any help???????????
|
#7
|
||||
|
||||
<a href="https://vborg.vbsupport.ru/showthread.php?p=2204110#post2204110" target="_blank">https://vborg.vbsupport.ru/showt...10#post2204110</a>
|
#8
|
||||
|
||||
Hi Boofo,
i try that but not work Code:
$find_string = ''; $repl_string = ''; $parser = new vB_TemplateParser(vB_Template::fetch_template_raw('greeklish2greek_SHOWTHREAD_fnd')); $parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible()); $find_string = trim($parser->_parse_nodes($parser->dom_doc->childNodes())); $parser = new vB_TemplateParser(vB_Template::fetch_template_raw('greeklish2greek_SHOWTHREAD_rpl')); $parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible()); $repl_string = trim($parser->_parse_nodes($parser->dom_doc->childNodes())); $vbulletin->templatecache['SHOWTHREAD'] = str_replace($find_string, $repl_string, $vbulletin->templatecache['SHOWTHREAD']); any idea what i'm doing wrong? |
#9
|
||||
|
||||
Use the code EXACTLY as I posted. You can't change the position and syntax of the lines to what you want them to be. Just add your code to find and replace where I showed you in red. The template name is all you should be changing.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|