Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Still new at this but I'm trying to do the same for a news page, think i've got the login part working but having problems with the CRUD (will post a question on it shortly) - i have a table to populate with data from an rss feed (but will be manually populated with a CRUD to start with) and then have a page on the front end to pull out the details using views to format each news story.</p> <ol> <li>Create a new directory called /page/Admin</li> <li><p>Create a new file here based on the function e.g. news.php containing <pre><code>class page_admin_news extends Page { function init(){ parent::init(); $p=$this; $crud=$p-&gt;add('CRUD'); $g=$crud-&gt;setModel('News'); if($crud-&gt;grid) $crud-&gt;grid-&gt;addPaginator(30); } } </code></pre></li> <li><p>In Frontend.php, you need to enable the login - for an admin only access, the BasicAuth may be sufficient but there are also classes to use a database to obtain username and password infromation e.g. for a membership site - heres the basic one. // If you wish to restrict access to your pages, use BasicAuth class $auth=$this->add('BasicAuth') ->allow('demo','demo') ;</p></li> <li><p>You need to modify Frontend.php to enable pages that can be viewed without being logged in</p> <pre><code>$auth-&gt;allowPage('index'); $auth-&gt;allowPage('news'); $auth-&gt;allowPage('links'); $auth-&gt;allowPage('About'); if (!$auth-&gt;isPageAllowed($this-&gt;api-&gt;page)) { $auth-&gt;check(); } </code></pre></li> <li><p>And also in Frontend.php, you need to create a different menu if logged in. Note the login and logout pages dont actually exist. </p> <pre><code>if ($auth-&gt;isLoggedIn()) { $this-&gt;add('Menu',null,'Menu') -&gt;addMenuitem('News','admin_news') -&gt;addMenuitem('logout') ; } else { $this-&gt;add('Menu',null,'Menu') -&gt;addMenuitem('News','news') -&gt;addMenuitem('Links','links') -&gt;addMenuItem('About') -&gt;addMenuItem('Login') ; } </code></pre></li> <li><p>When you login, it goes to page/index.php by default so if you want it to redirect to a particular page when you log in so you can add this to page/index.php</p> <pre><code>class page_index extends Page { function init(){ parent::init(); $p=$this; if($this-&gt;api-&gt;auth-&gt;isLoggedIn()) $this-&gt;api-&gt;redirect('admin_news'); </code></pre></li> </ol> <p>Hope that helps.</p> <p>Trev</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