Jump to content

Recommended Posts

Posted

I'm looking to add the following code to a template:

{{$date = \IPS\DateTime::ts( strtotime( $movie->release_date ) );}}
     <div class="date1">{datetime="$date"}</div>

The idea is to only show the release date of a movie on a specific page ID - in this instance it would be page-id='15' I'm presuming that this needs to be wrapped in an {{if}} statement, but the syntax goes above my level of understanding of IPS code.

With thanks for any assistance.

Posted

@Martin A. Many thanks for that, but unfortunately this is not an IPS Pages app so that code will not work.

I'm presuming the code snippet for the movies for the release date to show is:

{{if $movie->status == 'Released'}}
<li class="ipsDataItem">
<span class="ipsDataItem_generic ipsDataItem_size3"><strong>{lang="movie_release_date"}</strong></span>
{{$date = \IPS\DateTime::ts( strtotime( $movie->release_date ) );}}
<span class="ipsDataItem_generic">{datetime="$date"}</span>
</li>
{{endif}}

I need an extra parameter to show that only on a certain page, in this instance page 15.

With thanks

Posted (edited)
<body class="ipsApp ipsApp_front ipsJS_none ipsClearfix" data-controller="core.front.core.app"  data-message=""  data-pageapp="movies" data-pagelocation="front" data-pagemodule="movies" data-pagecontroller="browse" data-pageid="15"   >

Try this:

{{if \IPS\Request::i()->app =='movies AND \IPS\Request::i()->id =='15'}}

{{endif}}

Or if the template is part of the movies app itself, then just this:

{{if \IPS\Request::i()->id =='15'}}

{{endif}}
Edited by Nathan Explosion
  • Recently Browsing   0 members

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