Jump to content

Ad: Custom location - within post?


Thomas P

Recommended Posts

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

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

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

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

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...