Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

conditional check template rendering errror


Reply


400 Views

Avatar
matt_misc

Community Member, 1 Post

8 September 2011 at 10:16pm

Hi

I have a gallery page that has_many gallery images as below

GalleryPage.php

   static $has_many = array(
      'GalleryImages' => 'GalleryImage'
   );

And on the gallery page I making a check that if there are GalleryPages existing then use the control gallery to render into a unordered list.

However when SS interprets the logic below (Code for rendering image stripped for testing) in GalleryPage.ss

GalleryPage.ss

      <% if GalleryImages %>
      
          <div>
                say hi
          </div>    

      <% end_if %>

I get an this unexplained hyphen appearing at the start of the HTML output which means the page gets no styling in IE,

-<!doctype html>

I have tried other conditional checks for in the if and the HTML renders as expected.

But at loss as to whether I am doing something wrong or if this is a bug. But also have the same problem when using

<% control GalleyImages %>

Any help would be much appreciated.

I am also using dataobject_manager if that helps

Cheers