Tolong pilih kategori sesuai, jenis posting (diskusi atau bukan) dan sertakan tag/topik yang sesuai seperti komputer, java, php, mysql, dll. Promosi atau posting tidak pada tempatnya akan kami hapus!
- Bagi Anda yang ingin mendaftar, baca link berikut:
http://diskusiweb.com/discussion/50491/how-to-registrasi-diskusiweb-com-baca-ini-terlebih-dahulu
- Cara menyisipkan kode program supaya tampil rapi dan terformat dengan baik di diskusiweb.com: http://www.diskusiweb.com/discussion/50415/cara-menyisipkan-kode-program-di-diskusiweb-com
- Cara posting gambar/image di post Anda: http://www.diskusiweb.com/discussion/47345/cara-menyisipkan-menyertakan-image-pada-posting/p1

tree menu dari database mysql

saya ingin buat menu di web dengan model treemenu..tapi data datanya ambil dari database mysql...
folder 1
....subfolder 1
.........item1 subfolder1
.........item2 subfolder1
....subfolder 2
.........item1 subfolder2
.........item2 subfolder2

folder 2
....subfolder 2
.........item1 subfolder2
.........item2 subfolder2
....subfolder 2
.........item1 subfolder2
.........item2 subfolder2

begitu seterusnya....saya bingung meletakkan script phpnya gimana...saya udah coba menggunakan perintah
nah aku dah coba pakai select tapi itu hanya bisa menampilkan 1 saja ...mohon pencerahannya untuk yang level 2 dst..

berikut saya berikan listingnya

<pre lang ="php:>
?
$menu1=mysql_query("SELECT * FROM menu_admin WHERE menu_level = '1' AND menu_parents = '30'");
while ($menu_lvl_1=mysql_fetch_array($menu1))
{
echo "<li><span class='folder'>$menu_lvl_1[menu_label]</span></li>";
}
?>
</pre><div class='geshi_syntax'><table><tr><td><div class='code'><pre class="php"><span class="sy0"><</span>head<span class="sy0">></span>
<span class="sy0"><</span>link rel<span class="sy0">=</span><span class="st0">"stylesheet"</span> href<span class="sy0">=</span><span class="st0">"main/menu/jquerymenus/jquery.treeview.css"</span> <span class="sy0">/></span>
<span class="sy0"><</span>script type<span class="sy0">=</span><span class="st0">"text/javascript"</span> src<span class="sy0">=</span><span class="st0">"main/menu/jquerymenus/jquery1.5.js"</span><span class="sy0">></</span>script<span class="sy0">></span>
<span class="sy0"><</span>script src<span class="sy0">=</span><span class="st0">"main/menu/jquerymenus/lib/jquery.cookie.js"</span> type<span class="sy0">=</span><span class="st0">"text/javascript"</span><span class="sy0">></</span>script<span class="sy0">></span>
<span class="sy0"><</span>script src<span class="sy0">=</span><span class="st0">"main/menu/jquerymenus/jquery.treeview.js"</span> type<span class="sy0">=</span><span class="st0">"text/javascript"</span><span class="sy0">></</span>script<span class="sy0">></span>
<span class="sy0"><</span>script type<span class="sy0">=</span><span class="st0">"text/javascript"</span> src<span class="sy0">=</span><span class="st0">"main/menu/jquerymenus/demo.js"</span><span class="sy0">></</span>script<span class="sy0">></span>
<span class="sy0"></</span>head<span class="sy0">></span>
<span class="sy0"><</span>body<span class="sy0">></span>
<span class="sy0"><</span>ul id<span class="sy0">=</span><span class="st_h">'browser'</span> <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'filetree'</span><span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span href<span class="sy0">=</span><span class="st_h">'index.php'</span> <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'folder'</span><span class="sy0">></span>Folder <span class="nu0">1</span><span class="sy0"></</span>span<span class="sy0">></span>
<span class="sy0"><</span>ul<span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'folder'</span><span class="sy0">></span>Subfolder <span class="nu19">1.1</span><span class="sy0"></</span>span<span class="sy0">></span>
<span class="sy0"><</span>ul id<span class="sy0">=</span><span class="st_h">'folder21'</span><span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'file'</span><span class="sy0">><</span>a href<span class="sy0">=</span><span class="st_h">''</span><span class="sy0">></span>File 1<span class="sy0">.</span>1<span class="sy0">.</span>1<span class="sy0"></</span>a<span class="sy0">></</span>span<span class="sy0">></</span>li<span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'file'</span><span class="sy0">></span>File 1<span class="sy0">.</span>1<span class="sy0">.</span>2<span class="sy0"></</span>span<span class="sy0">></</span>li<span class="sy0">></span>
<span class="sy0"></</span>ul<span class="sy0">></span>
<span class="sy0"></</span>li<span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'folder'</span><span class="sy0">></span>Subfolder <span class="nu19">2.1</span><span class="sy0"></</span>span<span class="sy0">></span>
<span class="sy0"><</span>ul id<span class="sy0">=</span><span class="st_h">'folder21'</span><span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'file'</span><span class="sy0">></span>File 1<span class="sy0">.</span>2<span class="sy0">.</span>1<span class="sy0"></</span>span<span class="sy0">></</span>li<span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'file'</span><span class="sy0">></span>File 1<span class="sy0">.</span>2<span class="sy0">.</span>2<span class="sy0"></</span>span<span class="sy0">></</span>li<span class="sy0">></span>
<span class="sy0"></</span>ul<span class="sy0">></span>
<span class="sy0"></</span>li<span class="sy0">></span>
<span class="sy0"></</span>ul<span class="sy0">></span>
<span class="sy0"></</span>li<span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'folder'</span><span class="sy0">></span>Folder <span class="nu0">2</span><span class="sy0"></</span>span<span class="sy0">></span>
<span class="sy0"><</span>ul<span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'folder'</span><span class="sy0">></span>Subfolder <span class="nu19">2.1</span><span class="sy0"></</span>span<span class="sy0">></span>
<span class="sy0"><</span>ul id<span class="sy0">=</span><span class="st_h">'folder21'</span><span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'file'</span><span class="sy0">></span>File 2<span class="sy0">.</span>1<span class="sy0">.</span>1<span class="sy0"></</span>span<span class="sy0">></</span>li<span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'file'</span><span class="sy0">></span>File 2<span class="sy0">.</span>1<span class="sy0">.</span>2<span class="sy0"></</span>span<span class="sy0">></</span>li<span class="sy0">></span>
<span class="sy0"></</span>ul<span class="sy0">></span>
<span class="sy0"></</span>li<span class="sy0">></span>
<span class="sy0"><</span>li<span class="sy0">><</span>span <span class="kw2">class</span><span class="sy0">=</span><span class="st_h">'file'</span><span class="sy0">></span>File <span class="nu19">2.2</span><span class="sy0"></</span>span<span class="sy0">></span> <span class="sy0"></</span>li<span class="sy0">></span>
<span class="sy0"></</span>ul<span class="sy0">></span>
<span class="sy0"></</span>li<span class="sy0">></span>
<span class="sy0"></</span>ul<span class="sy0">></span>
<span class="sy0"></</span>body<span class="sy0">></span></pre></div></td></tr></table></div>
Tagged:
Sign In or Register to comment.