Jump to content

How can I write straight PHP in a skin template?


seanzol

Recommended Posts

Posted

Please forgive me, as I'm sure this is a stupid question, but I couldn't find the right combo of search terms either on Google or here.

Previously, you could write a block of PHP by enclosing it in <php></php> tags, but now that doesn't seem to be the case, as it just spits out an HTML-commented copy of your code. What am I missing?

Posted

IPS4?

{{$time = time();}}

 

​Yes, IPS4, sorry!

Does that only work for one-line statements? It just spits out plaintext when I enclose a full code block.

Posted

It seems. If you perform a search in .phtml files, you'll see a lot of examples like that:

{{$idField = $comment::$databaseColumnId;}}
{{$itemClassSafe = str_replace( '\\', '_', mb_substr( $comment::$itemClass, 4 ) );}}

One line for each php line.

Can't you do it on your php file and pass via variable to the template ?

Posted

It seems. If you perform a search in .phtml files, you'll see a lot of examples like that:

{{$idField = $comment::$databaseColumnId;}}
{{$itemClassSafe = str_replace( '\\', '_', mb_substr( $comment::$itemClass, 4 ) );}}

One line for each php line.

Can't you do it on your php file and pass via variable to the template ?

Yeah, that's no big deal, it just seemed like an odd change to me. Thank you for your help :)

Archived

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

  • Recently Browsing   0 members

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