gaspower Posted October 21, 2012 Share Posted October 21, 2012 Hello Need some help please with this file. I am geting the error (T_CONSTANT_ENCAPSED_STRING) on the following line below. I know it has to due with escaping, but I can not seem to be able to place (\) in the correct postitions. $data = '<div><script type="text/javascript">document.write('<scr');document.write('ipt type="text/javascript" data-ppmnid="43423" src="//ad.where.com/jin/spotlight/ads?pubid=05693f&format=js&v=2.4&placementtype=120x240&ppmnid=43423&rand=' + Math.round(Math.random() * 100000000000000) + '">');document.write('</scr' + 'ipt>');</script></div>'; Original File: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ class bm_paypal { var $code = 'bm_paypal'; var $group = 'boxes'; var $title; var $description; var $sort_order; var $enabled = false; function bm_paypal() { $this->title = MODULE_BOXES_PAYPAL_TITLE; $this->description = MODULE_BOXES_PAYPAL_DESCRIPTION; if ( defined('MODULE_BOXES_PAYPAL_STATUS') ) { $this->sort_order = MODULE_BOXES_PAYPAL_SORT_ORDER; $this->enabled = (MODULE_BOXES_PAYPAL_STATUS == 'True'); $this->group = ((MODULE_BOXES_PAYPAL_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right'); } } // BOF MTS function dataF() { $data = '<div><script type="text/javascript">document.write('<scr');document.write('ipt type="text/javascript" data-ppmnid="43423" src="//ad.where.com/jin/spotlight/ads?pubid=05693f&format=js&v=2.4&placementtype=120x240&ppmnid=43423&rand=' + Math.round(Math.random() * 100000000000000) + '">');document.write('</scr' + 'ipt>');</script></div>'; return $data; } function execute() { global $oscTemplate; $oscTemplate->addBlock($this->dataF(), $this->group); } // EOF MTS function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_BOXES_PAYPAL_STATUS'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable paypal Module', 'MODULE_BOXES_PAYPAL_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_PAYPAL_CONTENT_PLACEMENT', 'Left Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_PAYPAL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_BOXES_PAYPAL_STATUS', 'MODULE_BOXES_PAYPAL_CONTENT_PLACEMENT', 'MODULE_BOXES_PAYPAL_SORT_ORDER'); } } ?> Thanks JR Quote Link to comment https://forums.phpfreaks.com/topic/269741-help-with-t_constant_encapsed_string/ Share on other sites More sharing options...
Pikachu2000 Posted October 21, 2012 Share Posted October 21, 2012 You've used single quotes to enclose the string, so any occurrence of a single quote within the string must be escaped by preceding it with a backslash. Quote Link to comment https://forums.phpfreaks.com/topic/269741-help-with-t_constant_encapsed_string/#findComment-1386774 Share on other sites More sharing options...
gaspower Posted October 21, 2012 Author Share Posted October 21, 2012 Hello Pikachu200, That explanation was perfect for someone like me to understand. All is working perfect. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/269741-help-with-t_constant_encapsed_string/#findComment-1386779 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.