Jump to content

Query logged in and after first post


mark007

Recommended Posts

Posted

I have a few questions that are probably easy to answer:

How is the query for whether a user is logged in or not? I would like to place something directly in the template - depending on whether the user is logged in or not.

How can I get the 1st post? Reason: If 1st post, then an ad should be inserted under it.

I would like to insert an ad (under the function custom locations) directly after the first post of a topic and on the following pages after the first post, taking into account the responsive css classes:

<div class='ipsResponsive_showDesktop ipsResponsive_block'>
  This element will *only* show on desktop sizes, and will render as a block-level element.
</div>

How would the code be as a whole and where do I have to paste this into the template system?

Many, many thanks in advance !! Sorry, I really have to refresh my english.

Mark

Posted

Thank you for your support, but it does not work with regard to the 1st post.

It is the template "post", where you can find this:

{{if $comment->mapped('first') }}
				<a href='{$comment->item()->url()}' data-ipsTooltip title='{lang="share_this_post"}' data-ipsMenu data-ipsMenu-closeOnClick='false' id='elSharePost_{$comment->$idField}' data-role='shareComment'><i class='fa fa-share-alt'></i></a>
			TESST{{else}}
				<a href='{$comment->item()->url()->setQueryString( array( 'do' => 'findComment', 'comment' => $comment->$idField ) )}' data-ipsTooltip title='{lang="share_this_post"}' data-ipsMenu data-ipsMenu-closeOnClick='false' id='elSharePost_{$comment->$idField}' data-role='shareComment'><i class='fa fa-share-alt'></i></a>
			{{endif}}

So when I insert the word "TESST" as above, there are two problems:

1. it only appears in and not after the first post

2 it does not appear after the first entry on the following pages in the same topic

Is there a solution?

Many thanks !!!

Mark

 

Posted

You're going to need to look further at the template as

$comment->mapped('first')

appears multiple times - your result is to be expected as that is where you've put the word.

I also linked to the wrong topic last night - perils of being tired:

That one has additional information in it point you in the right direction - few items of code in there to use as a reference,

Posted
10 hours ago, Nathan Explosion said:

 

You're going to need to look further at the template as


$comment->mapped('first')

appears multiple times - your result is to be expected as that is where you've put the word.

 

Hmmm ... I have testet it, but even if I put the word at the absolutely end it will appear in and not after the 1st post.

Bildschirmfoto 2016-11-30 um 19.54.16.png

Ist the template topic -> post the wrong one?

 

Posted

But what is the query for logged in or not logged in?

On 29.11.2016 at 8:06 PM, mark007 said:

How is the query for whether a user is logged in or not? I would like to place something directly in the template - depending on whether the user is logged in or not.

If you could post the query it would be great!

Archived

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

  • Recently Browsing   0 members

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