vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   what's wrong with this? (https://vborg.vbsupport.ru/showthread.php?t=221449)

AFemaleProdigy 08-22-2009 02:14 AM

what's wrong with this?
 
Hey everyone! I unfortunately have to work with someone else's coding on this new project. I get a parse error every time I try to put this into my headinclude. I don't know this type of code. Can anyone tell me what is wrong with it?

Thanks!

Code:

<script type="text/javascript">
    $(document).ready(function(){
  $('#mainMenu > li').hover( function() { $(this).addClass('hover') }, function() {$(this).removeClass('hover')});
    });
 </script>


Dismounted 08-22-2009 05:24 AM

Parse error when you try to save the template from vBulletin? Could you post the full error?

AFemaleProdigy 08-22-2009 11:26 AM

Sure. It gives me this error....

The following error occurred when attempting to evaluate the template 'headinclude':

Parse error: syntax error, unexpected '(', expecting T_VARIABLE or '$' in /var/www/vhosts/am-tech.org/httpdocs/community/includes/adminfunctions_template.php(3939) : eval()'d code on line 56

This is likely caused by a malformed conditional statement.

Dismounted 08-22-2009 11:46 AM

Ah, yes, I see the the error now. The vBulletin template parser is interpreting "$(this)" (+ others) as a PHP variable, which it is not. (The error is thrown because it contains characters that are deemed invalid in a PHP variable.) Try this instead:
HTML Code:

<script type="text/javascript">
    \$(document).ready(function(){
  \$('#mainMenu > li').hover( function() { \$(this).addClass('hover') }, function() {\$(this).removeClass('hover')});
    });
 </script>


AFemaleProdigy 08-22-2009 12:01 PM

Yeay!! That worked! Thanks so much! :D


All times are GMT. The time now is 04:17 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.01032 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete