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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Specialcharacters in cms (3.0.2)


Go to End


6 Posts   1939 Views

Avatar
quanto

Community Member, 91 Posts

19 October 2012 at 12:30am

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
Avatar
Juanitou

Community Member, 323 Posts

19 October 2012 at 11:03am

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

Avatar
quanto

Community Member, 91 Posts

19 October 2012 at 8:07pm

Edited: 19/10/2012 8:08pm

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?

Avatar
Juanitou

Community Member, 323 Posts

19 October 2012 at 10:04pm

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

Avatar
Ingo

Forum Moderator, 801 Posts

30 October 2012 at 12:48pm

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.

Avatar
alittletooquiet

Community Member, 1 Post

11 August 2013 at 7:10am

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.