In the first tutorial we created the structure and a first version of the Blog application. In this one we'll introduce permissions and customization to improve both the navigation and the layout.

At the end of the tutorial we will obtain the following result.

Step 1. Set permissions

Portofino allows managing user permissions out of the box. The default groups to set permissions are:
  • "All": all users
  • "Anonymous": users not logged in
  • "Registered": users that are registered and logged in
  • "Administrators": administrators group.
In the application we want that:
  • only registered users can post,
  • all users can read a post,
  • all users can write a comment.
  • only administrators can delete and edit posts and comments.
To implement this policy, click on "Page permissions" on the top right of the page of the post  and check the permissions as shown in the following picture.


Notice the useful "Test a user" section that allows you to test what a user can do on the post page.

Permissions on comments are similar. The only difference is that all users can make a comment (the "all" group includes "registered" and "anonymous").

Step 2. Change the application title and the landing page

Our Blog has still the title "Portofino 4" and "Welcome" is the landing page. Let's change this.
Open the administration pages (click on "Administration"> "Settings)".  Change "Application name" (eg  "My Blog") and modify the landing page by selecting the page "Post".
Finally click on "Update".

If you want you can delete the old homepage or simply make it not visible (remove the visibility of a top page at "Administration" > "Configuration"> "Top-level pages").

Now click on the title "My Blog" at the top left, and test what we have done.

Step 3. Change the template of the pages

To change the layout we are going to use templates of Portofino. Portofino offers three types of templates:
  • default
  • site
  • site-no-sidebar
We'll use site-no-sidebar that has the main menu in tabs and no sidebar. Go to the configuration page of the "Post" and change the template "site-no-sidebar" for both the search page and for the detail.
In the same page I change the title and description from "Post" to "Blog". This little modifcation put "Blog" in the Tab menu.



If you want to create your own template, take a look to the existing ones located in the directory skins / default / templates / [default | site | site-no-sidebar]. You can create your own and it will appear in the template options.
Click on the title “My Blog” and see how the new layout make our application more similar to a blog.
In the next tutorial we start to make customization on the "Post" page.

comments powered by Disqus