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.

Customising the CMS /

Color-picker?


Reply


39 Posts   8219 Views

Avatar
MarFur93

Community Member, 4 Posts

1 July 2009 at 5:23pm

I am sorry to be a pain, though I am new to SilverStripe and am still trying to get my head around it.

a) Do I just extract all of the files to www/htdocs

and

b) Where do I put the following code?

$fields->addFieldToTab('Root.Content.Main', new ColorField('BgColor', 'Background Color'));

Cheers, Mark.

Avatar
banal

Community Member, 901 Posts

1 July 2009 at 7:21pm

Edited: 01/07/2009 7:21pm

Hi Mark

a) The colorpicker works like a SilverStripe module. Here's a documentation how modules should be installed: http://doc.silverstripe.com/doku.php?id=installing-modules (it also covers advanced topics like SVN checkout etc.)
In the case of the color picker the installation is as simple as extracting the archive and move the "colorpicker" directory to the SilverStripe folder. Or in other words: The colorpicker directory should be in the same folder where the cms, assets, sapphire folders reside (this could be your www/htdocs).

b) You would add this line of code to the getCMSFields method of the Page Class that has the BgColor. Here's a complete class listing for a "ColorPage":

<?php
class ColorPage extends Page
{
   public static $db = array(
      'BgColor' => 'Varchar(6)'
   );

   public function getCMSFields() {
      $fields = parent::getCMSFields();
      $fields->addFieldToTab('Root.Content.Main', new ColorField('BgColor', 'Background Color'));
      return $fields;
   }
}

class ColorPage_Controller extends Page_Controller
{
   
}

Avatar
MarFur93

Community Member, 4 Posts

1 July 2009 at 7:36pm

Thanks for your help.

Though I tried posting the code you mentioned at the top of mysite/code/page.php and it became blank, now when I have removed the code altogether it says the following:

Website Error
There has been an error

The website server has not been able to respond to your request.

Any help to at least get the website working again would be highly appreciated.

Cheers, Mark.

Avatar
banal

Community Member, 901 Posts

1 July 2009 at 7:41pm

Hi Mark

Well, the code I posted would belong in a new file called ColorPage.php. Please restore the original content of your Page.php file in order to get your website working again.

It seems like you lack basic knowledge about the workings of SilverStripe. I strongly suggest you complete all the six tutorials that can be found here: http://doc.silverstripe.com/doku.php?id=tutorials
It's well worth the time.

Good luck.

Avatar
MarFur93

Community Member, 4 Posts

1 July 2009 at 7:44pm

Edited: 01/07/2009 7:52pm

Thanks very much for your help, though the problem is that I have restored the page, and am still getting the error message.

Edit: I sorted the issue out.

Avatar
Mikan

Community Member, 17 Posts

19 December 2009 at 3:12am

Edited: 19/12/2009 3:12am

this module seems doesn't work with 2.3.4 here. I can't get it to work,

after uploaded the "colorpicker" folder to the SilverStripe Directory .

"
my site getting error "

Website Error
There has been an error

The website server has not been able to respond to your request."

then I created a new file ColorPage.php , uploaded it to mysite/code/ Directory,

still can not get my site back.

Any help to at least get the website working again would be highly appreciated.

Cheers, Mikan.

Avatar
banal

Community Member, 901 Posts

19 December 2009 at 3:18am

Hi Mikan

I can confirm that it works in SilverStripe 2.3.4.
1) Where did you download the Module?
2) Did you do a /dev/build?

Avatar
Mikan

Community Member, 17 Posts

19 December 2009 at 3:09pm

Hi, banal

1) Where did you download the Module?

firstly,I downloaded from this site http://www.eyecon.ro/colorpicker/ ( after uploaded to the directory, site got down)

secondly, I created a new files ColorPage.php, uploaded to the directory, site still down.

thirdly, I deleted all files from "colorpicker" folder and ColorPage.php . I downloaded a new zip file from this thread: http://silverstripe.org/customising-the-cms/show/257187?start=0#post261284

finally, I reuploaded the new "colorpicker" folder and ColorPage.php file to the site directory, my site still down.

2) Did you do a /dev/build?

I don't know how to do /dev/build. can you help me, can you create a new "ColorPage.php" file for me ?
how can I get my site Back to Live?

still has this errors "
Website Error
There has been an error

The website server has not been able to respond to your request."

Thanks