php-general Digest 27 Jul 2011 07:59:03 -0000 Issue 7417

Topics (messages 314204 through 314213):

Re: Tree menu list in php
        314204 by: Jasper Mulder
        314205 by: Jim Giner
        314206 by: Bojan Tesanovic
        314207 by: alekto
        314208 by: Stuart Dallas
        314209 by: Bálint Horváth
        314213 by: Pete Ford

pathinfo function
        314210 by: Tim Streater
        314211 by: Micky Hulse
        314212 by: Shawn McKenzie

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
> From: alekto.antarct...@gmail.com
> Date: Tue, 26 Jul 2011 19:20:58 +0200
> To: php-gene...@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
                                          

--- End Message ---
--- Begin Message ---
"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-gene...@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! 



--- End Message ---
--- Begin Message --- 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





--- End Message ---
--- Begin Message ---
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
>> 
> 
> 
> 


--- End Message ---
--- Begin Message ---
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-gene...@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/

--- End Message ---
--- Begin Message ---
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
> >>
> >
> >
> >
>
>

--- End Message ---
--- Begin Message ---
On 26/07/11 18:20, 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!

Look, I know this is loopy and I haven't tried it (for the protection of my sanity, mainly), but how about the tree being an image generated using PHP, and then used as an image map to submit the page every time a click is made on the image - you could then use the coordinates of the click to determine the new state of the tree and render an appropriate image for it...

I'll get my coat...

Pete

--
Peter Ford, Developer                 phone: 01580 893333 fax: 01580 893399
Justcroft International Ltd.                              www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent   TN12 0AH   United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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. :)

--- End Message ---
--- Begin Message ---
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

--- End Message ---

Reply via email to