We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

A problem with Language Title | Forum

Dave S
Dave S Oct 5 '13
The title doesn't show correct when i tried to change the title for User's Photos by Language.


e.q:


From {$title} - photo at {$site_name}


to {$displayName} 's Photos


I attched the pic, so you can see the result.


The Forum post is edited by Dave S Oct 5 '13
Daisy Team
Daisy Oct 11 '13
Please specify what page exactly you want to change the title on.
Dave S
Dave S Oct 15 '13
Daisy, it's user's Photos ( www.name.com/photo/view/36 )
Daisy Team
Daisy Oct 23 '13
This variable was not defined for the view photo page. To add this variable, you should go to /ow_plugins/photo/controllers/photo.php file. Find the following string:

OW::getDocument()->setTitle($language->text('photo', 'meta_title_photo_view', array('title' => $description)));

and add the'displayName' => $displayName variable.

Also the $displayName variable should be describe in this function. So, you should add the following string:

$displayName = BOL_UserService::getInstance()->getDisplayName($userId);

Finally, the code should look the following way:


        $description = strip_tags($photo->description);
        $description = mb_strlen($description) ? $description : $photo->id;
        $displayName = BOL_UserService::getInstance()->getDisplayName($userId);
        OW::getDocument()->setTitle($language->text('photo', 'meta_title_photo_view', array('displayName' => $displayName, 'title' => $description)));
        $tagsArr = BOL_TagService::getInstance()->findEntityTags($photo->id, 'photo');


I hope this example will help all developers who have the problems with the variables functionality.

fbkca
fbkca Nov 14 '13
thanks for this Daisy. it's a great help. But this change make all the photos have the displayName of the logged in user... and not the photo's owner... was that expected?
The Forum post is edited by fbkca Nov 14 '13
Dave S
Dave S Nov 19 '13
It doesn't work on the view photo page. It shows "{$displayName} 's Photos", not "Name's Photos" as i expected.
Daisy Team
Daisy Nov 21 '13
Guys, sorry, but I can only give you the direction and you should find the solution by deeply checking into the code and it's behavior.

Anyway, try this code:

 $this->assign('userName', BOL_UserService::getInstance()->getUserName($album->userId));
        $displayName = BOL_UserService::getInstance()->getDisplayName($album->userId);
        $this->assign('displayName', $displayName);
       
        OW::getDocument()->setTitle($language->text('photo', 'meta_title_photo_view', array('title' => $description, 'displayName' => $displayName)));
        $tagsArr = BOL_TagService::getInstance()->findEntityTags($photo->id, 'photo');
The Forum post is edited by Daisy Nov 21 '13