Page 1 of 1

Max Width?

Posted: 16 Nov 2009, 12:30
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

Re: Max Width?

Posted: 16 Nov 2009, 18:54
by Jan
hi, the tree is created by dtree. For now I didn't find any solution in javascript how to do it :-(

Re: Max Width?

Posted: 16 Nov 2009, 21:50
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

Re: Max Width?

Posted: 18 Nov 2009, 19:10
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

Re: Max Width?

Posted: 02 Jan 2010, 15:17
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

Re: Max Width?

Posted: 02 Jan 2010, 17:33
by siyman
Seems to work properly, thanks for this advise. I'll go check this out later and give you some feedback.

Re: Max Width?

Posted: 21 Aug 2010, 15:06
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. :(

Re: Max Width?

Posted: 21 Aug 2010, 17:47
by Jan
Hi, you should check your code getlink ->getLink

Jan

Re: Max Width?

Posted: 28 Aug 2010, 23:07
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 . :(