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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Questions on added ImageField and Login/Lost Password Templates

Go to End

4 Posts   1646 Views


3 Posts

7 November 2007 at 1:57pm

Okay I have two questions to ask -

First and foremost, I followed the second tutorial, extending a basic site, and at the bottom it talks about adding a "Staff" section with an associated image for each page. I've followed this tutorial and inserted the $Photo variable into my template/theme. However, if there isn't a photo that is defined when creating that page, the $Photo variable prints:

"<img src="/build/assets/" alt="" />", which results in a broken link. I'd like to prevent this, what's the best way?

Also, my second question, if I want to change the layout for the Lost Password and Log in pages what do I do? Do i create, for example, a and a in my Layout folder?



Forum Moderator, 628 Posts

7 November 2007 at 2:25pm

You should be able to use the "if" construct in the templates, which is mentioned in the tutorials?


3 Posts

7 November 2007 at 2:28pm

Yes if what though? doing <% if $Photo %> translates to:

<% if <img src="/build/assets/" alt="" /> %>
Which results in an error.


Community Member, 231 Posts

8 November 2007 at 9:58am

You don't need the $ - it's <% if Photo %>