Jump to:

5541 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Color-picker?

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

Page: 1 2 3 4 5
Go to End
Author Topic: 7930 Views
  • MarFur93
    Avatar
    Community Member
    4 Posts

    Re: Color-picker? Link to this post

    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.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Color-picker? Link to this post

    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
    {
       
    }

  • MarFur93
    Avatar
    Community Member
    4 Posts

    Re: Color-picker? Link to this post

    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.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Color-picker? Link to this post

    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.

  • MarFur93
    Avatar
    Community Member
    4 Posts

    Re: Color-picker? Link to this post

    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.

  • Mikan
    Avatar
    Community Member
    17 Posts

    Re: Color-picker? Link to this post

    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.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Color-picker? Link to this post

    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?

  • Mikan
    Avatar
    Community Member
    17 Posts

    Re: Color-picker? Link to this post

    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

    7930 Views
Page: 1 2 3 4 5
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.