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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-17-2010, 10:03 PM
Booyakan Booyakan is offline
 
Join Date: Jan 2007
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Parse Error in Showthread help needed please

I am getting this error when I try to use my code below.. can anyone please help me fix it?

Parse error: syntax error, unexpected $end in home/xxx/xxx/showthread.php(2169) : eval()'d code(10) : eval()'d code on line 1

Parse error: syntax error, unexpected T_ENDIF in home/xxx/xxx/showthread.php(2169) : eval()'d code(12) : eval()'d code on line 1

Here is the code for the beginning of my showthread.

<head>
<if condition="in_array($thread['forumid'], array(22, 30, 31, 32, 33, 34)) AND !is_member_of($bbuserinfo, 6, 7, 10)">

<script type="text/javascript">ap_loaded = false;</script>
<script type="text/javascript" src="http://ad.leadbolt.net/show_cu.js?section_id=xxxx"></script>
<script type="text/javascript">if (!ap_loaded) { window.location = 'http://ad.leadbolt.net/adblock?section_id=xxxx'; }</script>

<?php if (strpos($_SERVER['HTTP_USER_AGENT'],'Googlebot') !== false) : ?>
<noscript><meta http-equiv="refresh" content="0;url='http://ad.leadbolt.net/noscript?section_id=xxxx'" /></noscript>
<?php endif ?>

</if>

$headinclude
Reply With Quote
  #2  
Old 12-17-2010, 10:14 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think the problem is in plugin code. It looks like hook location 'showthread_complete'. You might be able to look at the plugin manager and see which product it is.
Reply With Quote
  #3  
Old 12-17-2010, 10:42 PM
Booyakan Booyakan is offline
 
Join Date: Jan 2007
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I don't understand... I've never had this problem before until I put in this part of the code, and it's not a plugin. Could you please be more specific?

<script type="text/javascript">ap_loaded = false;</script>
<script type="text/javascript" src="http://ad.leadbolt.net/show_cu.js?section_id=xxxx"></script>
<script type="text/javascript">if (!ap_loaded) { window.location = 'http://ad.leadbolt.net/adblock?section_id=xxxx'; }</script>

<?php if (strpos($_SERVER['HTTP_USER_AGENT'],'Googlebot') !== false) : ?>
<noscript><meta http-equiv="refresh" content="0;url='http://ad.leadbolt.net/noscript?section_id=xxxx'" /></noscript>
<?php endif ?>
Reply With Quote
  #4  
Old 12-17-2010, 10:45 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh yeah, sorry, I'm wrong. I Jumped to that conclusion because that's the same error you get when a plugin has a problem, but you're right, it's obviously something in that template.

ETA: I don't use the :/endif thing so I'm not sure, but doesn't it need a ; after the endif?

BTW - are you even allowed to put php in a template like that?
Reply With Quote
  #5  
Old 12-17-2010, 11:25 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've never run across a php if statement in a template.

EDIT: I found where you missed it. Try this for the endif statement. You forgot the trailing ;

<?php endif; ?>
Reply With Quote
  #6  
Old 12-18-2010, 12:03 AM
Booyakan Booyakan is offline
 
Join Date: Jan 2007
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

I tried <?php endif; ?> and now the error changed just a bit to this... (I bolded the changes)

Parse error: syntax error, unexpected $end in home/xxx/xxx/showthread.php(2169) : eval()'d code(12) : eval()'d code on line 1

Parse error: syntax error, unexpected T_ENDIF in home/xxx/xxx/showthread.php(2169) : eval()'d code(14) : eval()'d code on line 1
Reply With Quote
  #7  
Old 12-18-2010, 12:16 AM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try getting rid of the red lines:
Code:
<head>
<if condition="in_array($thread['forumid'], array(22, 30, 31, 32, 33, 34)) AND !is_member_of($bbuserinfo, 6, 7, 10)">

<script type="text/javascript">ap_loaded = false;</script>
<script type="text/javascript" src="http://ad.leadbolt.net/show_cu.js?section_id=xxxx"></script>
<script type="text/javascript">if (!ap_loaded) { window.location = 'http://ad.leadbolt.net/adblock?section_id=xxxx'; }</script>

<?php if (strpos($_SERVER['HTTP_USER_AGENT'],'Googlebot') !== false) : ?>
<noscript><meta http-equiv="refresh" content="0;url='http://ad.leadbolt.net/noscript?section_id=xxxx'" /></noscript>
<?php endif ?>

</if>

$headinclude
Reply With Quote
  #8  
Old 12-19-2010, 07:54 AM
Booyakan Booyakan is offline
 
Join Date: Jan 2007
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That does work, but is there anyway I can still implement:

if (strpos($_SERVER['HTTP_USER_AGENT'],'Googlebot') !== false) :

I want to hide the no script section of my code from Googlebot.
Reply With Quote
  #9  
Old 12-19-2010, 08: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

This won't work?

<if condition="strpos($_SERVER['HTTP_USER_AGENT'],'Googlebot') !== false">
Reply With Quote
  #10  
Old 12-19-2010, 08:48 AM
Booyakan Booyakan is offline
 
Join Date: Jan 2007
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the suggestion, but it didn't work.... I got this when I clicked save.

The following template conditional expression contains function calls:

<if condition="strpos($_SERVER['HTTP_USER_AGENT'],'Googlebot') !== false">

Function Name Usage in Expression
strpos strpos($_SERVER['HTTP_USER_AGENT'],'Googlebot')

With a few exceptions, function calls are not permitted in template conditional expressions. Please go back and re-write this expression.

The following functions are allowed in template conditional expressions:
in_array() is_array() is_numeric() isset() empty() defined() array() can_moderate() can_moderate_calendar() exec_switch_bg() is_browser() is_member_of()
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 08:12 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.07035 seconds
  • Memory Usage 2,257KB
  • 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
  • (1)bbcode_code
  • (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