Re: [PHP] Tree menu list in php

2011-07-26 Thread Bálint Horváth
Hi,
I'd like to write my opinion quickly.. My way both usable with and without
JS...

In my structures there is an array of the menu elements similar to:
$menu[gravity][name] = link; - filled from database, easy to handle

to more prof., more params use three-dimensional array...

In the url u can store the selected/expanded (sub)menu but without js its a
little bit slow cause of reload. (good way if js is blocked and users have
high speed conn. or page cached well...)
eg. home?expand=menu_item_id
if (this_menu_item == expanded_item){
  show submenus...
}

u can also generate js from php.. or set height, visibility from js for a
*div uploaded from php*...
create an array or use simple innerHTML to show the menu... I suggest
skipping all the js examples (because they are too complicated) and write a
simple script from your mind using basic elements...

eg. simply you have to have a global array...
expanded[menuid] = true;
if (expanded[menuid]){
   //innerHTML = "submenus";
   menu_item.style.height = "auto";
   menu_item.style.visibilty = "visible";
}

or expanded[] = id; //using in_array...

and yes, u can use AJAX to load php to js...

Simple JS code I wrote before it:
function subs(id, len){
var subsa = document.getElementById(id);
var subsap = document.getElementById(id + 'p');
if (subss[id] == true){
subsa.style.visibility = "hidden";
subsa.style.height = "10px";
subsap.innerHTML = "[+]";
subss[id] = false;
} else{
subsa.style.height = (len * 18) + "px";
subsa.style.visibility = "visible";
subsap.innerHTML = "[-]";
subss[id] = true;
}
}

used for:
Menu[-]
 Sub
 Sub
Menu[+]
Menu[+]


*Have a good time with PHP!*


*Valentine*

On Tue, Jul 26, 2011 at 8:41 PM, alekto  wrote:

> Thank you all for good answers and explanations, think I will give
> JavaScript a try!
>
>
>
> Den 26. juli 2011 kl. 20.37 skrev Bojan Tesanovic:
>
> > Look at it this way, PHP is just another scripting language, it processes
> data.
> > That said PHP is not responsible for user interface , it just prints out
> what you tell him to , it can be HTML XML JSON etc
> > presentation thing is eg HTML and CSS is for styling HTML, JS is to
> dynamically change structure of HTML or better to say DOM.
> > Though there is a easy way to make menus with HTML5 and CSS3 but most
> current browsers don't support those new tech stuff , (most browsers do but
> user are not up to date with freshest ones)
> >
> > If there is a real reason not to use JS, can you make more specific
> example so we can help.
> >
> > Bojan Tesanovic
> > Senior PHP Developer
> > http://oophp.org/
> >
> > On Jul 26, 2011, at 7:20 PM, alekto wrote:
> >
> >> Hi,
> >> is there a way to create a tree menu list only by using php/html/css?
> >> I found some, but they are all in JavaScript, do I have to make them by
> using JavaScript or is there a way in php as well?
> >>
> >> This is how I imagine the tree menu should look like:
> >>
> >>
> >> v First level
> >>> Second level
> >>> Second level
> >>v Second level
> >>> Third level
> >>> Third level
> >>> Third level
> >>> Second level
> >>> Second level
> >>
> >> ( > = menu is closed, v  = menu is open )
> >>
> >>
> >> Cheers!
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> >
> >
>
>


Re: [PHP] Tree menu list in php

2011-07-26 Thread Stuart Dallas
On 26 Jul 2011, at 19:01, Jasper Mulder wrote:

> 
>> From: alekto.antarct...@gmail.com
>> Date: Tue, 26 Jul 2011 19:20:58 +0200
>> To: php-general@lists.php.net
>> Subject: [PHP] Tree menu list in php
>> 
>> Hi,
>> is there a way to create a tree menu list only by using php/html/css?
>> I found some, but they are all in JavaScript, do I have to make them by 
>> using JavaScript or is there a way in php as well?
>> 
>> This is how I imagine the tree menu should look like:
>> 
>> 
>> v First level
>>> Second level
>>> Second level
>>   v Second level
>>> Third level
>>> Third level
>>> Third level
>>> Second level
>>> Second level
>> 
>> ( > = menu is closed, v  = menu is open )
>> 
>> 
>> Cheers!
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> This appears like a typical JavaScript thing to me. If you insist on not 
> using JS, you could probably use AJAX+PHP to do it.
> However, JavaScript appears to me as the more convenient method.

I suggest you look up what the J in AJAX stands for!

Pure CSS tree: http://www.thecssninja.com/css/css-tree-menu (be sure to check 
the browser support section).

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Tree menu list in php

2011-07-26 Thread alekto
Thank you all for good answers and explanations, think I will give JavaScript a 
try!



Den 26. juli 2011 kl. 20.37 skrev Bojan Tesanovic:

> Look at it this way, PHP is just another scripting language, it processes 
> data. 
> That said PHP is not responsible for user interface , it just prints out what 
> you tell him to , it can be HTML XML JSON etc
> presentation thing is eg HTML and CSS is for styling HTML, JS is to 
> dynamically change structure of HTML or better to say DOM. 
> Though there is a easy way to make menus with HTML5 and CSS3 but most current 
> browsers don't support those new tech stuff , (most browsers do but user are 
> not up to date with freshest ones)
> 
> If there is a real reason not to use JS, can you make more specific example 
> so we can help.
> 
> Bojan Tesanovic
> Senior PHP Developer
> http://oophp.org/
> 
> On Jul 26, 2011, at 7:20 PM, alekto wrote:
> 
>> Hi,
>> is there a way to create a tree menu list only by using php/html/css?
>> I found some, but they are all in JavaScript, do I have to make them by 
>> using JavaScript or is there a way in php as well?
>> 
>> This is how I imagine the tree menu should look like:
>> 
>> 
>> v First level
>>> Second level
>>> Second level
>>v Second level
>>> Third level
>>> Third level
>>> Third level
>>> Second level
>>> Second level
>> 
>> ( > = menu is closed, v  = menu is open )
>> 
>> 
>> Cheers!
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> 
> 



Re: [PHP] Tree menu list in php

2011-07-26 Thread Bojan Tesanovic
Look at it this way, PHP is just another scripting language, it  
processes data.
That said PHP is not responsible for user interface , it just prints  
out what you tell him to , it can be HTML XML JSON etc
presentation thing is eg HTML and CSS is for styling HTML, JS is to  
dynamically change structure of HTML or better to say DOM.
Though there is a easy way to make menus with HTML5 and CSS3 but most  
current browsers don't support those new tech stuff , (most browsers  
do but user are not up to date with freshest ones)


If there is a real reason not to use JS, can you make more specific  
example so we can help.


Bojan Tesanovic
Senior PHP Developer
http://oophp.org/

On Jul 26, 2011, at 7:20 PM, alekto wrote:


Hi,
is there a way to create a tree menu list only by using php/html/css?
I found some, but they are all in JavaScript, do I have to make  
them by using JavaScript or is there a way in php as well?


This is how I imagine the tree menu should look like:


v First level

Second level
Second level

   v Second level

Third level
Third level
Third level
Second level
Second level


( > = menu is closed, v  = menu is open )


Cheers!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







Re: [PHP] Tree menu list in php

2011-07-26 Thread Jim Giner
"Jasper Mulder"  wrote in message 
news:snt106-w6527d1e82d0a3efe6f76f1f7...@phx.gbl...

> From: alekto.antarct...@gmail.com
> Date: Tue, 26 Jul 2011 19:20:58 +0200
> To: php-general@lists.php.net
> Subject: [PHP] Tree menu list in php
>
> Hi,
> is there a way to create a tree menu list only by using php/html/css?
> I found some, but they are all in JavaScript, do I have to make them by 
> using JavaScript or is there a way in php as well?
>

If by "tree menu" you mean to have a menu that interacts with the user and 
shows the "branches", ie, sub-menus as the user clicks on items, then you 
can't do it with php obviously.   OTOH - if you just want a menu with 
indents and choices similar to an 'outline' , then sure you can do it with 
php/html/css.  But the JS ones are the sharpest ones.  There's several out 
there for free too! 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Tree menu list in php

2011-07-26 Thread Jasper Mulder

> From: alekto.antarct...@gmail.com
> Date: Tue, 26 Jul 2011 19:20:58 +0200
> To: php-general@lists.php.net
> Subject: [PHP] Tree menu list in php
> 
> Hi,
> is there a way to create a tree menu list only by using php/html/css?
> I found some, but they are all in JavaScript, do I have to make them by using 
> JavaScript or is there a way in php as well?
> 
> This is how I imagine the tree menu should look like:
> 
> 
> v First level
>> Second level
>> Second level
>v Second level
>   > Third level
>   > Third level
>   > Third level
>   > Second level
>   > Second level
> 
> ( > = menu is closed, v  = menu is open )
> 
> 
> Cheers!
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

This appears like a typical JavaScript thing to me. If you insist on not using 
JS, you could probably use AJAX+PHP to do it.
However, JavaScript appears to me as the more convenient method.

Regards,
Jasper