Ad support for articles
authorAlexander Ebert <ebert@woltlab.com>
Sun, 24 Mar 2019 22:11:02 +0000 (23:11 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 24 Mar 2019 22:11:02 +0000 (23:11 +0100)
See #2707

com.woltlab.wcf/templates/article.tpl
com.woltlab.wcf/templates/articleListItems.tpl

index 9f1c05b944950aed8c0a546998a1151e4e29ef93..5ff3bb2659ea21ba34660c9b36d8fb152ec6d2c1 100644 (file)
        
        <div class="section articleContent" {@$__wcf->getReactionHandler()->getDataAttributes('com.woltlab.wcf.likeableArticle', $article->articleID)}>
                <div class="htmlContent">
+                       {if MODULE_WCF_AD}
+                               {@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.inArticle')}
+                       {/if}
+                       
                        {@$articleContent->getFormattedContent()}
                        
                        {event name='htmlArticleContent'}
index 410070a4233124ad1712f3a440cbc8af56a24cb2..0ac8920fc13fd418745042c643859f8d3e1b25be 100644 (file)
@@ -1,6 +1,8 @@
+{if !$disableAds|isset}{assign var='disableAds' value=false}{/if}
+
 <div class="contentItemList">
        {foreach from=$objects item='article'}
-               <article class="contentItem contentItemMultiColumn">
+               <article class="contentItem contentItemMultiColumn" role="article">
                        <a href="{$article->getLink()}" class="contentItemLink">
                                <div class="contentItemImage contentItemImageLarge" style="background-image: url({if $article->getImage()}{$article->getImage()->getThumbnailLink('medium')}{else}{$__wcf->getStyleHandler()->getStyle()->getCoverPhotoURL()}{/if})">
                                        {hascontent}
                                </div>
                        </div>
                </article>
+               
+               {if MODULE_WCF_AD && !$disableAds}
+                       {if $tpl[foreach][articles][iteration] === 1}
+                               {hascontent}
+                                       <div class="contentItem contentItemAd">
+                                               {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.after1stArticle')}{/content}
+                                       </div>
+                               {/hascontent}
+                       {else}
+                               {if $tpl[foreach][articles][iteration] % 2 === 0}
+                                       {hascontent}
+                                               <div class="contentItem contentItemAd">
+                                                       {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery2ndArticle')}{/content}
+                                               </div>
+                                       {/hascontent}
+                               {/if}
+                               
+                               {if $tpl[foreach][articles][iteration] % 3 === 0}
+                                       {hascontent}
+                                               <div class="contentItem contentItemAd">
+                                                       {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery3rdArticle')}{/content}
+                                               </div>
+                                       {/hascontent}
+                               {/if}
+                               
+                               {if $tpl[foreach][articles][iteration] % 5 === 0}
+                                       {hascontent}
+                                               <div class="contentItem contentItemAd">
+                                                       {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery5thArticle')}{/content}
+                                               </div>
+                                       {/hascontent}
+                                       
+                                       {if $tpl[foreach][articles][iteration] % 10 === 0}
+                                               {hascontent}
+                                                       <div class="contentItem contentItemAd">
+                                                               {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery10thArticle')}{/content}
+                                                       </div>
+                                               {/hascontent}
+                                       {/if}
+                               {/if}
+                       {/if}
+               {/if}
        {/foreach}
 </div>