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

Reply
 
Thread Tools Display Modes
  #11  
Old 06-25-2013, 02:07 PM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It could be a problem of the condition try to remove only the condition and leave the rest of the code just to see

--------------- Added [DATE]1372173285[/DATE] at [TIME]1372173285[/TIME] ---------------

else use this code by Boofo in the "parse_templates" hook
PHP Code:
$templater vB_Template::create('test');
$test $templater->render();
require_once(
DIR '/includes/class_template_parser.php');
$parser = new vB_TemplateParser('{vb:raw messagearea}');
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$find trim($parser->_parse_nodes($parser->dom_doc->childNodes()));
$vbulletin->templatecache['newthread'] = str_replace($find$test$vbulletin->templatecache['newthread']); 
Reply With Quote
  #12  
Old 06-25-2013, 02:16 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Scanu View Post
It could be a problem of the condition try to remove only the condition and leave the rest of the code just to see

--------------- Added [DATE]1372173285[/DATE] at [TIME]1372173285[/TIME] ---------------

else use this code by Boofo
PHP Code:
$templater vB_Template::create('test');
$test $templater->render();
require_once(
DIR '/includes/class_template_parser.php');
$parser = new vB_TemplateParser('{vb:raw messagearea}');
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$find trim($parser->_parse_nodes($parser->dom_doc->childNodes()));
$vbulletin->templatecache['newthread'] = str_replace($find$test$vbulletin->templatecache['newthread']); 
i have try it but not work

Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\forum\includes\class_core.php(4633 ) : eval()'d code on line 91
Reply With Quote
  #13  
Old 06-25-2013, 02:27 PM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Mmh did you use "parse_templates" as hook location? If yes then i don't know what's the problem maybe this one is a little tricky but it should 100% works
Hook: parse_templates
PHP Code:
$template 'your template code';

require_once(
DIR '/includes/class_template_parser.php');

$parser = new vB_TemplateParser('{vb:raw messagearea}');
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$find trim($parser->_parse_nodes($parser->dom_doc->childNodes()));

$parser = new vB_TemplateParser($template);
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$replace trim($parser->_parse_nodes($parser->dom_doc->childNodes()));

$vbulletin->templatecache['newthread'] = str_replace($find$replace$vbulletin->templatecache['newthread']); 
Put your template code in the template variable and remember to escape quotes!
Reply With Quote
  #14  
Old 06-25-2013, 02:34 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Scanu View Post
Mmh did you use "parse_templates" as hook location? If yes then i don't know what's the problem maybe this one is a little tricky but it should 100% works
Hook: parse_templates
PHP Code:
$template 'your template code';

require_once(
DIR '/includes/class_template_parser.php');

$parser = new vB_TemplateParser('{vb:raw messagearea}');
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$find trim($parser->_parse_nodes($parser->dom_doc->childNodes()));

$parser = new vB_TemplateParser($template);
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$replace trim($parser->_parse_nodes($parser->dom_doc->childNodes()));

$vbulletin->templatecache['newthread'] = str_replace($find$replace$vbulletin->templatecache['newthread']); 
Put your template code in the template variable and remember to escape quotes!
with the above code it is not messagearea
Attachment 145574
Reply With Quote
  #15  
Old 06-25-2013, 02:35 PM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What's your exact code plugin?
Reply With Quote
  #16  
Old 06-25-2013, 02:43 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes
Attached Files
File Type: xml vbulletin-plugins.xml (849 Bytes, 2 views)
Reply With Quote
  #17  
Old 06-25-2013, 02:46 PM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is the final code just replace "your template code" with your template code and it will work fine unless you won't escape quotes
PHP Code:
$template 'your template code'

require_once(
DIR '/includes/class_template_parser.php'); 

$parser = new vB_TemplateParser('{vb:raw messagearea}'); 
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible()); 
$find trim($parser->_parse_nodes($parser->dom_doc->childNodes())); 

$parser = new vB_TemplateParser($template); 
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible()); 
$replace trim($parser->_parse_nodes($parser->dom_doc->childNodes())); 

$vbulletin->templatecache['newthread'] = str_replace($find$find.$replace$vbulletin->templatecache['newthread']); 
Reply With Quote
  #18  
Old 06-25-2013, 02:52 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

not work, you can TeamViewer help me

I need to create a user name is entered in newthread, and the user name are displayed like private.php page?do=newpm
Reply With Quote
  #19  
Old 06-25-2013, 03:04 PM
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Posts: 829
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My code is working? Do you want to add an input in the newthread page where users put username?
Reply With Quote
  #20  
Old 06-25-2013, 03:10 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Scanu View Post
My code is working? Do you want to add an input in the newthread page where users put username?
Your code does not work.

I want to create a new thread, enter username like this
Attachment 145576
Reply With Quote
Reply


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 12:58 AM.


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.04764 seconds
  • Memory Usage 2,312KB
  • 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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (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_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • 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
  • 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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete