chrisg777 Posted February 7, 2009 Share Posted February 7, 2009 Can someone tell me what I am missing on line 42 here: http://img.skitch.com/20090207-xutku993r166djtnc2a3748ec7.jpg I am new to codeing and trying to install a wordpress theme but this error keeps stopping it from working properly. Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/ Share on other sites More sharing options...
noober Posted February 7, 2009 Share Posted February 7, 2009 I'm no expert but an unexpected T_Variable means you're missing something like a semi-colon, closing quote, or brace. Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-756954 Share on other sites More sharing options...
Mchl Posted February 7, 2009 Share Posted February 7, 2009 You can paste your code here, just make sure you insert it into tags. noober's advice is correct. Check the previous PHP line, to see if you're not missing a semicolon there. Also do not use short PHP tags (<? ). Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-756974 Share on other sites More sharing options...
chrisg777 Posted February 7, 2009 Author Share Posted February 7, 2009 here is some of the code. It keeps telling me its line 42 but I dont see what the problem is. This is a free wordpress theme so i haven't written any of it. I know some coding but mostly just how to hack it apart not write it from scratch. Thanks in advance! 35 <li><strong><a href="<?php bloginfo('http://www.bradthrashin.com/wordpress'); ?>/feed/" title="RSS FEED"><span class="feed">RSS</span></a></strong></li><li> Feed Readers: <?php fs_getfeeds_button(); ?><a href="<?php bloginfo('url'); ?>/feed/" rel="nofollow">(Abonnieren!)</a></li> 36 <!-- end rss feed --> 37 </ul> 38 39 40 41 <div id="intro"><div style="width:600px;"><h1><a href="<?php bloginfo('url'); ?>">CHARLOTTENBURG</a><span class="white"> / <? 42 $random_text = array; ("Hello World", 43 "Welcome at home", 44 "You Know I'm No Good", 45 "A Less Ordinary Life", 46 "Wanna be your idol"); 47 srand(time()); 48 $sizeof = count($random_text); 49 $random = (rand()%$sizeof); 50 print("$random_text[$random]"); 51 ?>!</span></h1></div></div> Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-756981 Share on other sites More sharing options...
Mchl Posted February 7, 2009 Share Posted February 7, 2009 Start with changing <? in line 41 to <?php Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-756985 Share on other sites More sharing options...
chrisg777 Posted February 7, 2009 Author Share Posted February 7, 2009 at the end? did it but still no luck. Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-756991 Share on other sites More sharing options...
Mchl Posted February 7, 2009 Share Posted February 7, 2009 Oh my... I'm getting blind Line 42 should be $random_text = array("Hello World", so you had an extra semicolon, not a missing one Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-756994 Share on other sites More sharing options...
chrisg777 Posted February 7, 2009 Author Share Posted February 7, 2009 dangit I changed it but it still gives the error check it? 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> 3 4 <head profile="http://gmpg.org/xfn/11"> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 7 <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » <?php } ?> <?php wp_title(); ?></title> 8 9 <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats --> 10 11 <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> 12 <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" /> 13 <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 14 15 <?php wp_head(); ?> 16 </head> 17 <body> 18 <div id="outer"> 19 20 21 <ul id="menu"> 22 23 <!-- pages --> 24 25 <li class="page_item page-item-2"><a href="<?php bloginfo('url'); ?>" title="Blog">Blog</a></li> 26 <li class="page_item page-item-2"><a href="<?php bloginfo('url'); ?>/about/" title="About">About</a></li> 27 <li class="page_item page-item-329"><a href="<?php bloginfo('url'); ?>/work/" title="Work">Work</a></li> 28 <li class="page_item page-item-329"><a href="<?php bloginfo('url'); ?>/downloads/" title="Downloads">Downloads</a></li> 29 <li class="page_item page-item-329"><a href="<?php bloginfo('url'); ?>/photos/" title="Downloads">Photos</a></li> 30 <li class="page_item page-item-1029"><a href="<?php bloginfo('url'); ?>/contact/" title="Contact">Contact</a></li> 31 <!-- end pages --> 32 33 34 <!-- rss feed --> 35 <li><strong><a href="<?php bloginfo('http://www.bradthrashin.com/wordpress'); ?>/feed/" title="RSS FEED"><span class="feed">RSS</span></a></strong></li><li> Feed Readers: <?php fs_getfeeds_button(); ?><a href="<?php bloginfo('url'); ?>/feed/" rel="nofollow">(Abonnieren!)</a></li> 36 <!-- end rss feed --> 37 </ul> 38 39 40 41 <div id="intro"><div style="width:600px;"><h1><a href="<?php bloginfo('url'); ?>">CHARLOTTENBURG</a><span class="white"> / <?php 42 $random_text = array("Hello World", 43 "Welcome at home", 44 "You Know I'm No Good", 45 "A Less Ordinary Life", 46 "Wanna be your idol"); 47 srand(time()); 48 $sizeof = count($random_text); 49 $random = (rand()%$sizeof); 50 print("$random_text[$random]"); 51 ?>!</span></h1></div></div> 52 53 <div id="quote"><a href="http://www.rhymesayers.com/"><img src="<?php bloginfo('template_url'); ?>/images/72890.gif" alt="Werbung" width="728" height="90" /></a> 54 </div> 55 56 <!-- END HEADER --> Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-757002 Share on other sites More sharing options...
Mark Baker Posted February 7, 2009 Share Posted February 7, 2009 What are you trying to do with this line? $random = (rand()%$sizeof); Why not just use $random = rand(1,$sizeof) - 1; Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-757005 Share on other sites More sharing options...
Mchl Posted February 7, 2009 Share Posted February 7, 2009 Line 50 print($random_text[$random]); or print("{$random_text[$random]}"); Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-757007 Share on other sites More sharing options...
chrisg777 Posted February 7, 2009 Author Share Posted February 7, 2009 hmm changed line 50 but it still says line 42 has the error Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-757009 Share on other sites More sharing options...
chrisg777 Posted February 7, 2009 Author Share Posted February 7, 2009 uggg now it says this: Fatal error: Call to undefined function fs_getfeeds_button() in /var/www/vhosts/bradthrashin.com/httpdocs/wordpress/wp-content/themes/charlottenburg/header.php on line 35 Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-757013 Share on other sites More sharing options...
chrisg777 Posted February 7, 2009 Author Share Posted February 7, 2009 weird i was able to make it work after I took out all the stuff involving line 35. Thanks for the help guys! Link to comment https://forums.phpfreaks.com/topic/144239-syntax-error-unexpected-t_variable/#findComment-757058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.