17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1230 Views |
-
Setting Up Additional Images to a Page

2 May 2008 at 2:06pm
Hi Guys,
Can I say first silverstripe rocks, what an awesome piece of software to work
with!! Totally blown away.OK MY PROBLEM
One of programmers set this site up sometime ago and can't remember what
he did - It may be an additional modification he has installed ( gallery maybe )Anyways it works fine but currently it only allows you to add two images
to a "project" page. I need to make this a total of 5 images.
These images are different to the ones you can add via the main editor
and are displayed to the left of the page content not within the $content.These are out putted like..
$Photo1.SetWidth(150)
$Photo2.SetWidth(150)If this gives any clues as to the modification he may have added.
So what I need to DO....
SEE ATTACHED IMAGE FOR REFERENCE
FIG 2, shows the backend - I need to make this 5 images boxes instead
of only two it currently lets you add.FIG 1, I then want to add another 3 images Im guess I do that simply
$Photo1.SetWidth(150)
$Photo2.SetWidth(150)
$Photo3.SetWidth(150)
$Photo4.SetWidth(150)
$Photo5.SetWidth(150)Many Thanks for your help in advance.
P.S also any suggestions or built in function to make the fullsize image popup
if click from the front end?.. this isnt a major tho.Sefton
Brandstudio
-
Re: Setting Up Additional Images to a Page

2 May 2008 at 5:31pm
OK I found the solution myself and added this below.
I HAD TO ADD THE ADDITIONAL 3 PHOTOS TO THE BELOW ARRAY "projectpage.php" type page not holder.
static $has_one = array(
'Photo1' => 'Image',
'Photo2' => 'Image',
'Photo3' => 'Image', <-- HERE
'Photo4' => 'Image', <-- HERE
'Photo5' => 'Image' <-- HERE
);
function getCMSFields() {
$fields = parent::getCMSFields();THEN ALSO ADD ANOTHER 3 ROWS HERE
$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo1'));
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo2'));
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo3')); <-- HERE
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo4')); <-- HERE
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo5')); <-- HERE
return $fields;
}
} -
Re: Setting Up Additional Images to a Page

2 May 2008 at 5:47pm
That would work. Don't forget to run db/build?flush=1
| 1230 Views | ||
|
Page:
1
|
Go to Top |


