I try to extend tutorial Simple ACL controlled application (enter link description here). I want add table Categories so tables are:
CREATE TABLE users (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL UNIQUE,
password CHAR(40) NOT NULL,
group_id INT(11) NOT NULL,
created DATETIME,
modified DATETIME
);
CREATE TABLE groups (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
created DATETIME,
modified DATETIME
);
CREATE TABLE posts (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
user_id INT(11) NOT NULL,
category_id INT(11) NOT NULL,
title VARCHAR(255) NOT NULL,
body TEXT,
created DATETIME,
modified DATETIME
);
CREATE TABLE categories (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL
);
Now I have add.ctp, edit.ctp, index.ctp and view.ctp in app/View/Posts and in app/View/Categories. These methods are accessible after login. But now I want display some menu and posts by categories for non logged users. After click on Category1 in main menu it will display only posts from Category1. Something like this:
Main menu: **Category1** | Category2 | Category3
Title of post1 in Category1
Body of post1 in Category1
Title of post2 in Category1
Body of post2 in Category1
..........
Main menu: Category1 | **Category2** | Category3
Title of post1 in Category2
Body of post1 in Category2
Title of post2 in Category2
Body of post2 in Category2
..........
I don't understand how to do that. Add some .ctp files to app/View/Posts? Or something else? Thank you for help.