Add ad support for articles
authorMatthias Schmidt <gravatronics@live.com>
Mon, 18 Mar 2019 15:08:30 +0000 (16:08 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 18 Mar 2019 15:08:30 +0000 (16:08 +0100)
Close #2707

com.woltlab.wcf/objectType.xml
com.woltlab.wcf/templates/article.tpl
com.woltlab.wcf/templates/articleListItems.tpl
com.woltlab.wcf/templates/boxArticleList.tpl
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 5c2d5844c2ee7f391fed2d51deb760fc83fd9473..8da42098fb9d6d3cb1c97931e849b81a5dff533a 100644 (file)
                        <categoryname>com.woltlab.wcf.global</categoryname>
                        <cssclassname>wcfAdLocationFooterBottom</cssclassname>
                </type>
+               <type>
+                       <name>com.woltlab.wcf.article.inArticle</name>
+                       <definitionname>com.woltlab.wcf.adLocation</definitionname>
+                       <categoryname>com.woltlab.wcf.article</categoryname>
+                       <cssclassname>wcfAdLocationInArticle</cssclassname>
+               </type>
+               <type>
+                       <name>com.woltlab.wcf.article.after1stArticle</name>
+                       <definitionname>com.woltlab.wcf.adLocation</definitionname>
+                       <categoryname>com.woltlab.wcf.article</categoryname>
+                       <cssclassname>wcfAdLocationArticleList wcfAdLocationAfter1stArticle</cssclassname>
+               </type>
+               <type>
+                       <name>com.woltlab.wcf.article.afterEvery2ndArticle</name>
+                       <definitionname>com.woltlab.wcf.adLocation</definitionname>
+                       <categoryname>com.woltlab.wcf.article</categoryname>
+                       <cssclassname>wcfAdLocationArticleList wcfAdLocationAfterEvery2ndArticle</cssclassname>
+               </type>
+               <type>
+                       <name>com.woltlab.wcf.article.afterEvery3rdArticle</name>
+                       <definitionname>com.woltlab.wcf.adLocation</definitionname>
+                       <categoryname>com.woltlab.wcf.article</categoryname>
+                       <cssclassname>wcfAdLocationArticleList wcfAdLocationAfterEvery3rdArticle</cssclassname>
+               </type>
+               <type>
+                       <name>com.woltlab.wcf.article.afterEvery5thArticle</name>
+                       <definitionname>com.woltlab.wcf.adLocation</definitionname>
+                       <categoryname>com.woltlab.wcf.article</categoryname>
+                       <cssclassname>wcfAdLocationArticleList wcfAdLocationAfterEvery5thArticle</cssclassname>
+               </type>
+               <type>
+                       <name>com.woltlab.wcf.article.afterEvery10thArticle</name>
+                       <definitionname>com.woltlab.wcf.adLocation</definitionname>
+                       <categoryname>com.woltlab.wcf.article</categoryname>
+                       <cssclassname>wcfAdLocationArticleList wcfAdLocationAfterEvery10thArticle</cssclassname>
+               </type>
                <!-- /ad locations -->
                <!-- ad conditions -->
                <type>
index e0ad68e213a98a44ede4c1140544a47942c6ab4c..824aec8d0b20c4677bd763e97424fd4d28a48554 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}
+                       
                        {if $articleContent->teaser}
                                <p class="articleTeaser">{@$articleContent->getFormattedTeaser()}</p>
                        {/if}
-               
+                       
                        {@$articleContent->getFormattedContent()}
                        
                        {event name='htmlArticleContent'}
index 5067b8e89d9a27465254a663fdb94b2630042ae3..22cfaf345a72286baf6ebd9f706233559d377096 100644 (file)
@@ -1,5 +1,7 @@
+{if !$disableAds|isset}{assign var='disableAds' value=false}{/if}
+
 <ul class="articleList">
-       {foreach from=$objects item='article'}
+       {foreach from=$objects item='article' name=articles}
                <li>
                        <a href="{$article->getLink()}">
                                {if $article->getTeaserImage() && $article->getTeaserImage()->hasThumbnail('tiny')}
                                {event name='articleListEntry'}
                        </a>
                </li>
+               
+               {if MODULE_WCF_AD && !$disableAds}
+                       {if $tpl[foreach][articles][iteration] === 1}
+                               {hascontent}
+                                       <li>
+                                               {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.after1stArticle')}{/content}
+                                       </li>
+                               {/hascontent}
+                       {else}
+                               {if $tpl[foreach][articles][iteration] % 2 === 0}
+                                       {hascontent}
+                                               <li>
+                                                       {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery2ndArticle')}{/content}
+                                               </li>
+                                       {/hascontent}
+                               {/if}
+                               
+                               {if $tpl[foreach][articles][iteration] % 3 === 0}
+                                       {hascontent}
+                                               <li>
+                                                       {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery3rdArticle')}{/content}
+                                               </li>
+                                       {/hascontent}
+                               {/if}
+                               
+                               {if $tpl[foreach][articles][iteration] % 5 === 0}
+                                       {hascontent}
+                                               <li>
+                                                       {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery5thArticle')}{/content}
+                                               </li>
+                                       {/hascontent}
+                               {/if}
+                               
+                               {if $tpl[foreach][articles][iteration] % 10 === 0}
+                                       {hascontent}
+                                               <li>
+                                                       {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery10thArticle')}{/content}
+                                               </li>
+                                       {/hascontent}
+                               {/if}
+                       {/if}
+               {/if}
        {/foreach}
 </ul>
index ac166e7b6d00c6da540617486973ab2a85b94737..c639d38c59caaea6481733314bc358869f1d997f 100644 (file)
@@ -51,5 +51,5 @@
                {/foreach}
        </ul>
 {else}
-       {include file='articleListItems' objects=$boxArticleList}
+       {include file='articleListItems' objects=$boxArticleList disableAds=true}
 {/if}
index ed1ca12705ba854d59b5c95a139d0e262c7e51e9..54e2ed0c238f23d241ab9997556943074cd7a262 100644 (file)
                <item name="wcf.acp.ad.location.com.woltlab.wcf.sidebar.bottom"><![CDATA[Sidebar (unten)]]></item>
                <item name="wcf.acp.ad.location.com.woltlab.wcf.footer.bottom"><![CDATA[Seitenende]]></item>
                <item name="wcf.acp.ad.showOrder.description"><![CDATA[Legt die Reihenfolge fest, in der die Werbungen angezeigt werden.]]></item>
+               <item name="wcf.acp.ad.location.category.com.woltlab.wcf.article"><![CDATA[Artikel]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.after1stArticle"><![CDATA[Nach dem ersten Artikel]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.afterEvery10thArticle"><![CDATA[Nach jedem 10. Artikel]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.afterEvery2ndArticle"><![CDATA[Nach jedem 2. Artikel]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.afterEvery3rdArticle"><![CDATA[Nach jedem 3. Artikel]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.afterEvery5thArticle"><![CDATA[Nach jedem 5. Artikel]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.inArticle"><![CDATA[Innerhalb des Artikels]]></item>
        </category>
        <category name="wcf.acp.application">
                <item name="wcf.acp.application.cookie"><![CDATA[Cookie-Einstellungen]]></item>
index 0d47ec7b0b3875778b8fcf6c9386dfb0da755c46..3c317844aad24ce6fa53f36c266dc70edfdf8bf2 100644 (file)
                <item name="wcf.acp.ad.location.com.woltlab.wcf.sidebar.bottom"><![CDATA[Sidebar (bottom)]]></item>
                <item name="wcf.acp.ad.location.com.woltlab.wcf.footer.bottom"><![CDATA[End of Page]]></item>
                <item name="wcf.acp.ad.showOrder.description"><![CDATA[Choose display order of ads.]]></item>
+               <item name="wcf.acp.ad.location.category.com.woltlab.wcf.article"><![CDATA[Articles]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.after1stArticle"><![CDATA[After the first article]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.afterEvery10thArticle"><![CDATA[After every 10. article]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.afterEvery2ndArticle"><![CDATA[After every 2. article]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.afterEvery3rdArticle"><![CDATA[After every 3. article]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.afterEvery5thArticle"><![CDATA[After every 5. article]]></item>
+               <item name="wcf.acp.ad.location.com.woltlab.wcf.article.inArticle"><![CDATA[In the article]]></item>
        </category>
        <category name="wcf.acp.application">
                <item name="wcf.acp.application.cookie"><![CDATA[Cookie Settings]]></item>