Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 18 Dec 2010, 00:03
Booyakan Booyakan is offline
 
Join Date: Jan 2007
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 18 Dec 2010, 00:14
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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 18 Dec 2010, 00:42
Booyakan Booyakan is offline
 
Join Date: Jan 2007
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 18 Dec 2010, 00:45
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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?

Last edited by kh99; 18 Dec 2010 at 01:01.
Reply With Quote
  #5  
Old 18 Dec 2010, 01:25
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
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 18 Dec 2010, 02:03
Booyakan Booyakan is offline
 
Join Date: Jan 2007
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 18 Dec 2010, 02:16
calorie calorie is offline
 
Join Date: May 2003
Try getting rid of the red lines:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #8  
Old 19 Dec 2010, 09:54
Booyakan Booyakan is offline
 
Join Date: Jan 2007
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 19 Dec 2010, 10:40
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
This won't work?

<if condition="strpos($_SERVER['HTTP_USER_AGENT'],'Googlebot') !== false">
Reply With Quote
  #10  
Old 19 Dec 2010, 10:48
Booyakan Booyakan is offline
 
Join Date: Jan 2007
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()

Last edited by Booyakan; 19 Dec 2010 at 10:59.
Reply With Quote
  #11  
Old 19 Dec 2010, 11:02
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Ah, okay. I've never tried doing it before. t was just an idea, albeit a bad one, it seems.
Reply With Quote
  #12  
Old 19 Dec 2010, 11:36
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
You can only use a small set of functions in conditionals (see the manual here): http://www.vbulletin.com/docs/html/m...n_conditionals (like the list in the error message)

So the way around that of course is to make a plugin for the code which sets a variable that you can check in your template.

Something I just noticed recently - you can actually allow other functions in templates (see the bottom user comment on the above page), but that also requires a plugin.

Last edited by kh99; 19 Dec 2010 at 11:46.
Reply With Quote
  #13  
Old 19 Dec 2010, 11:45
Booyakan Booyakan is offline
 
Join Date: Jan 2007
Ok I believe I got it, if there is another "right" way please someone let me know... but for anyone that wants to know, here is what I did and it seems to work.

It was fairly simple...I followed the instructions here and made a simple plugin.

Thanks for everyone that answered this post!

**Kh99 I saw your last post right after I got done figuring this out and posting on here! lol
Reply With Quote
  #14  
Old 19 Dec 2010, 11:50
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Aren't hooks great?
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 15:23.

Layout Options | Width: Wide Color: