7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Duplicate links in album page
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 835 Views |
-
Duplicate links in album page

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..
-
Re: Duplicate links in album page

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.
-
Re: Duplicate links in album page

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.
-
Re: Duplicate links in album page

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
-
Re: Duplicate links in album page

9 February 2010 at 2:35pm Last edited: 9 February 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
| 835 Views | ||
|
Page:
1
|
Go to Top |


