Jump to content

Display in tree


sandy1028

Recommended Posts

Hi,

 

How to display the list of names in tree format. Under Name all the names should be displayed.

 

 

<?php
$lines = file('./data.txt');
echo " <div style=\"position:absolute; left:12px;\"><font face=\"Arial\" color=\"#A41325\" size=\"3\"></font></div>";
                echo "<ul id=\"containerul\" type=\"circle\"><li>Name</li></ul>";
                foreach ($lines as $line) {
                                 $text_line = explode(":" , $line);
                                echo "<ul type=\"square\"><li>$text_line[0]</li></ul>";
                        }


echo "<ul id=\"containerul\" type=\"circle\"><li>Address</li></ul>";

                        foreach ($lines as $line) {
                        $text_line = explode(":" , $line);

                        echo "<ul type=\"square\"><li>$text_line[1]</li></ul>";
                                }

echo "<ul id=\"containerul\"  type=\"circle\"><li>Age</li></ul>";
foreach ($lines as $line) {
                $text_line = explode(":" , $line);
echo "<ul type=\"square\"><li>$text_line[2]</li></ul>";
}
echo "<ul id=\"containerul\" type=\"circle\"><li>Email</li></ul>";
foreach ($lines as $line) {

                $text_line = explode(":" , $line);
echo "<ul type=\"square\"><li>$text_line[3]</li></ul>";
}

echo "<ul id=\"containerul\"  type=\"circle\"><li>Mobile</li></ul>";
foreach ($lines as $line) {
                 $text_line = explode(":" , $line);

echo "<ul type=\"square\"><li>$text_line[4]</li></ul>";
}
echo "<ul id=\"containerul\" type=\"circle\"><li>Residence Number</li></ul>";
foreach ($lines as $line) {
                $text_line = explode(":" , $line);
echo "<ul type=\"square\"><li>$text_line[5]</li></ul>";
}?>

Link to comment
Share on other sites

here, i did the first for you...

 

                echo "<ul id=\"containerul\" type=\"circle\"><li>Name</li>";
echo "<ul type=\"square\">";
                foreach ($lines as $line) {
                                 $text_line = explode(":" , $line);
                                echo "<li>$text_line[0]</li>";
}
echo "</ul></ul>";

 

i think that should do it... hopefully. :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.