Thomas P Posted March 6, 2018 Share Posted March 6, 2018 Hi folks, how can I put an advertisement within a post in a topic? I want to use an Ad Custom Location and it should show a rectangle within a post, next to the post text, i.e. on the right. Thanks for helping, Thomas Link to comment Share on other sites More sharing options...
Thomas P Posted March 10, 2018 Author Share Posted March 10, 2018 Hi mates, a hint how to place a simple rectangle picture within a post would be very helpful Thanks in advance, Thomas Link to comment Share on other sites More sharing options...
Nathan Explosion Posted March 10, 2018 Share Posted March 10, 2018 Start you off with a template hack.....edit the Forums -> Front -> Topics -> Post template, locate the following: {$comment->content()|raw} and replace it with: <div style="float:left"> {$comment->content()|raw} </div> <div style="float:right">TEST</div> That puts in all posts...there are several topics on here about how to display items in the first post only, or every x posts and all that. Give the divs a class, and then move the floats in to css and you can style away. Link to comment Share on other sites More sharing options...
Thomas P Posted March 10, 2018 Author Share Posted March 10, 2018 Thanks Nathan, now I know where to start. I tried the following to no avail: <div style="float:left"> {$comment->content()|raw} </div> {{if $postCount == 1}} <div style="float:right">TEST</div> {{endif}} I doesn't show the "TEST"-part... I wonder why. Using this one -completely different logic- works though. <div style="float:left"> {$comment->content()|raw} </div> {{if !isset(request.page) or request.page == 1}} <div style="float:right">TEST</div> {{endif}} Is it because it isn't after the first post? ?? Link to comment Share on other sites More sharing options...
Thomas P Posted March 13, 2018 Author Share Posted March 13, 2018 Is there any documentation which variable are valid in which location? I guess I cannot use $postCount in the post-Template, since there is no result rendered... ?? I did not find it here, here or here. I found this promising add-on, but it is from 2011... Thank you for any helpful advice, Thomas Link to comment Share on other sites More sharing options...
opentype Posted March 13, 2018 Share Posted March 13, 2018 8 minutes ago, Thomas P said: Is there any documentation which variable are valid in which location? There is a big “Variables …” button above the template editor window. It shows which variables are fed into the template you have opened. Link to comment Share on other sites More sharing options...
Nathan Explosion Posted March 13, 2018 Share Posted March 13, 2018 Is $postCount a variable that you have created yourself? If so, then it will work depending on what you've passed as that variable ($postCount isn't a variable available by default, hence the question) But if you are trying to do "1st post only" then the answer is also in the template I guided you to.... {{if $comment->mapped('first') }} {{endif}} Link to comment Share on other sites More sharing options...
Thomas P Posted March 13, 2018 Author Share Posted March 13, 2018 Thanks & Danke opentype. Thank you Nathan, that works - I didn't know what I should look for, I found $postCount in other templates and was on the wrong path. Honestly the code you mentioned wouldn't come in my mind. I owe you one ?? Link to comment Share on other sites More sharing options...
Thomas P Posted March 14, 2018 Author Share Posted March 14, 2018 Here is the working result: <!-- rectangle ad --> {{if $comment->mapped('first')}} <div style="float:right;margin-left:25px;margin-bottom:25px;">{advertisement="RectangleInPost"}</div> {$comment->content()|raw} {{else}} {$comment->content()|raw} {{endif}} <!-- // rectangle ad --> This works perfect and shows up in the first post in the upper right corner. Now I need to figure out how to show it in the 11, 21, 31st post in a topic ? Thanks, Thomas Link to comment Share on other sites More sharing options...
mark007 Posted March 14, 2018 Share Posted March 14, 2018 I really would have a solution to show ad in the first post but after first paragraph. Because this is the optimal position.... Link to comment Share on other sites More sharing options...
Nathan Explosion Posted March 14, 2018 Share Posted March 14, 2018 8 hours ago, mark007 said: I really would have a solution to show ad in the first post but after first paragraph. Because this is the optimal position.... So inside the actual content itself? Link to comment Share on other sites More sharing options...
mark007 Posted March 14, 2018 Share Posted March 14, 2018 1 hour ago, Nathan Explosion said: So inside the actual content itself? yes ... Link to comment Share on other sites More sharing options...
Nathan Explosion Posted March 14, 2018 Share Posted March 14, 2018 3 hours ago, mark007 said: yes ... OK - that's achievable but the problem then is that it is part of the content - quoting a post will result in the advertisement being part of the quote. If I can figure out another way of achieving the addition of the ad to the content that avoids that side effect then I will put out a plugin and post it here.....no post from me = no plugin (yet) Link to comment Share on other sites More sharing options...
mark007 Posted March 15, 2018 Share Posted March 15, 2018 7 hours ago, Nathan Explosion said: If I can figure out another way of achieving the addition of the ad to the content that avoids that side effect then I will put out a plugin and post it here This would be great ? Link to comment Share on other sites More sharing options...
Thomas P Posted March 16, 2018 Author Share Posted March 16, 2018 On 3/14/2018 at 8:31 AM, Thomas P said: Now I need to figure out how to show it in the 11, 21, 31st post in a topic ? If someone has an idea to show content in the 11 and x post, I would be thankful. {{if $comment->mapped('first')}} I guess this is the part which should be modified, a pity that it isn't numeric... Link to comment Share on other sites More sharing options...
Nathan Explosion Posted March 16, 2018 Share Posted March 16, 2018 {{$postCount =++$_REQUEST[ $item->tid . '_counter' ];}} {{if($postCount === 1 OR $postCount === 3 OR $postCount === 5)}} BLAH!!!! {{endif}} Link to comment Share on other sites More sharing options...
Thomas P Posted March 16, 2018 Author Share Posted March 16, 2018 Thanks Nathan ? Link to comment Share on other sites More sharing options...
Nathan Explosion Posted March 20, 2018 Share Posted March 20, 2018 On 15/03/2018 at 6:08 AM, mark007 said: This would be great ? See gif.....proof of concept done, moving on to some settings now. Link to comment Share on other sites More sharing options...
mark007 Posted March 21, 2018 Share Posted March 21, 2018 By the way, I am really excited ?It ist very cool ... the optimal Adsense location Link to comment Share on other sites More sharing options...
mark007 Posted March 25, 2018 Share Posted March 25, 2018 @Nathan Explosion This community has done that ... and it is so much better CTR and active view. ? (this is desktop view, but it is more significant when using a smartphone) Link to comment Share on other sites More sharing options...
Nathan Explosion Posted March 25, 2018 Share Posted March 25, 2018 That's nice...why are you tagging me and letting me know though? On 14/03/2018 at 10:31 PM, Nathan Explosion said: no post from me = no plugin (yet) When it's ready, it will be released. Link to comment Share on other sites More sharing options...
mark007 Posted March 25, 2018 Share Posted March 25, 2018 49 minutes ago, Nathan Explosion said: That's nice...why are you tagging me and letting me know though? No special intention, I just saw that and wanted to let you know, because I saw that you don't follow this topic ? Link to comment Share on other sites More sharing options...
Nathan Explosion Posted March 30, 2018 Share Posted March 30, 2018 Pending approval: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.