Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Editing Baked Views

Editing the views is a simple task. Open the app/views/posts folder, and you should find the following baked views:

  • add.ctp
  • edit.ctp
  • index.ctp
  • view.ctp

Open the index.ctp file, and you will find all the HTML unique to this view. Change line 2 in this file to the following, and the title on the Index action page will change to "Blog Posts":

<h2><? __('Blog Posts');?></h2>

You can add to and delete anything from this file to change the Index action view without affecting any of the other actions. For example, the date field is not displayed nicely for the user. You can format this date string to appear more readable by editing it in the view file.

Around line 34 in the app/views/posts/index.ctp file is the date string:

<?php echo $post['Post']['date']; ?>

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint