here i want to know that how i can do this result on client side no user can change,delete or add in this page how i will show info like this: (all values come from database)
+2009
+2010
+BCA-I
+BCA-II
-BCA-III
SAD.pdf
Advance Web Application.pdf
Programming in JAVA.pdf
+PGDCA
+M.Sc. (Pre)
+M.Sc. (Final)
+2011
how i can do this work.
thanks

Dani AI

Generated

— the simplest way to present a tree that users cannot change on the server is to build the hierarchy on the server and deliver it as read-only HTML (or JSON rendered without any write UI). was right to point you toward jQuery widgets for expand/collapse behavior; use a plugin or a small script in read-only mode so the page only controls presentation and never exposes edit/add/delete endpoints.

Build the structure server-side from your DB, then output nested lists for the client. Example markup (purely presentational) looks like this:

<ul class="tree">
  <li class="folder">2009
    <ul>
      <li class="folder">BCA-I</li>
      <li class="file"><a href="/download?id=123">SAD.pdf</a></li>
    </ul>
  </li>
  <li class="folder">2010</li>
</ul>

Do not rely on client-side controls for security: any page sent to a browser can be locally modified by the user. To ensure data cannot be changed on your site, do not expose write APIs and enforce permission checks on the server for any action that would persist changes. If files must be protected, serve them through a server script that verifies access and then returns the file with appropriate headers (instead of linking directly to a filesystem path).

If you want persistent open/closed state, save it server-side per user or use a client cookie only for UI convenience. For accessibility and keyboard support, add ARIA tree roles or consider the native details/summary elements for simple collapsibles. Finally, keep the UI read-only: remove context menus, edit buttons, and any AJAX endpoints that would accept modifications.

Recommended Answers

All 2 Replies

Member Avatar for Member #120589

Look for some jQuery examples.

Your DB will need to store something like this:

id | label | file_url | sort_order | parent_id | open_state

VARCHAR label = displayed text
VARCHAR file_url = url IF the item is a file, NULL as default
INT sort_order = display order (or leave this out for alphabetical order)
INT parent_id = if top level folder (0), if not use parent folder id (id)
INT open_state = 1 (open), 0 (closed)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.