Max Width?

Phoca Gallery modules - modules for Phoca Gallery extension
siyman
Phoca Member
Phoca Member
Posts: 13
Joined: 20 Oct 2009, 17:12

Max Width?

Post by siyman »

Hi Jan,

is it possible to apply to phoca tree a max width so that entries which are too long will be splittet into at least two parts?

Thanks for your good work - siy
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Max Width?

Post by Jan »

hi, the tree is created by dtree. For now I didn't find any solution in javascript how to do it :-(
If you find Phoca extensions useful, please support the project
siyman
Phoca Member
Phoca Member
Posts: 13
Joined: 20 Oct 2009, 17:12

Re: Max Width?

Post by siyman »

Hm, I tried it via the white-space css tag and it's working. Actually not very good ;) To explain my problem the left menu modules are overlayed by the content stuff through my template und that's why every kind of text is going to the invisibility by running into the content's area.
Do you think there would be an option to indent the text which is white-spaced to the position the father-element is?

Another Possibility in my case would be to create a new module-class on the left which is overlaying the content box but I'm not very happy with this solution.

Third, I have a question. Is it easier for you to read and write in English or German?

Thanks - siy
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Max Width?

Post by Jan »

I have a question. Is it easier for you to read and write in English or German?
Depends on the words used in the answer :-) Sometimes it is better in English, machmal auf Deutsch :-)

As I don't know exactly what happens in the javascript I cannot say anything about the method (css) which can fix this :-(
Another Possibility in my case would be to create a new module-class on the left which is overlaying the content box but I'm not very happy with this solution.
no experience there :idea:

Jan
If you find Phoca extensions useful, please support the project
stanislawl
Phoca Member
Phoca Member
Posts: 16
Joined: 16 Sep 2008, 09:13

Re: Max Width?

Post by stanislawl »

Hi,

I had the same problem. I have modified the categoryTree function in mod_phocagallery_tree.php file so that the names longer than 15 characters are cut. The code searches the first space in the text, cuts the rest and then padds it with three dots:

// Categories tree
$tree = array();
$text = '';
$tree = categoryTree( $categories, $tree, 0, $text, $treeId );

// Create category tree
function categoryTree( $data, $tree, $id=0, $text='', $treeId ) {
foreach ( $data as $value ) {
if ($value->parentid == $id) {
$link = getLink($value->id);
$title = $value->text;

// Cut a long name.
if(strlen($title) > 15) {
$subtitle = explode(" ", $title);
$title = $subtitle[0] . ' ...';
}

$title = addslashes($title);

$showText = $text . ''.$treeId.'.add('.$value->id.','.$value->parentid.',\''.$title.'\',\''.$link.'\');'."\n";
$tree[$value->id] = $showText;
$tree = categoryTree($data, $tree, $value->id, '', $treeId);
}
}
return($tree);
}

You may see the effect here: http://www.zlotniki.szkola.pl (on the right there is a module 'W galerii...').

However, it would be fine to see a full name when the mouse pointer is over the "shortened" title - maybe in a tooltip? The 'title' part of a 'href' tag would be OK, but where to put it? Have you any suggestions?

Best regards,
Stan
siyman
Phoca Member
Phoca Member
Posts: 13
Joined: 20 Oct 2009, 17:12

Re: Max Width?

Post by siyman »

Seems to work properly, thanks for this advise. I'll go check this out later and give you some feedback.
frisket
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 21 Aug 2010, 14:13

Re: Max Width?

Post by frisket »

Hi,

I use Tree Module - version 2.7.1, I tried to apply this solution, but I did not succeed. There is an error "Fatal error: Call to undefined function getlink () in /.../ modules / mod_phocagallery_tree / mod_phocagallery_tree.php on line 122. :(
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Max Width?

Post by Jan »

Hi, you should check your code getlink ->getLink

Jan
If you find Phoca extensions useful, please support the project
frisket
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 21 Aug 2010, 14:13

Re: Max Width?

Post by frisket »

Online check of syntax of the modified file "mod_phocagallery_tree.php" on a site www.meandeviation.com has passed without errors.
Line number 122 - "$ link = getLink ($ value-> id);".
If instead of it to put a line "$link = JRoute:: _ (PhocaGalleryRoute:: getCategoryRoute ($value-> id, $value-> alias));" from original mod_phocagallery_tree.php, then there is no error, but the module is working as usual . :(
Post Reply