1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.


Discussion in 'General XenForo Discussion and Feedback' started by greenchicken, Oct 30, 2012.

  1. greenchicken

    greenchicken Member

    I intended to use my license on my large forum (1.1 mil posts @32k members) But decided to use it for a smaller sports forum I have.

    I love the way Xen moves, it's fast , it's clean and the mods are fairly easy once you learn the curve. I like every thing about XEN except the advertising options and that is the only thing I see that vb has you beat...
    I prefer a simple way to do things by usergroup... That's just me...
    I don't run advertising on my sports forum so it's not a big deal but I have to run advertising on my larger one .
    I would love a hands off mod that allows the customer to buy an empty spot and upload their own ad and url to it... (that would be sweet) :)

    I have made alot of money on advertising and still do quite well in this economy and would love to use this on my big site but I need more versatility and less template edits especially if I have to go do it all over again when an upgrade is needed...

    Please spend more time on this section and I will gladly use XEN on my big forum because I really do like the software..

  2. Chris D

    Chris D XenForo Developer Staff Member

    Would you like to explain specifically what you're trying to achieve? I've not heard this feedback before so perhaps there's a couple of misconceptions. There's plenty of things that make placing advert codes easy. There are template edits but its usually just a copy and paste job into templates specially designed for the purpose. There's also various advert management systems.

    Let us know specifics. Hopefully we can help.
    Jake Bunce likes this.
  3. greenchicken

    greenchicken Member

    I pretty much like the way vb4 handles adverts
    inside first and or last post or both and which usergroup sees them without template edits
    Would like a system that sticks even if I have to upgrade the forum...
    I like control that I can put anything about anywhere by usergroup , Now I am sure that I am missing alot of what this software can do because I am new to it
  4. Chris D

    Chris D XenForo Developer Staff Member

    Then honestly instead of giving up just ask for help :)

    The usergroup conditionals are easy as are placing adverts in certain positions. It is different to vbulletin but not necessarily worse and the end result is identical.

    Also the changes stick even after forum upgrades, what makes you think they won't?

    I can help you with some actual code but I'm on my mobile right now so maybe I can provide some help later.
    Jake Bunce and greenchicken like this.
  5. Chris D

    Chris D XenForo Developer Staff Member

    In the meantime you might want to log on to your customer account http://xenforo.com/customers and go to the forum users section, in case you haven't done this already.
  6. greenchicken

    greenchicken Member

    I am just new to the system , I am not bashing this software because I like it... I will get used to it and when I feel comfortable using it I may use it for my big site... Just gonna take time I guess, I am older than most here so it takes a while longer for things to stick in my brain I guess.
  7. Chris D

    Chris D XenForo Developer Staff Member

    I know you're not bashing it.

    Let's see if I can be a bit of help...

    Firstly, editing templates.

    You are correct to a certain extent. It isn't always recommended to edit templates. But template edits are not lost after upgrades. Changes you make to templates will always be left untouched. If XenForo update that template in an upgrade, the template will be marked as "outdated" but your changes remain active. So, in that case, template edits aren't always a great idea.

    This, however, doesn't apply to ad templates.

    Ad templates are templates which the XenForo developers have deliberately left blank. As they are blank, they will never be updated by XenForo and therefore they will never become outdated, therefore as long as the template name begins with ad_ they are completely safe to edit.

    You can find a list of ad templates by doing the following:
    1. Log in to Admin CP
    2. Click the Appearance navigation tab
    3. Click Templates in the left menu
    4. In the "Filter Items" field type: ad_ and click prefix match
    These will display all templates that start with ad_. These templates have been specifically reserved for the purpose of ads.
    Some may contain a line such as <xen:hook name="ad_message_below" /> just ignore this (but don't delete it) and insert any code you need above or below that line.
    The names are usually descriptive of the location.
    So it sounds like you want to display an ad in messages. Let's deal with that first.
    So if you use Google Ads and the code they give you is as follows (it would look very different to this):
    <br />
    <center><img src="https://www.google.com/help/hc/images/adsense_185666_adformat-display_728x90_en.jpg" /></center>
    <br />
    You would simply paste that code in the ad_message_below template, and et voila, your threads look like this:
    Ok... not ideal.
    But that's how easy it is. This won't be lost when the forum is upgraded.
    That displays the ad after every single post and to all members.
    Let's make it so it only displays after the first post...
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0">
    	<br />
    	<center><img src="https://www.google.com/help/hc/images/adsense_185666_adformat-display_728x90_en.jpg" /></center>
    	<br />
    Post position "0" is the first post in the thread. By adding the "messagesPerPage" part, this sets the advert to appear after the first post on each page. You don't necessarily need to understand that in detail, that's just what it does.

    If you display 20 posts per page and you want to show the ad after the first post and last post on each page...

    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 OR {$post.position} % {$xenOptions.messagesPerPage} == 19">
    	<br />
    	<center><img src="https://www.google.com/help/hc/images/adsense_185666_adformat-display_728x90_en.jpg" /></center>
    	<br />
    This shows to all users still.

    Let's say you want to show the ads to everyone except staff (user groups 3 and 4) and perhaps to a premium/paid usergroup you've created which in this example is user group ID 5:
    <xen:if is="!{xen:helper ismemberof, $visitor, 3, 4, 5}">
    	<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 OR {$post.position} % {$xenOptions.messagesPerPage} == 14">
    		<br />
    		<center><img src="https://www.google.com/help/hc/images/adsense_185666_adformat-display_728x90_en.jpg" /></center>
    		<br />
    You've now got a very quick and easy method to display adverts in specific locations within threads to specific usergroups.

    This might be a lot to take in, but it works. It's a shame to delay this working on your large sites. There's many people who haven't got a clue what any of this means and they make do and make their XenForo sites successful and functional just by simply asking how things could be achieved.

    You will always get quick answers here, and if adverts in certain positions, hidden from certain usergroups was your only reason to delay putting this on your larger site then maybe that's problem solved. If not, try it out and feel free to ask more questions. If there's anything you don't understand I will be happy to help.

    Vicki, Kim, lazer and 7 others like this.
  8. Shelley

    Shelley Well-Known Member

    Amazing and helpful support as always Chris.
    Chris D likes this.

Share This Page