Jump to content

PHP in templates


Gal Lachiany

Recommended Posts

Posted

How use PHP in Templates (for example: gstats)
I tried to make SQL execution and get some info from Database but <php> and {php} are not working.
Let me know how can I use PHP tags and functions inside of your templates.

Thanks You Guys.

Posted
{{$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 ).

Posted
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?

Archived

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

  • Recently Browsing   0 members

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