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
https://forums.phpfreaks.com/topic/60751-display-in-tree/
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
https://forums.phpfreaks.com/topic/60751-display-in-tree/#findComment-302226
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.