Jump to content

PHP in templates


Gal Lachiany

Recommended Posts

{{$var = 'something';}}

But you're not supposed to run queries on templates in 4.0. You better extend any file and display the results, like this.

<ips:template parameters="$comment" />
{{$date = \IPS\Member::loggedIn()->GetDateDifference( $comment->author()->joined );}}
<span data-ipsTooltip data-ipsTooltip-label="{lang="ejd_joined"}">
	<li class="ipsType_light{{if \IPS\Settings::i()->ejd_smallfonts}} ipsType_small{{endif}}"><i class="fa fa-sign-in fa-lg"></i> 
		{{if \IPS\Settings::i()->ejd_format == 1}}
			{datetime="$comment->author()->joined"}
		{{else}}
			{$date}
		{{endif}}
	</li>
</span>

On this plugin I exteded the \IPS\Members ( GetDateDifference ).

Link to comment
Share on other sites

On 22.10.2015, 16:17:35, Adriano Faria said:

{{$var = 'something';}}

But you're not supposed to run queries on templates in 4.0. You better extend any file and display the results, like this.


<ips:template parameters="$comment" />
{{$date = \IPS\Member::loggedIn()->GetDateDifference( $comment->author()->joined );}}
<span data-ipsTooltip data-ipsTooltip-label="{lang="ejd_joined"}">
	<li class="ipsType_light{{if \IPS\Settings::i()->ejd_smallfonts}} ipsType_small{{endif}}"><i class="fa fa-sign-in fa-lg"></i> 
		{{if \IPS\Settings::i()->ejd_format == 1}}
			{datetime="$comment->author()->joined"}
		{{else}}
			{$date}
		{{endif}}
	</li>
</span>

On this plugin I exteded the \IPS\Members ( GetDateDifference ).

I have no idea how to do it, you'll make me pay you?

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...