Page 1 of 1

Where to insert ad code in CSS?

Posted: Wed Aug 15, 2012 3:01 pm
by lekrmpotich
My advertising partner requires that I insert this ad code under the title of my web site, sports-at-work.com. I know double-click isn't the best, but I don't rely on the front page for revenue and this partner helps increase traffic to my site substantially.

Can someone please tell me specifically where to insert the code in CSS? Thanks in advance for any help! -Luke

Extensions
Template Manager
gk_icki_sports
Edit CSS
...and then where after that?


<!-- begin 728x90 Top Sports-at-work -->
<script language="JavaScript" type="text/javascript">
window.dctile = Number(window.dctile) + 1 || 1;
window.dc_ord = Number(window.dc_ord) || Math.floor(Math.random() * 1E10);
if (dctile==1) {var vdcopt = 'ist';} else {vdcopt = '';}
if (17>dctile) document.write('<script type="text/javascript" src="http://ad.doubleclick.net/adj/yb.sports ... =pg;dcopt=' + vdcopt + ';yb=ad;s1=;s2=;tile=' + dctile + ';sz=728x90;ord=' + dc_ord + '?"><\/script>\n');
</script>
<!-- End ad tag -->

Re: Where to insert ad code in CSS?

Posted: Wed Aug 15, 2012 4:56 pm
by ws_machine
That code is not CSS, but you can place that in you index.php file for each theme that you are using.

Re: Where to insert ad code in CSS?

Posted: Thu Aug 16, 2012 7:56 pm
by lekrmpotich
Where exactly do I go to place that code? (i.e. where do I find the correct index.php file)

Sorry if this is a basic question, but this is my first time doing anything like this. I took over the site somewhat recently and am learning on the fly.

As I mentioned, the theme I'm using is gk_icki_sports.

Thanks for your help!

Re: Where to insert ad code in CSS?

Posted: Thu Aug 16, 2012 8:22 pm
by ws_machine
I do understand :) You can find that file in templates/gk_icki_sports/index.php
Search for </head> and place those codes just above it like in the example

Code: Select all

<!-- begin 728x90 Top Sports-at-work -->
<script language="JavaScript" type="text/javascript">
window.dctile = Number(window.dctile) + 1 || 1;
window.dc_ord = Number(window.dc_ord) || Math.floor(Math.random() * 1E10);
if (dctile==1) {var vdcopt = 'ist';} else {vdcopt = '';}
if (17>dctile) document.write('<script type="text/javascript" src="http://ad.doubleclick.net/adj/yb.sportsatwork/;chan1=gensports;rating=pg;dcopt=' + vdcopt + ';yb=ad;s1=;s2=;tile=' + dctile + ';sz=728x90;ord=' + dc_ord + '?"><\/script>\n');
</script>
<!-- End ad tag -->


</head>


Re: Where to insert ad code in CSS?

Posted: Thu Aug 16, 2012 10:23 pm
by lekrmpotich
Thanks, ws! That worked. However, I'd like it to be centered instead of aligned left. Any idea how to do that?

Re: Where to insert ad code in CSS?

Posted: Thu Aug 16, 2012 11:02 pm
by ws_machine
You may be able to center it by using the <center></center> tags. In this case though you will need to move the codes to the body tag.
You would instead find the <body> tag and below that add the codes so it would look like the following

Code: Select all

<body>

<center>

<!-- begin 728x90 Top Sports-at-work -->
<script language="JavaScript" type="text/javascript">
window.dctile = Number(window.dctile) + 1 || 1;
window.dc_ord = Number(window.dc_ord) || Math.floor(Math.random() * 1E10);
if (dctile==1) {var vdcopt = 'ist';} else {vdcopt = '';}
if (17>dctile) document.write('<script type="text/javascript" src="http://ad.doubleclick.net/adj/yb.sportsatwork/;chan1=gensports;rating=pg;dcopt=' + vdcopt + ';yb=ad;s1=;s2=;tile=' + dctile + ';sz=728x90;ord=' + dc_ord + '?"><\/script>\n');
</script>
<!-- End ad tag -->

</center>
You could use other means to center such as css styles or the ads code may offer a way to center.

Re: Where to insert ad code in CSS?

Posted: Thu Aug 16, 2012 11:34 pm
by lekrmpotich
Awesome, that did the trick. Thanks for your help!

Re: Where to insert ad code in CSS?

Posted: Fri Aug 17, 2012 12:47 am
by lekrmpotich
I have one last question. How can I make the ad appear only on the front page? I don't want it to appear on all article pages.

Thanks!

Re: Where to insert ad code in CSS?

Posted: Fri Aug 17, 2012 1:44 am
by ws_machine
Replace the codes above with the following should do what you need.

Code: Select all


<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {

?>
<center>

<!-- begin 728x90 Top Sports-at-work -->
<script language="JavaScript" type="text/javascript">
window.dctile = Number(window.dctile) + 1 || 1;
window.dc_ord = Number(window.dc_ord) || Math.floor(Math.random() * 1E10);
if (dctile==1) {var vdcopt = 'ist';} else {vdcopt = '';}
if (17>dctile) document.write('<script type="text/javascript" src="http://ad.doubleclick.net/adj/yb.sportsatwork/;chan1=gensports;rating=pg;dcopt=' + vdcopt + ';yb=ad;s1=;s2=;tile=' + dctile + ';sz=728x90;ord=' + dc_ord + '?"><\/script>\n');
</script>
<!-- End ad tag -->

</center>

<?php


}
?>

Re: Where to insert ad code in CSS?

Posted: Fri Aug 17, 2012 2:56 am
by lekrmpotich
Great, thanks for all the help--I'm impressed!