Saturday 1 December 2007

Ads within your category columns

From This:

To This:


Notice how the ad is in placed in the middle column of the category display. How I did this was to edit the homecatbox.php file which you will find in your theme 21 folder.

Open up homecatbox.php and locate the line $a = 0; immediately after add the line $ads = 0;

Now find:

echo "<div align='right'><a href='".get_category_link("name=".$category['name'])."'>More ".$category['name']." ".$category['type']." »</a></div>";

echo "
</div>
</div>
</td>";

Immediately after add:

if ($ads == 1) { // Set to the number of the position prior to the one you wish the ad to be placed e.g. for position 2 as in my pics I entered the number 1.
echo "<td width='".$width."%' valign='middle'>";
echo "
<div>

<center>";
echo 'YOUR AD CODE HERE';
echo "
</center>

</div>

</td>";
$a++;
$ads++;
}

Now this should work however I have done other modifications to this file and have had to take this out but I am confident it should still do the trick. As usual though, any problems just get in touch with me.

Also where you ad the code you could use a showad tag so that you are able to change the ad from the admin panel but I have started to remove this feature and hardwire the ads therefore I haven't done that.

10 comments:

Anonymous said...

i try it and it works fine ..thanks it's great ...
i will take a look at other hacks ..

thanks a lot !

Michael said...

You're welcome. Glad I could help.

Anonymous said...

thanks dear ,

but i want my site do not have three box it have 2 box only ( 21 theme )

i want add ads beside and category bos then add another ads down it

Michael said...

Hi Sam,

Not sure what you mean, do you want to only have 2 columns but add a 3rd for ads or do you wish to keep the 2 columns and have the ads in the left or right columns?

Anonymous said...

thanks Michael ...

see this images and you understand what i need ?

http://filaty.com/i/712/28ff635.1.GIF

and another placement

http://filaty.com/i/712/319bc87.2.GIF

I hope to find code to do this.

Anonymous said...

I wan't the same as sam. Please if you can help us

Michael said...

Hi Sam / Dem,

Apologies for not replying, I have been unavailable for nearly a year it would seem. Unfortunately life took over and my online life had to suffer.

I've had a look at Sam's pics and yes this could be done, its been a while since I've messed with Gamesitescript code though so I will need to have a look, what are your site addresses so I can take a look? Also what versions of the script are you using?

All the best.
Michael.

Anonymous said...

hello michael can you tell me how to add this mod to my script? i use gamesitescript 3.2 with awesome theme
thanks :)

Michael said...

Hi Mick,

Could try but its been some time since I worked with the GSS scripts, where are you stuck with it? What's your site address?

Anonymous said...

I run a GSS site, and I have spent alot of time publishing mods/tweaks and fixes for the script- There are also free games and content for it to you can see it all here Hopefully this will help many of you to maximize the script's potental and userability:

Free Mods/tweaks/hotfixes:
http://havocarcade.com/forum/viewforum.php?f=32

Free custom themes:
http://havocarcade.com/forum/viewforum.php?f=41

Free games and content:
http://havocarcade.com/forum/viewforum.php?f=33