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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Themes /

Discuss SilverStripe Themes.

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

Images not appearing in Gallery


Go to End


16 Posts   6289 Views

Avatar
RobboNoCash

Community Member, 33 Posts

26 August 2015 at 1:41pm

Hi

Here is some code from my template, none of the images are appearing on the web page.
Does anyone know what the error is ?

Thank you

<% loop Picture %>
<div class="row service-list">
<div class="col-md-2 tp-service-block"><!-- tp Service Block Start-->
<div class="tp-thumb-pic"><!--service pic start -->
<a class="fancybox" rel="example_group" href="$Picture.URL"> <img class="img-responsive" src="$PictureSmall.URL" alt=""> </a>
</div>
</div>
<% end_loop %>

Avatar
RobboNoCash

Community Member, 33 Posts

2 September 2015 at 12:13pm

Can some body please help,
The message before is the template
and this is the Page class

Thanks

<?php
class Gallery extends Page {
private static $db = array(
'Heading' => 'Text'
);

public static $many_many = array(
'Picture' => 'Image',
'PictureSmall' => 'Image'
);

public function getCMSFields() {
$f = parent::getCMSFields();

$f->addFieldToTab('Root.Main', new TextField('Heading'), 'Content');

$f->addFieldToTab("Root.Images", new UploadField('Picture'));
$f->addFieldToTab("Root.Images", new UploadField('PictureSmall'));

return $f;

}

}

class Gallery_Controller extends Page_Controller {
}

Avatar
helenclarko

Community Member, 166 Posts

2 September 2015 at 2:02pm

Hi RobboNoCash,

You have had replies to this on the first topic you posted.

Have you tried the suggestions in the other topic?

http://www.silverstripe.org/community/forums/all-other-modules/show/104768#post405322#post405322

-helenclarko

Avatar
RobboNoCash

Community Member, 33 Posts

2 September 2015 at 2:25pm

Hi

Thanks for your reply, yes the first topic works, the fields now appear in the admin console.
This is a different error the pictures are not appearing on the web page, $Picture.URL and $PictureSmall.URL are not working from the page class?

Thanks

Avatar
RobboNoCash

Community Member, 33 Posts

9 September 2015 at 12:05pm

Can somebody please help me fix this error.

Thanks

Avatar
helenclarko

Community Member, 166 Posts

9 September 2015 at 12:33pm

Edited: 09/09/2015 12:36pm

Hi RobboNoCash,

Can you add the following to your template and check if it prints the URL.

<% loop Picture %>
	$Picture.URL
<% end_loop %>
<% loop PictureSmall %>
	$PictureSmall.URL
<% end_loop %>

-helenclarko

Avatar
RobboNoCash

Community Member, 33 Posts

9 September 2015 at 1:09pm

Hi helenclarko

Thanks for your reply.
I tried what you said and no it did not print the URL
Any other ideas?

Thanks

Avatar
helenclarko

Community Member, 166 Posts

9 September 2015 at 1:17pm

Hi RobboNoCash,

What is the name of your template file?

-helenclarko

Go to Top