Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Banners on silverstripe


Go to End
Reply

10 Posts   2986 Views

Avatar
HanSolo

31 July 2008 at 9:23pm Community Member, 83 Posts

Hi I been trying to figue out how to put banners on my homepage. I enrolled with a banner affiliate program, they generated some javascript code. I tried to implement the code in page.ss but then i foundout that there should not be any code in that page.

How would the best way to implement the javascript code be?

The code looks like this.

script type="text/javascript"
var uri = 'http://imp.tradedoubler.com/imp?type(js)pool(281627)a(1545256)' + new String (Math.random()).substring (2, 11);
document.write('<sc'+'ript type="text/javascript" src="'+uri+'" charset="ISO-8859-1"></sc'+'ript>');
/script

Avatar
HanSolo

1 August 2008 at 8:51pm Community Member, 83 Posts

Any got a clue on this I searched the forum but have not find any answer that made me understand it.

Joakim

Avatar
Fuzz10

1 August 2008 at 9:59pm Community Member, 787 Posts

It doesn't work if you just put the code in your template for the homepage ?

Avatar
HanSolo

5 August 2008 at 12:48am Community Member, 83 Posts

Shall i put the javascript in the folder sapphire/javascript?
And how do I include it inthe pages, as an include in the templates?

Joakim

Avatar
HanSolo

7 August 2008 at 12:52am Community Member, 83 Posts

Anyone got some ideas on that?

Avatar
Fuzz10

7 August 2008 at 1:00am Community Member, 787 Posts

Try pasting your piece of script in the appropriate template (e.g. homepage.ss).

Avatar
HanSolo

7 August 2008 at 4:01am Community Member, 83 Posts

when i insert it on the page.ss i will get an error about xml not wellformated
but if i delete the
document.write('<sc'+'ript type="text/javascript" src="'+uri+'" charset="ISO-8859-1"></sc'+'ript>');
then i will not receive an error so i guess it something wrong with this part document.write('<sc'+'ript

How would be the best way to solve this?

Avatar
Fuzz10

7 August 2008 at 10:20am Community Member, 787 Posts

Hmmm... weird... Never had that before...

Try to place it in a CDATA block...

e.g. :

<script>
<![CDATA[

your script here ....
]]>
</script>

Go to Top