Daniweb Style First Post To Accomodate Advertisements

TheBigK

Well-known member
I like the way Daniweb has modified the first post to accomodate the 300x250 px advertisement. I wish to know whether we can do the same in XF. I'm sure lot of XF owners would benefit from it.

Here's how it looks -

Screen Shot 2012-01-15 at 2.29.38 PM.webp
 
It shows there's a div for the ad, inside the div for the msg. Both are set as a block, and the ad is float:right; .. The blocks will leave each other alone.
 
If you're using my previous code you're going to want to modify the following CSS:

Code:
.messageList .message.indent .messageInfo.primaryConent .bbCodeBlock
{
margin-right:; 
}

Just modify the margin-right value till you get what you want.
 
Add this to the message template, below the <li> tag:

Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0">
<div class="right_block">
<!-- Ad code here -->
</div>
</xen:if>

Add this to the extra.css template:

Code:
.messageList .message:first-child .messageInfo.primaryContent { margin-right: 310px; }
 
.messageList .message:first-child .right_block
{
float:right;
height:250px !important;
width:300px !important;
}
Question: How can I get the ads to not show up in Conversations?
 
I'm going to annoy you with three more questions:
  1. How can I get the text to wrap around the ad? As it stands right now, the right side has a buffer of 310px all the way down to the end of the post (including the area where it says "Like Reply Share".
  2. I can get the ads to only show for guests, but I can't get the 310px buffer to go away for logged-in members.
  3. How can I format it to look nicer like the IGN ads?Screen shot 2012-06-14 at 3.33.22 PM.webp
 
I'm going to annoy you with three more questions:
  1. How can I get the text to wrap around the ad? As it stands right now, the right side has a buffer of 310px all the way down to the end of the post (including the area where it says "Like Reply Share".
  2. I can get the ads to only show for guests, but I can't get the 310px buffer to go away for logged-in members.
  3. How can I format it to look nicer like the IGN ads?View attachment 30563

The gap is intentional and part of the ad layout. To do what you want there is an ad template you can use (I think anyways).

Add <xen:if is="!{$visitor.user_id}"> </xen:if> around the CSS and ad code in the template.

This is a different style of ad layout, but you can use .right_block to style the ad block. You will need to take margin and padding into account the CSS code however.
 
The gap is intentional and part of the ad layout. To do what you want there is an ad template you can use (I think anyways).

Add <xen:if is="!{$visitor.user_id}"> </xen:if> around the CSS and ad code in the template.

This is a different style of ad layout, but you can use .right_block to style the ad block. You will need to take margin and padding into account the CSS code however.

Hmmm. That gap is creating a problem with signatures.

I'm having the same problem that TheBigK was having with the <xen:if is> code. It's working in the template, but not in extra.css.

That last sentence was written in Latin, I'm sure. I am not all that great at CSS, but I have a Master's degree in Copy n' Paste.
 
Hello, problkem with this code.

Advertisement displayed to ALL private message :

1dCJK.jpg


Private message use template "message" ?

How correct that please ?

My code :

HTML:
        <xen:hook name="message_content" params="{xen:array 'message={$message}'}">
...
                    <!-- Z - Publicité droite premiers message -->
                        <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$xenOptions.XenCrea_Ads_AddonActive} == 1 AND {$xenOptions.XenCrea_Ads_AdsForRegisterMember} == 0">
                            <div id="firstMessageRightBloc">
                                <div class="firstMessageRightBlocLabel">{$xenOptions.XenCrea_Ads_Title}</div>
                                <div class="firstMessageRightBlocAds">{$xenOptions.XenCrea_Ads_Script}</div>
                            </div>
 
                            <div class="messageContent messageContentFirstPostMinHeight">
                        <xen:else/>
                            <div class="messageContent">
                        </xen:if>
                    <!-- /Z -->
 
        <!-- Z REMOVE <div class="messageContent"> -->
 
            <article>
 
...

Possible to add conditional topic page please ? :)

Example:
if($currentPage == Thread)
{
// Display adv.
}
 
Top Bottom