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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Banners on silverstripe


Go to End


10 Posts   3631 Views

Avatar
HanSolo

Community Member, 87 Posts

31 July 2008 at 9:23pm

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

Community Member, 87 Posts

1 August 2008 at 8:51pm

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

Joakim

Avatar
Fuzz10

Community Member, 791 Posts

1 August 2008 at 9:59pm

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

Avatar
HanSolo

Community Member, 87 Posts

5 August 2008 at 12:48am

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

Community Member, 87 Posts

7 August 2008 at 12:52am

Anyone got some ideas on that?

Avatar
Fuzz10

Community Member, 791 Posts

7 August 2008 at 1:00am

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

Avatar
HanSolo

Community Member, 87 Posts

7 August 2008 at 4:01am

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

Community Member, 791 Posts

7 August 2008 at 10:20am

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