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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Duplicate links in album page


Go to End


5 Posts   1347 Views

Avatar
sajok

Community Member, 82 Posts

8 February 2010 at 2:28pm

hello,

I have installed the Image gallery module in a multilingual website with Arabic as the default. I created two albums in cms in Arabic names, and when I view them in front-end both album's names get the same url like : mysite.com/gallery/album/-
when I renamed albums to English, each album get it own url like: mysite.com/gallery/album/album1, mysite.com/gallery/album/album2 .. so it seems that Arabic characters are not recognized by the script, and instead they are replaced by a dush for both album names. I checked the tables collation and they are set to utf8..

anyone knows how to correct this?! I appreciate your help..

Avatar
MarcusDalgren

Community Member, 288 Posts

9 February 2010 at 1:55am

This is not an Image gallery module problem, the problem is how the CMS handles page title conversion to URL:s. If you're writing pages in a language that doesn't have English characters in it then you will have to give these pages an URL yourself on the Metadata tab.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

9 February 2010 at 3:22am

That's exactly right, Smurkas. It looks like we will have to add a custom album url segment to this module to handle the roman character counterpart of the title.

Avatar
sajok

Community Member, 82 Posts

9 February 2010 at 3:55am

@samukas, thank you for replying.. I created a page "gallery-page" and it has the Metadata tab option, whereas sublinks "albums" their links are generated by taking the album name as the url, and I can't see any Metadata option like the parent page!
@UncleCheese: that's exacly what we need, a custom url option like in parent pages. Now I have album names in arabic and link to the same page, I would appreciate if there is a fix for now..

Thank you

Avatar
sajok

Community Member, 82 Posts

9 February 2010 at 2:35pm

Edited: 09/02/2010 2:48pm

hello,

ok, this is what I did to add a custom segment url to handle the roman character counterpart of the arabic title:
I added a database field and a textfield to managed it in the cms. The generateURLSegment() function now takes AlbumURL value instead of AlbumName value.

../image_gallery/code/ImageGalleryAlbum.php :

<?php

class ImageGalleryAlbum extends DataObject
{
	static $db = array (
		'AlbumName' => 'Varchar(255)',
		'AlbumURL' => 'Varchar(255)',     //  added new database field
		'Description' => 'Text'
	);
	
....
....
....
public function getCMSFields_forPopup()
{
return new FieldSet(
	new TextField('AlbumName', _t('ImageGalleryAlbum.ALBUMTITLE','Album Title')),
  new TextField('AlbumURL', _t('ImageGalleryAlbum.ALBUMURL','Album URL')),    // added new textfield  
	new TextareaField('Description', _t('ImageGalleryAlbum.DESCRIPTION','Description')),
	new ImageField('CoverImage',_t('ImageGalleryAlbum.COVERIMAGE','Cover Image'))
		);
	}
	
....
....
....
	function onBeforeWrite()
	{
		parent::onBeforeWrite();
		if(isset($_POST['AlbumURL'])) {   // 'AlbumName' replaced with 'AlbumURL'
		  $clean_name = SiteTree::generateURLSegment($_POST['AlbumURL']);     // 'AlbumName' replaced with 'AlbumURL'
			if($this->FolderID) {
				$this->Folder()->setName($clean_name);
				$this->Folder()->Title = $clean_name;
....
....
....
?>

So far this works fine for me. I'm not sure however if it's the best way. I'm waiting for UncleCheese to confirm.

thanks
Said