Jump to content

Archived

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

gaspower

OSC 2.31 Add Paypal Bill Me Later To Box

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

Share this post


Link to post
Share on other sites

Hello Multimixer,

 

First wanted to say I use your template system and it is great.. Thank you.

 

I removed all the quotes, and I still get the same error, crashes page.

 

Thanks JR

Share this post


Link to post
Share on other sites

Sorry,

I think I misunderstood meaning of "escape". You mean to use "/". Is there a link you can send me to understand the escape process?

 

JR

Share this post


Link to post
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>'

Share this post


Link to post
Share on other sites

×