Jump to:

22970 Posts in 11572 Topics by 2823 members

General Questions

SilverStripe Forums » General Questions » Specialcharacters in cms (3.0.2)

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 514 Views
  • quanto
    Avatar
    Community Member
    79 Posts

    Specialcharacters in cms (3.0.2) Link to this post

    Hi all,

    I get some weird special characters when opening a cms page. See attachement

    I have already the latest update of Silverstripe (3.0.2) and FireBug has no Error in it.

    Attached Files
  • Juanitou
    Avatar
    Community Member
    322 Posts

    Re: Specialcharacters in cms (3.0.2) Link to this post

    Hi!

    This is the most strange thing I’ve ever seen with SilverStripe. These are not special characters, but escaped new lines (\n) and tabulators (\t). That could happen because the Ajax process responsible for updating of the CMS interface is not decoding the response, but I don’t have a clue about how to fix it.

    Good luck!
    Juan

  • quanto
    Avatar
    Community Member
    79 Posts

    Re: Specialcharacters in cms (3.0.2) Link to this post

    Yeah i've got the most strange error ever!

    However, I found out it's in particular Pagetype. The code:

    PhotoPagina.php:

    class PhotoPagina extends Page {

    public static $has_many = array(
    'Fotos' => 'Photo'
    );

    public function getCMSFields() {
       $fields = parent::getCMSFields();
          
    $gridFieldConfig = GridFieldConfig_RecordEditor::create();
    $gridfield = new GridField("Fotos", "Fotos", $this->Fotos(), $gridFieldConfig);
    $fields->addFieldToTab('Root.GalleryImages', $gridfield);

    return $fields;      
    }

    }
    class PhotoPagina_Controller extends Page_Controller {

       public static $allowed_actions = array (
       );

       public function init() {
          parent::init();
    Requirements::themedCSS('jquery-ui');
    Requirements::themedCSS('fotoalbum');
    Requirements::themedCSS('jquery-fancybox-1.2.6');
    Requirements::JavaScript('http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js');
    Requirements::JavaScript('themes/nkwa/javascript/fancybox/jquery.fancybox-1.2.6.pack.js');
    Requirements::JavaScript('themes/nkwa/javascript/vendor/fotoalbum.js');
       }
    ...
    }

    Photo.php

    class Photo extends DataObject {

    static $db = array(

    );
    static $has_one = array(
    'Plaatje' => 'Image',
    'FotoPagina' => 'PhotoPagina'   
    );

    public function getCMSFields() {
          $fields = parent::getCMSFields();
          $fields->removeFieldFromTab("Root.Main","PhotoPaginaID");
          return $fields;      
    }

    public static $summary_fields = array(
    'ID' => 'ID',
        'Thumbnail' => 'Thumbnail'
    );

    public function getThumbnail() {
    return $this->Image()->CMSThumbnail();
    }
    }

    I tried almost everything (by removing it) to fix it, but nothing did work out so far. I think it's something in the gridfieldconfig?

  • Juanitou
    Avatar
    Community Member
    322 Posts

    Re: Specialcharacters in cms (3.0.2) Link to this post

    Have you tried removing all the JavaScript requirements in PhotoPagina.php?

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Specialcharacters in cms (3.0.2) Link to this post

    Do you get any JS errors? Which browser? Does it happen on the default language (English US) as well?
    Which SilverStripe release are you running?

    Can you please view the XHR/Ajax request in Chrome's developer tools "Network" panel,
    right click on the entry, "save as HAR" and attach here? If its on a live server,
    please either remove all cookie data from it, or email me privately to ingo at silverstripe dot com.

  • alittletooquiet
    Avatar
    Community Member
    1 Post

    Re: Specialcharacters in cms (3.0.2) Link to this post

    We were having the same issue. In our case, the PHP files has the wrong text encoding.

    Compare the encoding of the PHP class files that are giving you the error with files that are not, and change the encoding accordingly.

    514 Views
Page: 1
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.