Jump to content


- - - - -
Photo

Adding advertisements into your skin


Users often ask how to add advertisements into their community - this article is going to demonstrate how to add advertisements into common places, including only displaying to certain usergroups.
Note that you can of course add your advertisements in multiple places.

This article assumes that you have the HTML code you want to add - for example, if you are using Google Adsense, they will provide you with this code - have this ready.


Introduction to adding HTML code

To add advertisements into your community, you are going to edit the HTML templates that make up a skin.
We're going to edit each skin individually, so if you want to add advertisements to all skins, you'll need to repeat the process for each skin.

Go to Admin CP --> Look & Feel and click on the skin you wish to edit. You will now see on the left a group of skin template bits - clicking on any will expand into a sublist, and then clicking one of those will bring up a box with HTML code inside.
To add advertisements, you're going to add your HTML code into one of these template bits - which one will depend where you want your advertisements to display.

Only displaying advertisements to certain groups
If you only want your advertisements to display to certain groups, you'll need to wrap your HTML code in some special tags like this:

<if test="$this->memberData['member_group_id'] == X">
YOUR HTML CODE HERE
</if>

You should replace "X" with the group ID that should see the advertisements. If you want more than one group to see them, add more like so:

<if test="$this->memberData['member_group_id'] == X or $this->memberData['member_group_id'] == Y or $this->memberData['member_group_id'] == Z">
YOUR HTML CODE HERE
</if>
Note that is't just the same code separated by the word "or" - be sure to replace "X", "Y" and "Z" with group ID numbers. You can add even more if you need to by following the same pattern.
You can see the ID numbers for your groups by going to Admin CP --> Members --> Manage User Groups. The ID number for each group is shown in brackets next to the group name.


Global Header
Attached Image: global_header.png
To add your advertisements to the global header (so they display at the top of every page) edit the GlobalTemplates --> globalTemplate template bit, and add your code above this:
<div id='content' class='clear'>


Global Footer
Attached Image: global_footer.png
To add your advertisements to the global footer (so they display at the bottom of every page) edit the GlobalTemplates --> globalTemplate template bit, and add your code above this:
<div id='footer_utilities' class='clearfix clear rounded'>



1 Comments

Photo
Marcher Technologies
Dec 17 2011 09:15 PM
above code is flawed for checking groups.
<if test="IPSMember::isInGroup($this->memberData, array( 'X', 'Y', 'Z' ) )">
YOUR HTML CODE HERE
</if>
where X, Y, Z are the groups.

Developer Docs · Error Codes