Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It really depends on what you need.</p> <p>For example if the page has big part that change completely, what I would suggest is to create different templates and include them depending on their "permissions"</p> <pre><code> $permission = $_SESSION['type_user']; include '/path/to/file/with/permission/'.$permission.'/tpl.html'; </code></pre> <p>and have something in the page similar to</p> <pre><code>&lt;?php //inside include.php you have the line similar to //$permission = isset($_SESSION['type_user']) &amp;&amp; $_SESSION['type_user']!=''?$_SESSION['type_user']:'common'; require_once '/mast/config/include.php'; include '/path/to/file/with/permission/common/header.html'; include '/path/to/file/with/permission/'.$permission.'/tpl_1.html'; include '/path/to/file/with/permission/common/tpl_2.html'; include '/path/to/file/with/permission/'.$permission.'/tpl_3.html'; include '/path/to/file/with/permission/common/footer.html'; ?&gt; </code></pre> <p>if the script is full of small parts like "show this text", or "show this button", you can create a function that will check the permissions for you</p> <pre><code>&lt;?php function can_user($action, $what){ switch($action){ case 'write': return $your_current_if_on_what; break; case 'read': default: return $your_current_if_on_what; break; } } ?&gt; and the template will look like: [my html] &lt;?=can_user('read','button')?'My Button':''?&gt; [my html] </code></pre> <p>As a rule of thumb, if a piece of code is used more than 2 times, it needs to be put in a function/file separately, so if you have many "IFS" you need to create a function</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload