21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 650 Views |
-
If more than 3 images in control

29 June 2009 at 5:34am
This displays all images in a control:
<% control CarouselImages %>
<img src="$Image.URL" alt="$Caption.ATT" />
<% end_control %>But I only want to do a conditional to check if there are more than 3 images:
<% if CarouselImages >3 %>
<h1>There are more than three images!</h1>
<% end_if %> -
Re: If more than 3 images in control

29 June 2009 at 5:56pm
You cannot do that in the templates. You would need to write a snippet of PHP
function Carousel() {
if($this->CarouselImages()) { if($this->CarouselImages()->TotalItems() > 3) return "Too Many"; }
return $this->CarouselImages();
}
| 650 Views | ||
|
Page:
1
|
Go to Top |


