Gal Lachiany Posted October 22, 2015 Share Posted October 22, 2015 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. Link to comment Share on other sites More sharing options...
Adriano Faria Posted October 22, 2015 Share Posted October 22, 2015 {{$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 More sharing options...
Gal Lachiany Posted October 23, 2015 Author Share Posted October 23, 2015 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.