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

Reply
 
Thread Tools Display Modes
  #1  
Old 08-02-2010, 06:27 AM
TheSupportForum TheSupportForum is offline
 
Join Date: Jan 2007
Posts: 1,158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Plugin Help Please

please can someone provide support with the plugin system

i wish to add a template condition in the header using $find, the code i iwsh to insert is

Code:
 
<vb:if condition="$vboptions['ie6fix_onoff']">
{vb:rawphrase ie6fix_english}
</vb:if>
i would like this template condition to be placed before

Code:
<div class="above_body"> <!-- closing tag is in template navbar -->
in the header template
Reply With Quote
  #2  
Old 08-02-2010, 02:25 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You will need to do your condition first. Then spit the results into a variable, like $add_before. Then do something like this:

PHP Code:
$find '<div class="above_body">';
$output str_replace($find,$add_before.$find$output); 
If you do a search on str_replace here, or in google, you'll find several examples or how to use that.
Reply With Quote
  #3  
Old 08-02-2010, 03:46 PM
TheSupportForum TheSupportForum is offline
 
Join Date: Jan 2007
Posts: 1,158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is how far i have got and hope it worked, but i have done something wrong but dont now where

Code:
if ($vbulletin->options['ie6fix_onoff']){
$ie6fix = '<vb:if condition="$vboptions['ie6fix_onoff']">
{vb:rawphrase ie6fix_english}
</vb:if>';
$find = '<div class="above_body">';
$add_before = "$ie6fix". PHP_EOL;
$output = str_replace($find,$add_before.$find, $output);
}
i get this message

Parse error: syntax error, unexpected T_STRING in /home/ereptalk/public_html/includes/functions.php(6851) : eval()'d code on line 8

i know its my plugin but dont understand where it is wrong
Reply With Quote
  #4  
Old 08-03-2010, 03:45 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you are testing for whether the option is true already, then why are you wanting to test it again in the template? You should only need to test it in the plugin. And $output was just my example of a variable name, you probably want to use $vbulletin->templatecache['templatename'] instead.
Reply With Quote
  #5  
Old 08-03-2010, 05:25 AM
TheSupportForum TheSupportForum is offline
 
Join Date: Jan 2007
Posts: 1,158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
If you are testing for whether the option is true already, then why are you wanting to test it again in the template? You should only need to test it in the plugin. And $output was just my example of a variable name, you probably want to use $vbulletin->templatecache['templatename'] instead.
i dont understand, what do u mean
Reply With Quote
  #6  
Old 08-03-2010, 07:12 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This:

Code:
$add_before = "$ie6fix". PHP_EOL;

should be:

Code:
$add_before = '"$ie6fix". PHP_EOL';
Reply With Quote
  #7  
Old 08-03-2010, 10:09 AM
TheSupportForum TheSupportForum is offline
 
Join Date: Jan 2007
Posts: 1,158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
This:

Code:
$add_before = "$ie6fix". PHP_EOL;

should be:

Code:
$add_before = '"$ie6fix". PHP_EOL';
i still get this message
Parse error: syntax error, unexpected T_STRING in /home/ereptalk/public_html/includes/functions.php(6851) : eval()'d code on line 8


what i want to try do is create a customer template then insert this template into the headr do you know how to do that ?
Reply With Quote
  #8  
Old 08-03-2010, 10:40 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

raw phrases don't work with str_replaces like it did in vb 3. It would have to be done a whole different way.
Reply With Quote
  #9  
Old 08-03-2010, 12:14 PM
TheSupportForum TheSupportForum is offline
 
Join Date: Jan 2007
Posts: 1,158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
raw phrases don't work with str_replaces like it did in vb 3. It would have to be done a whole different way.
what i really need to do is now use an existing template in another template
i would like to call the template inside another
Reply With Quote
  #10  
Old 08-03-2010, 12:16 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would have to preregister the template you wanted to call.
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 06:15 AM.


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.04326 seconds
  • Memory Usage 2,264KB
  • Queries Executed 13 (?)
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_code
  • (1)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
  • (1)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_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
  • 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