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

Reply
 
Thread Tools Display Modes
  #21  
Old 11-16-2009, 12:25 PM
Shadab's Avatar
Shadab Shadab is offline
 
Join Date: Apr 2007
Location: Bhopal
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Yellow Slider View Post
Yes.
Try the code below:

PHP Code:
$abcHTML vB_Template::Create('abc')->render();

vB_Template:preRegister('FORUMHOME', array('var' => $abcHTML)); 
Then you can use {vb:raw var} in your Forumhome template to insert the evaluated html.
Let me know how it goes.
Reply With Quote
  #22  
Old 11-16-2009, 12:32 PM
Yellow Slider Yellow Slider is offline
 
Join Date: Aug 2006
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Shadab View Post
Try the code below:

PHP Code:
$abcHTML vB_Template::Create('abc')->render();

vB_Template:preRegister('FORUMHOME', array('var' => $abcHTML)); 
Then you can use {vb:raw var} in your Forumhome template to insert the evaluated html.
Let me know how it goes.
I get en error:
Parse error: syntax error, unexpected ':' in public_html/forum/global.php(28) : eval()'d code on line 3
Reply With Quote
  #23  
Old 11-16-2009, 12:34 PM
Shadab's Avatar
Shadab Shadab is offline
 
Join Date: Apr 2007
Location: Bhopal
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Yellow Slider View Post
I get en error:
Parse error: syntax error, unexpected ':' in public_html/forum/global.php(28) : eval()'d code on line 3
A colon was missing in line 3. Sorry. Try this:

PHP Code:
$abcHTML vB_Template::create('abc')->render();

vB_Template::preRegister('FORUMHOME', array('var' => $abcHTML)); 
Reply With Quote
  #24  
Old 11-16-2009, 12:39 PM
Yellow Slider Yellow Slider is offline
 
Join Date: Aug 2006
Posts: 249
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Shadab View Post
A colon was missing in line 3. Sorry. Try this:

PHP Code:
$abcHTML vB_Template::create('abc')->render();

vB_Template::preRegister('FORUMHOME', array('var' => $abcHTML)); 
Great, it's working, thank you

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

Quote:
Originally Posted by Shadab View Post
A colon was missing in line 3. Sorry. Try this:

PHP Code:
$abcHTML vB_Template::create('abc')->render();

vB_Template::preRegister('FORUMHOME', array('var' => $abcHTML)); 
One more question, why did you add the "HTML" at the end of the variable?
Reply With Quote
  #25  
Old 11-16-2009, 01:51 PM
Omegatron Omegatron is offline
 
Join Date: Feb 2003
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Because the template example he gave the name of the template was $abcHTML thats all in his example.

Now the point I am making is I can make what I am doing work by defining a new hook works great. even pre registering values can work fine but that still means you need to hand edit the actual template you want to insert it to and place the variable there. With str_replace you never had to hand edit templates plugins where just that true plugins without having to touch the vb code. If I upgrade vb then one will have to redo there template edits which to me is a huge design flaw. If the vb developers are going to lock you into doing things a certain why then they really need to place template hooks in alot of places.
Reply With Quote
  #26  
Old 11-16-2009, 02:06 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Since I am at work, I cannot check your assertion that str_replace() cannot be used, but even if it were true, its not a design flaw in vb4 - it was never an official plugin method, but mearly a hack that happened to work. So if anything, it was a design flaw in 3.x

Off the top of my head, I cant think why it would no longer work, but as I said, Im at work, so cant check anything.
Reply With Quote
  #27  
Old 11-16-2009, 02:11 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Omegatron View Post
Because the template example he gave the name of the template was $abcHTML thats all in his example.

Now the point I am making is I can make what I am doing work by defining a new hook works great. even pre registering values can work fine but that still means you need to hand edit the actual template you want to insert it to and place the variable there. With str_replace you never had to hand edit templates plugins where just that true plugins without having to touch the vb code. If I upgrade vb then one will have to redo there template edits which to me is a huge design flaw. If the vb developers are going to lock you into doing things a certain why then they really need to place template hooks in alot of places.
I think you may want to start a thread an post your code in there. In on of my mods, I preregistered variables and then used str_replace to put them in a template. So, it can be done just like before with a little bit of registering/preregistering of your variables.
Reply With Quote
  #28  
Old 11-16-2009, 02:27 PM
Omegatron Omegatron is offline
 
Join Date: Feb 2003
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I already did my friend in post 13 I basically responded right to you when you asked me to post the code.

I defined one variable for use in my template as thats all that is needed but I can not get the template included where I want because there is no hook using a str_replace

Defining a new hook works great thats not an issue but I want to keep from having to hand edit vb templates in any manner.

https://vborg.vbsupport.ru/showpost....6&postcount=13
Reply With Quote
  #29  
Old 11-16-2009, 02:41 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Omegatron View Post
I already did my friend in post 13 I basically responded right to you when you asked me to post the code.

I defined one variable for use in my template as thats all that is needed but I can not get the template included where I want because there is no hook using a str_replace

Defining a new hook works great thats not an issue but I want to keep from having to hand edit vb templates in any manner.

https://vborg.vbsupport.ru/showpost....6&postcount=13
I was suggesting your own new thread because this one has so many users posting in it and it's hard to follow conversations.

Anyway, I don't think your search/replace is correct. You wrote:
PHP Code:
$search_text '<div id=\"pagetitle\">';
    
$vbulletin->templatecache['FORUMHOME'] = str_replace($search_text,$thistemplater.$search_text,$vbulletin->templatecache['FORUMHOME']); 
And you don't need to escape the double-quotes since you have it inside single quotes.
PHP Code:
$search_text '<div id="pagetitle">';
    
$vbulletin->templatecache['FORUMHOME'] = str_replace($search_text,$thistemplater.$search_text,$vbulletin->templatecache['FORUMHOME']); 
Reply With Quote
  #30  
Old 11-16-2009, 05:15 PM
Omegatron Omegatron is offline
 
Join Date: Feb 2003
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If I do what you say its a parse error. In all my days of PHP you need to escape quotes when you use html in a php file.
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 07:42 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04277 seconds
  • Memory Usage 2,285KB
  • Queries Executed 11 (?)
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
  • (7)bbcode_php
  • (7)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
  • (3)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
  • (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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete