Where to insert ad code in CSS?

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Locked
lekrmpotich
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sat Jul 14, 2012 6:57 pm

Where to insert ad code in CSS?

Post by lekrmpotich » Wed Aug 15, 2012 3:01 pm

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

ws_machine
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 100
Joined: Sun Jun 14, 2009 12:43 am
Contact:

Re: Where to insert ad code in CSS?

Post by ws_machine » Wed Aug 15, 2012 4:56 pm

That code is not CSS, but you can place that in you index.php file for each theme that you are using.
http://westernstudios.net - Joomla Tutorials, components, services
http://westernstudios.net/product/ws-jo ... bscription - Joomla Subscription Component

lekrmpotich
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sat Jul 14, 2012 6:57 pm

Re: Where to insert ad code in CSS?

Post by lekrmpotich » Thu Aug 16, 2012 7:56 pm

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!

ws_machine
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 100
Joined: Sun Jun 14, 2009 12:43 am
Contact:

Re: Where to insert ad code in CSS?

Post by ws_machine » Thu Aug 16, 2012 8:22 pm

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>

http://westernstudios.net - Joomla Tutorials, components, services
http://westernstudios.net/product/ws-jo ... bscription - Joomla Subscription Component

lekrmpotich
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sat Jul 14, 2012 6:57 pm

Re: Where to insert ad code in CSS?

Post by lekrmpotich » Thu Aug 16, 2012 10:23 pm

Thanks, ws! That worked. However, I'd like it to be centered instead of aligned left. Any idea how to do that?

ws_machine
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 100
Joined: Sun Jun 14, 2009 12:43 am
Contact:

Re: Where to insert ad code in CSS?

Post by ws_machine » Thu Aug 16, 2012 11:02 pm

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.
http://westernstudios.net - Joomla Tutorials, components, services
http://westernstudios.net/product/ws-jo ... bscription - Joomla Subscription Component

lekrmpotich
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sat Jul 14, 2012 6:57 pm

Re: Where to insert ad code in CSS?

Post by lekrmpotich » Thu Aug 16, 2012 11:34 pm

Awesome, that did the trick. Thanks for your help!

lekrmpotich
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sat Jul 14, 2012 6:57 pm

Re: Where to insert ad code in CSS?

Post by lekrmpotich » Fri Aug 17, 2012 12:47 am

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!

ws_machine
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 100
Joined: Sun Jun 14, 2009 12:43 am
Contact:

Re: Where to insert ad code in CSS?

Post by ws_machine » Fri Aug 17, 2012 1:44 am

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


}
?>
http://westernstudios.net - Joomla Tutorials, components, services
http://westernstudios.net/product/ws-jo ... bscription - Joomla Subscription Component

lekrmpotich
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sat Jul 14, 2012 6:57 pm

Re: Where to insert ad code in CSS?

Post by lekrmpotich » Fri Aug 17, 2012 2:56 am

Great, thanks for all the help--I'm impressed!


Locked

Return to “Joomla! 1.5 Coding”