by
1,011 21
0
6
2,647
1
Top 1% !
Popular
Famous
Tagged
Specified
OpenSource
Popularity: 5845th place
Created
Modified Aug 6, 2014

Published on:

LanguageSilverstripe
LanguageText
LicenseMIT_X11

Add Image Gallery to Page

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/114608/Add-Image-Gallery-to-Page?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
<?php class PortfolioItem extends Page { private static $db = array( 'TrailerVideoURL' => 'Text', ); private static $has_many = array( 'Still' => 'Image' ); function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab( 'Root.Upload', $uploadField = new UploadField( $name = 'GalleryImages', $title = 'Upload one or more images (max 10 in total)' ) ); $uploadField->setAllowedMaxFileNumber(10); return $fields; } } class PortfolioItem_Controller extends Page_Controller { } class GalleryImageExtension extends DataExtension { private static $belongs_one_many = array('Galleries' => 'GalleryPage'); } Image::add_extension('GalleryImageExtension');
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus