1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Please donate today & help us with our growing server costs or buy premium for access to our premium products
    Dismiss Notice

Free Advertisement after the first post

Discussion in 'Xenforo Template Mods & Extras' started by HAWK, Mar 21, 2016.

  1. HAWK

    HAWK Administrator Staff Member ADMIN

    Likes Received:
    580
    Trophy Points:
    113
    Gender:
    Male
    I've included three variants that you can choose from. First, follow these general steps:
    1. In the template called message add to the end:
      Code:
      <xen:include template="adsense_post" />
    2. Create a new template called adsense_post
    3. Fill adsense_post with code from one of the three variants, replace placeholders with your own information where necessary.
    Note: If you want the ad to be shown to everybody (not just guests), change <xen:if is="{$post.position} == 0 AND !{$visitor.user_id}"> to <xen:if is="{$post.position} == 0">


    I haven't extensively tested this and only got it to recently work.

    -------------------------------------------------------------------------------------------

    Ads appear without user information
    Code:
    <xen:if is="{$post.position} == 0 AND  !{$visitor.user_id}">
        <li class="message">
    
            <div class="messageUserInfo"></div>
    
            <div class="messageInfo primaryContent">
                <div class="messageContent">
                    <blockquote class="messageText ugc baseHtml">
                        GOOGLE ADSENSE CODE GOES HERE
                    </blockquote>
                </div>
            </div>
        </li>
    </xen:if>

    Ads appear posted by a fake user
    Code:
    <xen:if is="{$post.position} == 0 AND !{$visitor.user_id}">
        <li class="message">
    
            <div class="messageUserInfo">
                <div class="messageUserBlock">
                    <div class="avatarHolder"><span class="avatar  av2m"><img  src="http://a3.twimg.com/profile_images/1090883135/xf_reasonably_small.png"  width="96px" height="96px"></span></div>
    
                    <h3 class="userText">
                        Google
                        <em class="userTitle" itemprop="title">Adsense</em>
                    </h3>
    
                    <span class="arrow"><span></span></span>
                </div>
            </div>
    
           <div class="messageInfo primaryContent">
                <div class="messageContent">
                    <blockquote class="messageText ugc baseHtml">
                        GOOGLE ADSENSE CODE GOES HERE
                    </blockquote>
                </div>
               </div>
           </li>
    </xen:if>

    Ads appear posted by thread starter
    Code:
    <xen:if is="{$post.position} == 0 AND !{$visitor.user_id}">
        <li class="message">
    
            <xen:include template="message_user_info">
                <xen:map from="$message" to="$user" />
            </xen:include>
    
            <div class="messageInfo primaryContent">
                <div class="messageContent">
                    <blockquote class="messageText ugc baseHtml">
                        GOOGLE ADSENSE CODE GOES HERE
                    </blockquote>
                </div>
             </div>
        </li>
    </xen:if>
     

Share This Page