jsmith1 Posted April 6, 2008 Posted April 6, 2008 Anybody know if I could put a java script inside my english/index.php file that randomizes pages or movies (I'm using .SWF flash files) I've tried it on an html file and it works perfectly, however I get this error when I put it inside the php file. Parse error: parse error, unexpected T_STRING in /home/content/j/s/m/jsmith1/html/test/includes/languages/english/index.php on line 26
germ Posted April 6, 2008 Posted April 6, 2008 The most common reason for that error is if you have single tick marks (') not preceded by a backslash. Like this: Let\'s see if we can\'t remove the parse errors That rule (backslash before single tick marks (')) applies even inside scripts when inside your /includes/languages/english/index.php If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
jsmith1 Posted April 6, 2008 Author Posted April 6, 2008 The most common reason for that error is if you have single tick marks (') not preceded by a backslash. Like this: Let\'s see if we can\'t remove the parse errors That rule (backslash before single tick marks (')) applies even inside scripts when inside your /includes/languages/english/index.php thanks for the reply! I'll post the code right now... I'm a little confused :[ --------------------------------------------------------------------------------------- define('TEXT_MAIN', 'This is a default setup of osCommerce Online Merchant. Products shown are for demonstrational purposes. <b>Any products purchased will not be delivered nor will the customer be billed</b>.<br> <script type="text/javascript"> swfFiles= new Array() //Set Flash sources, widths and heights swfFiles[0]=['main.swf', 770, 120 ] swfFiles[1]=['main_western.swf', 770, 120 ] swfFiles[2]=['pinball.swf', 770, 120 ] ////////////////No Need to Edit Below Here////////////// //Randomizing Unit Courtesy of Mike Winter as seen at: //http://www.dynamicdrive.com/forums/showthread.php?p=8442 function random(n) { return Math.floor((Math.random() % 1) * n); } Array.prototype.shuffle = function() {var i = this.length; while(i--) {this.swap(i, random(i + 1));} }; Array.prototype.swap = function(x, y) { var t = this[x]; this[x] = this[y]; this[y] = t; }; swfFiles.shuffle() //End Randomizing Unit document.write('\ <OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" \ CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" \ HEIGHT="'+swfFiles[0][2]+'" WIDTH="'+swfFiles[0][1]+'" ALIGN=""> \ <PARAM NAME="movie" VALUE="'+swfFiles[0][0]+'"> \ <PARAM NAME="quality" VALUE="high"> \ <embed src="'+swfFiles[0][0]+'" \ quality="high" \ pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" \ type="application/x-shockwave-flash" \ height="'+swfFiles[0][2]+'" width="'+swfFiles[0][1]+'"></embed> \ </object>\ ') </script> <noscript> <!-- Keep this tag --> <!-- Place Flash code for non javascript enabled browsers below --> <OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" HEIGHT="120" WIDTH="770" ALIGN=""> <PARAM NAME="movie" VALUE="zap.swf"> <PARAM NAME="quality" VALUE="high"> <embed src="zap.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" height="120" width="770"></embed> </object><!-- End non javascript Flash code --> </noscript><!-- Don't remove this tag -->
germ Posted April 6, 2008 Posted April 6, 2008 Following my rule, I came up with this. I did add the ending '); define('TEXT_MAIN', 'This is a default setup of osCommerce Online Merchant. Products shown are for demonstrational purposes. <b>Any products purchased will not be delivered nor will the customer be billed</b>.<br> <script type="text/javascript"> swfFiles= new Array() //Set Flash sources, widths and heights swfFiles[0]=[\'main.swf\', 770, 120 ] swfFiles[1]=[\'main_western.swf\', 770, 120 ] swfFiles[2]=[\'pinball.swf\', 770, 120 ] ////////////////No Need to Edit Below Here////////////// //Randomizing Unit Courtesy of Mike Winter as seen at: //http://www.dynamicdrive.com/forums/showthread.php?p=8442 function random(n) { return Math.floor((Math.random() % 1) * n); } Array.prototype.shuffle = function() {var i = this.length; while(i--) {this.swap(i, random(i + 1));} }; Array.prototype.swap = function(x, y) { var t = this[x]; this[x] = this[y]; this[y] = t; }; swfFiles.shuffle() //End Randomizing Unit document.write(\'\ <OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" \ CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" \ HEIGHT="\'+swfFiles[0][2]+\'" WIDTH="\'+swfFiles[0][1]+\'" ALIGN=""> \ <PARAM NAME="movie" VALUE="\'+swfFiles[0][0]+\'"> \ <PARAM NAME="quality" VALUE="high"> \ <embed src="\'+swfFiles[0][0]+\'" \ quality="high" \ pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" \ type="application/x-shockwave-flash" \ height="\'+swfFiles[0][2]+\'" width="\'+swfFiles[0][1]+\'"></embed> \ </object>\ \') </script> <noscript> <!-- Keep this tag --> <!-- Place Flash code for non javascript enabled browsers below --> <OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" HEIGHT="120" WIDTH="770" ALIGN=""> <PARAM NAME="movie" VALUE="zap.swf"> <PARAM NAME="quality" VALUE="high"> <embed src="zap.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" height="120" width="770"></embed> </object><!-- End non javascript Flash code --> </noscript><!-- Don\'t remove this tag --> '); If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
jsmith1 Posted April 6, 2008 Author Posted April 6, 2008 I get this on top of my page, like the code isn't closed t>\ \') ' . PROJECT_VERSION . ''); define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s'); define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products'); define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected'); if ( ($category_depth == 'products') || (isset($HTTP_GET_VARS['manufacturers_id'])) ) { define('HEADING_TITLE', 'Let\'s See What We Have Here'); define('TABLE_HEADING_IMAGE', ''); define('TABLE_HEADING_MODEL', 'Model'); define('TABLE_HEADING_PRODUCTS', 'Product Name'); define('TABLE_HEADING_MANUFACTURER', 'Manufacturer'); define('TABLE_HEADING_QUANTITY', 'Quantity'); define('TABLE_HEADING_PRICE', 'Price'); define('TABLE_HEADING_WEIGHT', 'Weight'); define('TABLE_HEADING_BUY_NOW', 'Buy Now'); define('TEXT_NO_PRODUCTS', 'There are no products to list in this category.'); define('TEXT_NO_PRODUCTS2', 'There is no product available from this manufacturer.'); define('TEXT_NUMBER_OF_PRODUCTS', 'Number of Products: '); define('TEXT_SHOW', 'Show:'); define('TEXT_BUY', 'Buy 1 \''); define('TEXT_NOW', '\' now'); define('TEXT_ALL_CATEGORIES', 'All Categories'); define('TEXT_ALL_MANUFACTURERS', 'All Manufacturers'); } elseif ($category_depth == 'top') { define('HEADING_TITLE', 'Welcome to Romanticies!'); } elseif ($category_depth == 'nested') { define('HEADING_TITLE', 'Categories'); } ?>
germ Posted April 6, 2008 Posted April 6, 2008 Post the code of the entire file, between CODE tags would be nice. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
jsmith1 Posted April 6, 2008 Author Posted April 6, 2008 <style type="text/css"> <!-- --> </style><?php /* $Id: index.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2007 osCommerce Released under the GNU General Public License */ define('TEXT_MAIN', 'Our romantic theme packages are designed to help you Celebrate Love - Renew Passion - Experience Intimacy - Energize Romance - Enhance Companionship - and Create Fun for you and that someone special!</b><br> <script type="text/javascript"> swfFiles= new Array() //Set Flash sources, widths and heights swfFiles[0]=[\'main.swf\', 770, 120 ] swfFiles[1]=[\'main_western.swf\', 770, 120 ] swfFiles[2]=[\'pinball.swf\', 770, 120 ] ////////////////No Need to Edit Below Here////////////// //Randomizing Unit Courtesy of Mike Winter as seen at: //http://www.dynamicdrive.com/forums/showthread.php?p=8442 function random(n) { return Math.floor((Math.random() % 1) * n); } Array.prototype.shuffle = function() {var i = this.length; while(i--) {this.swap(i, random(i + 1));} }; Array.prototype.swap = function(x, y) { var t = this[x]; this[x] = this[y]; this[y] = t; }; swfFiles.shuffle() //End Randomizing Unit document.write(\'\ <OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" \ CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" \ HEIGHT="\'+swfFiles[0][2]+\'" WIDTH="\'+swfFiles[0][1]+\'" ALIGN=""> \ <PARAM NAME="movie" VALUE="\'+swfFiles[0][0]+\'"> \ <PARAM NAME="quality" VALUE="high"> \ <embed src="\'+swfFiles[0][0]+\'" \ quality="high" \ pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" \ type="application/x-shockwave-flash" \ height="\'+swfFiles[0][2]+\'" width="\'+swfFiles[0][1]+\'"></embed> \ </object>\ \') </script> <noscript> <!-- Keep this tag --> <!-- Place Flash code for non javascript enabled browsers below --> <OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" HEIGHT="120" WIDTH="770" ALIGN=""> <PARAM NAME="movie" VALUE="zap.swf"> <PARAM NAME="quality" VALUE="high"> <embed src="zap.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" height="120" width="770"></embed> </object><!-- End non javascript Flash code --> </noscript><!-- Don\'t remove this tag --> <br><br>' . PROJECT_VERSION . '</b></font>'); define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s'); define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products'); define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected'); if ( ($category_depth == 'products') || (isset($HTTP_GET_VARS['manufacturers_id'])) ) { define('HEADING_TITLE', 'Let\'s See What We Have Here'); define('TABLE_HEADING_IMAGE', ''); define('TABLE_HEADING_MODEL', 'Model'); define('TABLE_HEADING_PRODUCTS', 'Product Name'); define('TABLE_HEADING_MANUFACTURER', 'Manufacturer'); define('TABLE_HEADING_QUANTITY', 'Quantity'); define('TABLE_HEADING_PRICE', 'Price'); define('TABLE_HEADING_WEIGHT', 'Weight'); define('TABLE_HEADING_BUY_NOW', 'Buy Now'); define('TEXT_NO_PRODUCTS', 'There are no products to list in this category.'); define('TEXT_NO_PRODUCTS2', 'There is no product available from this manufacturer.'); define('TEXT_NUMBER_OF_PRODUCTS', 'Number of Products: '); define('TEXT_SHOW', '<b>Show:</b>'); define('TEXT_BUY', 'Buy 1 \''); define('TEXT_NOW', '\' now'); define('TEXT_ALL_CATEGORIES', 'All Categories'); define('TEXT_ALL_MANUFACTURERS', 'All Manufacturers'); } elseif ($category_depth == 'top') { define('HEADING_TITLE', 'Welcome to Romanticies!'); } elseif ($category_depth == 'nested') { define('HEADING_TITLE', 'Categories'); } ?>
germ Posted April 6, 2008 Posted April 6, 2008 Get rid of this at the top: <style type="text/css"> <!-- --> </style> The very first line of the file should be: <?php If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
jsmith1 Posted April 6, 2008 Author Posted April 6, 2008 Get rid of this at the top: <style type="text/css"> <!-- --> </style> The very first line of the file should be: <?php Thanks! It works!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.