Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

OSC 2.31 Add Paypal Bill Me Later To Box


gaspower

Recommended Posts

Hello

 

I am trying to add Paypal Bill Me Later banner code to a box I created, but when I add the script code, it breaks the site.

 

Current Working Code:

function dataF() {
 $data = '<div class="img"><img src="/images/dealers-175.gif"></div>';

return $data;
}
function execute() {
 global $oscTemplate;
 $oscTemplate->addBlock($this->dataF(), $this->group);
}

 

Changed To:

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);
}

 

Thanks JR

Link to comment
Share on other sites

Like multimixer says.

The escape character is the back-slash, not the forward-slash. Your $data string is within single-quotes. But the string itself contains single-quotes, and this is confusing php. So each of them, that is within the string, must be preceded by a back-slash

 

.'<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>'

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...