[PHP] Tree menu list in php

2011-07-26 Thread alekto
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 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
  

Re: [PHP] Tree menu list in php

2011-07-26 Thread Jim Giner
Jasper Mulder lord_fa...@hotmail.com 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 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 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 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 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 alekto.antarct...@gmail.com 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
 
 
 
 




[PHP] pathinfo function

2011-07-26 Thread Tim Streater
Is it to be expected that, if a file has no extension, and I do this:

   $info = pathinfo ($myfile);

that I will get an error if I try to reference $info[extension] ??

--
Cheers  --  Tim

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

Re: [PHP] pathinfo function

2011-07-26 Thread Micky Hulse
On Tue, Jul 26, 2011 at 3:47 PM, Tim Streater t...@clothears.org.uk wrote:
 that I will get an error if I try to reference $info[extension] ??

From what I can tell via reading the docs:

The following associative array elements are returned: dirname,
basename, extension (if any), and filename.
http://php.net/pathinfo

Makes me think that if the extension does not exist, then the
extension key will not exist.

Looking like isset() (or array_key_exists) will be needed:

$foo = (isset($info['extension'])) ? $info['extension'] : '';

At least, that's my take on it. :)

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



[PHP] Re: pathinfo function

2011-07-26 Thread Shawn McKenzie
On 07/26/2011 05:47 PM, Tim Streater wrote:
 Is it to be expected that, if a file has no extension, and I do this:
 
$info = pathinfo ($myfile);
 
 that I will get an error if I try to reference $info[extension] ??
 
 --
 Cheers  --  Tim

Just like any other array you'll get a notice:

Notice: Undefined index: extension

-- 
Thanks!
-Shawn
http://www.spidean.com

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