Examples_ CakePHP Examples Anglais

download Examples_ CakePHP Examples Anglais

of 28

Transcript of Examples_ CakePHP Examples Anglais

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    1/28

    step 17: routes configuration cakephp blog project

    /app/config/routes.php

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    2/28

    0 comments

    Labels: CakePHP Examples

    1. step 14: delete post view controller cakephp blog

    2. step 15: adding element in cakephp blog

    3. step 16: passing data into element in cakephp blog

    4. MySQL greatest() Function String Value Example

    5. MySQL group concat function SQL Example

    6. MySQL concat function rows SQL Example

    7. MySQL concat function SQLAliase Example

    8. MySQL IFNULL() function Example using PHP

    9. MySQL NULL comparison Example using PHP

    array('controller'=>'pages', 'a ction'=>'display', 'home'));"

    with "Router::connect ('/', array('controller'=>'posts', 'action'=>'index'));"

    that's it!!!

    Finally open your browser and ge t effect of routes configuration in

    CakePHP Blog Project "http://localhost/cakeblog/" as follows:

    Related Tutorial Examples

    Recommend this on Google

    step 16: passing data into element in cakephp

    blog

    /app/controllers/posts_controller.php

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    3/28

    0 comments

    if (empty($this->data))

    {

    $this->data = $this->Post->read();

    }

    else

    {

    if ($this->Post->save($this->data))

    {

    $this->Session->setFlash('Your post has b

    een updated.');

    $this->redirect(array('action' => 'admin'

    ));

    }

    }}

    function delete($id)

    {

    $this->Post->delete($id);

    $this->Session->setFlash('The post with id: '.$

    id.' has been deleted.');

    $this->redirect(array('action'=>'admin'));

    }

    function latest()

    {

    $posts = $this->paginate();

    if (isset($this->params['requested']))

    {

    return $posts;

    }

    else{

    $this->set('posts', $posts);

    }

    }

    }

    ?>

    "latest()" is the method which is responsible to push data to "latest" element

    /app/views/elements/latest.ctp

    Recent Posts

    1. step 13: edit post view controller cakephp blog

    2. step 14: delete post view controller cakephp blog

    3. step 15: adding element in cakephp blog

    4. step 17: routes configuration cakephp blog project

    5. MySQL greatest() Function Datetime Example

    6. MySQL now() Datetime Function Example

    7. MySQL greatest() Function String Value Example8. MySQL Stored Procedure Function: Making hello world Function using

    aliase Example

    9. MySQL Stored Procedure: Creating Table using Stored Procedure Ex ample

    2. Element Modification:

    Now open up the latest Element file located at

    /app/views/elements/latest.ctp" then replace the code as bellow.

    Finally open your browser and get the element holding data from controller

    in CakePHP Blog Project "http://localhost/cakeblog/" as follows:

    Related Tutorial Examples

    Recommend this on Google

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    4/28

    Labels: CakePHP Examples

    step 15: adding element in cakephp blog

    /app/views/elements/latest.ctp

    Recent Posts

    this is a test title

    this is another test title

    this is also a test title

    /app/views/layouts/default.ctp

    20 steps to make cakephp blog

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    5/28

    0 comments

    Labels: CakePHP Examples

    1. step 12: add post view controller cakephp blog

    2. step 13: edit post view controller cakephp blog

    3. step 14: delete post view controller cakephp blog

    4. step 16: passing data into element in cakephp blog

    5. step 17: routes configuration cakephp blog project

    6. MySQL least() Function Numeric Value Example

    7. MySQL greatest() Function Datetime Example

    8. MySQL now() Datetime Function Example

    9. MySQL NULLIF() Nested Function Example

    Finally open your browser and get the element on Homepage or Default

    Layout in CakePHP Blog Proje ct "http://localhost/cakeblog/" as follows:

    Related Tutorial Examples

    Recommend this on Google

    step 14: delete post view controller cakephp blog

    /app/controllers/posts_controller.php

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    6/28

    0 comments

    Labels: CakePHP Examples

    }

    function admin()

    {

    $this->set('posts', $this->Post->find('all'));

    }

    function add()

    {

    if (!empty($this->data))

    {

    if ($this->Post->save($this->data))

    {

    $this->Session->setFlash('Your post has b

    een saved.');

    $this->redirect(array('action' => 'admin'));

    }

    }

    }

    function edit($id = null)

    {

    $this->Post->id = $id;

    if (empty($this->data))

    {

    $this->data = $this->Post->read();

    }

    else

    {

    if ($this->Post->save($this->data))

    {

    $this->Session->setFlash('Your post has been updated.');

    $this->redirect(array('action' => 'admin'

    ));

    }

    }

    }

    function delete($id)

    {

    $this->Post->delete($id);

    $this->Session->setFlash('The post with id: '.$

    id.' has been deleted.');

    $this->redirect(array('action'=>'admin'));

    }

    }

    ?>

    1. step 11: admin view posts for cakephp blog

    2. step 12: add post view controller cakephp blog

    3. step 13: edit post view controller cakephp blog

    4. step 15: adding element in cakephp blog

    5. step 16: passing data into element in cakephp blog

    6. step 17: routes configuration cakephp blog project

    7. MySQL isnull() Function Example

    8. MySQL least() Function Datetime Value Example

    9. MySQL least() Function String Value Ex ample

    Finally open your browser and try to del ete a ny post from post

    "http://localhost/cakeblog/posts/dele te/3" will result as follows:

    Related Tutorial Examples

    Recommend this on Google

    step 13: edit post view controller cakephp blog

    STEP 13: MAKING EDIT POST VIEW CONTROLLER CAKEPHP BLOG

    Open your browser to edit a ny post before modifying controller

    "http://localhost/cakeblog/posts/edit" in cakephp blog. Opps!!! Your Browser

    output should look like as follows:

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    7/28

    /app/controllers/posts_controller.php

    To edit post working smoothly we need to ma ke two changes as follows:

    Change #1 - Controller Modification:

    Open posts Controller located at /app/controllers/posts_controller.php"

    then copy & past the blow code replacing current.

    Agin open your browser to see the effect before making view to edit post

    "http://localhost/cakeblog/posts/edit" in cakephp blog. Opps!!! Your Browser

    output should look like as follows:

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    8/28

    0 comments

    Labels: CakePHP Examples

    /app/views/posts/edit.ctp

    Edit Post

    1. step 10: making view post details for cakephp blog

    2. step 11: admin view posts for cakephp blog

    3. step 12: add post view controller cakephp blog

    4. step 14: delete post view controller cakephp blog

    5. step 15: adding element in cakephp blog

    6. step 16: passing data into element in cakephp blog

    7. step 17: routes configuration cakephp blog project

    8. MySQL strcmp() Function Example :: on Equals,Large.. Values

    9. MySQL interval() Function Example

    10. MySQL coalesce() Function Example

    Change #2 - view post details addition:

    Make a file at /app/views/posts/edit.ctp" then copy & paste blow code into

    it to make the details view of the post.

    Now open your browser and see the edit form to edit post

    "http://localhost/cakeblog/posts/edit/3".

    Finally editted data will guide you to as follows:

    Related Tutorial Examples

    Recommend this on Google

    step 12: add post view controller cakephp blog

    STEP 12: MAKING ADD POST VIEW CONTROLLER CAKEPHP BLOG

    Open your browser to see the effect before modifying controller

    "http://localhost/cakeblog/posts/add" in cakephp blog. Opps!!! Your Browser

    output should look like as follows:

    To add post working smoothly we need to ma ke two changes as follows:

    Change #1 - Controller Modification:

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    9/28

    /app/controllers/posts_controller.php

    /app/views/posts/add.ctp

    Add Post

    Open posts Controller located at /app/controllers/posts_controller.php"

    then copy & past the blow code replacing current.

    Agin open your browser to see the effect before making view to add post

    "http://localhost/cakeblog/posts/add" in cakephp blog. Opps!!! Your Browser

    output should look like as follows:

    Change #2 - view post details addition:

    Make a file at /app/views/posts/add.ctp" then copy & paste blow code into

    it to make the details view of the post.

    Now open your browser and see the add form to add post

    "http://localhost/cakeblog/posts/add".

    Finally saving data will guide you to as follows:

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    10/28

    0 comments

    Labels: CakePHP Examples

    1. step 9: view for posts cakephp blog cakephp examples

    2. step 10: making view post details for cakephp blog3. step 11: admin view posts for cakephp blog

    4. step 13: edit post view controller cakephp blog

    5. step 14: delete post view controller cakephp blog

    6. step 15: adding element in cakephp blog

    7. step 16: passing data into element in cakephp blog

    8. MySQL IF() Function Boolean Value Example

    9. MySQL st rcmp() Function Number Value Example

    10. MySQL st rcmp() Function NULL Value Example

    Related Tutorial Examples

    Recommend this on Google

    step 11: admin view posts for cakephp blog

    /app/controllers/posts_controller.php

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    11/28

    0 comments

    }

    }

    }

    ?>

    /app/views/posts/admin.ctp

    Blog Posts Admin

    Id

    Title

    Created

    Action

    |

    1. step 8: mak ing model for posts cakephp blog

    2. step 9: view for posts cakephp blog cakephp examples

    3. step 10: making view post details for cakephp blog

    4. step 12: add post view controller cakephp blog

    5. step 13: edit post view controller cakephp blog

    6. step 14: delete post view controller cakephp blog

    7. step 15: adding element in cakephp blog

    8. MySQL IF() Function Number Value Example

    9. MySQL IF() Function Boolean Value Example

    10. MySQL st rcmp() Function Number Value Example

    again click admin link to see admin view of posts

    "http://localhost/cakeblog/posts/admin" in cakephp blog. Opps!!! Your

    Browser output should look like as follows as view is not created yet:

    Change #2 - admin view of posts addition:

    Make a file at /app/views/posts/admin.ctp" then copy & paste blow code

    into it to make admin vie w of posts.

    Finally open your browser and see admin view posts

    "http://localhost/cakeblog/posts/admin". If e verything went fine you should

    get as follows:

    Related Tutorial Examples

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    12/28

    Labels: CakePHP Examples

    Recommend this on Google

    step 10: making view post details for cakephp blog

    /app/controllers/posts_controller.php

    /app/views/posts/view.ctp

    Created:

    STEP 10: MAKING VIEW POST DETAILS FOR CAKEPHP BLOG

    Open your browser to see the available posts

    "http://localhost/cakeblog/posts" in cakephp blog as follows:

    Now click anyone to see the details view

    "http://localhost/cakeblog/posts/view/4" in cakephp blog. Opps!!! Your

    Browser output should look like as follows:

    To make the details view of a post we have to do two changes as follows:

    Change #1 - Controller Modification:

    Open posts Controller located at /app/controllers/posts_controller.php"

    then copy & past the blow code replacing current.

    Change #2 - view post details addition:

    Make a file at /app/views/posts/view.ctp" then copy & paste blow code into

    it to make the details view of the post.

    Finally open your browser and see the details view of any post

    "http://localhost/cakeblog/posts/view/4". If everything went fine you should

    get as follows:

    Related Tutorial Examples

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    13/28

    0 comments

    Labels: CakePHP Examples

    1. step 7: controller for posts cakephp blog

    2. step 8: mak ing model for posts cakephp blog

    3. step 9: view for posts cakephp blog cakephp examples

    4. step 11: admin view posts for cakephp blog

    5. step 12: add post view controller cakephp blog

    6. step 13: edit post view controller cakephp blog

    7. step 14: delete post view controller cakephp blog

    8. MySQL NULLIF() Nested Function Example

    9. MySQL IFNULL() Function Datetime Example

    10. MySQL coalesce() Function Example

    Recommend this on Google

    0 comments

    step 9: view for posts cakephp blog

    /app/views/posts/index.ctp

    Blog Posts

    Id

    Title

    1. step 6: template setup for cakephp blog

    2. step 7: controller for posts cakephp blog

    3. step 8: mak ing model for posts cakephp blog

    4. step 10: making view post details for cakephp blog

    5. step 11: admin view posts for cakephp blog

    6. step 12: add post view controller cakephp blog7. step 13: edit post view controller cakephp blog

    8. MySQL IF() Function NULL Value Example

    9. MySQL IF() Function Datetime Value Ex ample

    10. MySQL IF() Function String Value Example

    STEP 9: MAKING VIEW FOR POSTS CAKEPHP BLOG

    fire-up your favorite browser to see the effect before creating posts view

    "http://localhost/cakeblog/posts" in cakephp blog. Your Browser output

    should look like as follows:

    To solve the view problem, make a file /app/views/posts/index.ctp" then

    copy & paste blow code into the file.

    Now browser again and see the effect. Your browser's output should look

    like as follows:

    Related Tutorial Examples

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    14/28

    Labels: CakePHP Examples

    Recommend this on Google

    0 comments

    Labels: CakePHP Examples

    step 8: making model for posts cakephp blog

    /app/models/post.php

    1. step 5: making homepage for cakephp blog

    2. step 6: template setup for cakephp blog

    3. step 7: controller for posts cakephp blog

    4. step 9: view for posts cakephp blog cakephp examples

    5. step 10: making view post details for cakephp blog

    6. step 11: admin view posts for cakephp blog

    7. step 12: add post view controller cakephp blog

    8. MySQL IFNULL() Function Boolean Example

    9. MySQL IFNULL() Function NULL Value Example

    10. MySQL IF() Nested Function Example

    STEP 8: MAKING MODEL FOR POSTS CAKEPHP BLOG

    To make the post model, make a file /app/models/post.php" then copy &

    paste blow code into the file.

    Related Tutorial Examples

    Recommend this on Google

    step 7: controller for posts cakephp blog

    /app/controllers/posts_controller.php

    1. step 4: database configure for cakephp blog

    2. step 5: making homepage for cakephp blog

    3. step 6: template setup for cakephp blog

    4. step 8: mak ing model for posts cakephp blog

    5. step 9: view for posts cakephp blog cakephp examples

    6. step 10: making view post details for cakephp blog

    7. step 11: admin view posts for cakephp blog

    8. MySQL IFNULL() Nested Function Example

    STEP 7: MAKING CONTROLLER FOR POSTS CAKEPHP BLOG

    fire-up your favorite browser to see the effect before creating posts

    controller "http://localhost/cakeblog/posts" in cakephp blog. Browser output

    should look like as follows:

    To solve the problem, make a file /app/controllers/posts_controller.php"

    then copy & paste blow code into the file.

    Related Tutorial Examples

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    15/28

    0 comments

    Labels: CakePHP Examples

    9. MySQL IFNULL() Function String Example

    10. MySQL IFNULL() Function Number Example

    Recommend this on Google

    step 6: template setup for cakephp blog

    /app/views/layouts/default.ctp

    20 steps to make cakephp blog

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    16/28

    * {

    margin:0;

    padding:0;

    }

    body {

    margin: 20px 0px 0px 0px;

    padding: 0;

    background: #FFFFFF;

    font-family: Arial, Helvetica, sans-serif;

    font-size: 14px;

    color: #3C3D3F;

    }

    h1, h2, h3 {

    margin: 0;

    padding: 0;

    font-weight: normal;

    color: #FF3000;

    }

    h1 {

    font-size: 2em;

    }

    h2 {

    font-size: 2.8em;

    }

    h3 {

    font-size: 1.6em;

    }

    p, ul, ol {

    margin-top: 0;

    line-height: 180%;

    }

    a {

    text-decoration: underline;

    color: #EB1D1D;

    }

    a:hover {

    text-decoration: none;

    }

    #wrapper {

    margin: 0 auto;

    padding: 0;

    }

    /* Header */

    #header {

    overflow: hidden;

    width: 1000px;

    height: 50px;

    margin: 0px auto 20px auto;

    background:;

    }

    /* Logo */

    #logo {

    float: left;

    width: 380px;

    margin: 0;

    padding: 0;

    color: #000000;

    }

    #logo h1 {

    letter-spacing: -1px;

    text-transform: lowercase;

    font-size: 2.8em;

    color: #0C0C0C;

    }

    #logo h1 span {

    color: #EB1D1D;

    }

    /* Menu */

    #menu {

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    17/28

    float: right;

    width: 330px;

    border:0px red solid;

    }

    #menu ul {

    margin: 0px;

    padding: 0px 0px 0px 15px;

    list-style: none;

    }

    #menu li {

    float: left;

    }

    #menu a {

    display: block;

    float: left;

    height: 37px;

    padding: 13px 30px 0px 30px;

    text-decoration: none;

    text-transform: uppercase;

    font-family: Arial, Helvetica, sans-serif;

    font-size: 14px;

    font-weight: bold;

    color: #EB1D1D;

    }

    #menu a:hover{

    background: #EB1D1D;text-decoration: none;

    color: #FFFFFF;

    }

    /* Page */

    #page {

    width: 1000px;

    margin: 0 auto;

    padding: 40px 0px 0px 10px;

    border-top: 1px solid #BBBBBB;

    }

    /* Content */

    #content {

    float: left;

    width: 660px;

    padding: 0px 0px 0px 0px;

    background: #FFFFFF;

    }

    .post {

    margin-bottom: 2px;

    padding: 0px 0px;

    }

    .post .title {

    height: 41px;

    padding: 0px 0px 0px 0px;

    color: #414141;

    }

    .post .entry {

    padding: 10px 0px 10px 0px;

    padding-bottom: 10px;

    border-bottom: 0px solid #BBBBBB;

    text-align: justify;

    }

    .post .meta {

    overflow: hidden;

    padding-top: 10px;

    }

    /* Sidebar */

    #sidebar {

    float: right;

    width: 300px;

    margin: 0px;

    padding: 0px 0px 0px 0px;

    }

    #sidebar ul {

    margin: 0;

    padding: 0;

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    18/28

    list-style: none;

    }

    #sidebar li {

    margin: 0px 0px 0px 20px;

    padding: 0;

    }

    #sidebar li ul {

    margin: 0px;

    padding-bottom: 30px;

    }

    #sidebar li li {

    line-height: 35px;

    border-bottom: 1px solid #BBBBBB;

    border-left: none;

    text-align: left;

    }

    #sidebar li li span {

    display: block;

    margin-top: -20px;

    padding: 0;

    font-size: 11px;

    font-style: italic;

    }

    #sidebar li li a {

    padding: 0px 0px 0px 20px;}

    #sidebar h2 {

    height: 30px;

    margin: 0px 0px 20px 0px;

    padding: 4px 0px 0px 20px;

    text-align: left;

    text-transform: capitalize;

    letter-spacing: -2px;

    font-size: 2em;

    color: #414141;

    }

    #sidebar p {

    margin: 0 0px;

    padding: 0px 20px 20px 20px;

    text-align: justify;

    }

    #sidebar a {

    border: none;

    text-decoration: none;

    }

    #sidebar a:hover {

    text-decoration: underline;

    }

    #footer {

    width: 1000px;

    height: 30px;

    margin: 0 auto;

    padding: 0px 0 10px 0;border-top: 1px solid #BBBBBB;

    font-family: Arial, Helvetica, sans-serif;

    }

    #footer p {

    margin: 0;

    padding: 10px 0px 0px 30px;

    line-height: normal;

    font-size: 10px;

    text-transform: uppercase;

    text-align: center;

    color: #45302C;

    }

    #errors { background:#FF0000; color:#CCCCCC;}

    /* Tables */

    table {

    background: #fff;

    border:1px solid #ccc;

    border-right:0;

    clear: both;

    color: #333;

    margin-bottom: 10px;

    width: 100%;

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    19/28

    }

    th {

    background: #f2f2f2;

    border:1px solid #bbb;

    border-top: 1px solid #fff;

    border-left: 1px solid #fff;

    text-align: center;

    }

    th a {

    background:#f2f2f2;

    display: block;

    padding: 2px 4px;

    text-decoration: none;

    }

    th a:hover {

    background: #ccc;

    color: #333;

    text-decoration: none;

    }

    table tr td {

    background: #fff;

    border-right: 1px solid #ccc;

    padding: 4px;

    text-align: center;

    vertical-align: top;

    }

    table tr.altrow td {

    background: #f4f4f4;

    }

    td.actions {text-align: center;

    white-space: nowrap;

    }

    td.actions a {

    margin: 0px 6px;

    }

    .cake-sql-log table {

    background: #f4f4f4;

    }

    .cake-sql-log td {

    padding: 4px 8px;

    text-align: left;

    }

    /* Paging */

    div.paging {

    background:#fff;

    color: #ccc;

    margin-bottom: 2em;

    }

    div.paging div.disabled {

    color: #ddd;

    display: inline;

    }

    div.paging span {

    }

    div.paging span.current {

    color: #000;

    }

    div.paging span a {

    }

    /* Scaffold View */dl {

    line-height: 2em;

    margin: 0em 0em;

    width: 60%;

    }

    dl .altrow {

    background: #f4f4f4;

    }

    dt {

    font-weight: bold;

    padding-left: 4px;

    vertical-align: top;

    }

    dd {

    margin-left: 10em;

    margin-top: -2em;

    vertical-align: top;

    }

    /* Forms */

    form {

    clear: both;

    margin-right: 20px;

    padding: 0;

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    20/28

    width: 80%;

    }

    fieldset {

    border: 1px solid #ccc;

    margin-top: 30px;

    padding: 16px 20px;

    }

    fieldset legend {

    background:#fff;

    color: #e32;

    font-size: 160%;

    font-weight: bold;

    }

    fieldset fieldset {

    margin-top: 0px;

    margin-bottom: 20px;

    padding: 16px 10px;

    }

    fieldset fieldset legend {

    font-size: 120%;

    font-weight: normal;

    }

    fieldset fieldset div {

    clear: left;

    margin: 0 20px;

    }

    form div {

    clear: both;

    margin-bottom: 1em;

    padding: .5em;vertical-align: text-top;

    }

    form div.input {

    color: #444;

    }

    form div.required {

    color: #333;

    font-weight: bold;

    }

    form div.submit {

    border: 0;

    clear: both;

    margin-top: 10px;

    margin-left: 140px;

    }

    label {

    display: block;

    font-size: 110%;

    padding-right: 20px;

    }

    input, textarea {

    clear: both;

    font-size: 140%;

    font-family: "frutiger linotype", "lucida grande", "verdan

    a", sans-serif;

    padding: 2px;

    width: 100%;

    }

    select {

    clear: both;

    font-size: 120%;

    vertical-align: text-bottom;

    }select[multiple=multiple] {

    width: 100%;

    }

    option {

    font-size: 120%;

    padding: 0 3px;

    }

    input[type=checkbox] {

    clear: left;

    float: left;

    margin: 0px 6px 7px 2px;

    width: auto;

    }

    input[type=radio] {

    float:left;

    width:auto;

    margin: 0 3px 7px 0;

    }

    div.radio label {

    margin: 0 0 6px 20px;

    }

    input[type=submit] {

    display: inline;

    font-size: 110%;

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    21/28

    padding: 2px 5px;

    width: auto;

    vertical-align: bottom;

    }

    /* Notices and Errors */

    div.message {

    clear: both;

    color: #900;

    font-size: 140%;

    font-weight: bold;

    margin: 1em 0;

    }

    div.error-message {

    clear: both;

    color: #900;

    font-weight: bold;

    }

    p.error {

    background-color: #e32;

    color: #fff;

    font-family: Courier, monospace;

    font-size: 120%;

    line-height: 140%;

    padding: 0.8em;

    margin: 1em 0;

    }

    p.error em {

    color: #000;

    font-weight: normal;line-height: 140%;

    }

    .notice {

    background: #ffcc00;

    color: #000;

    display: block;

    font-family: Courier, monospace;

    font-size: 120%;

    line-height: 140%;

    padding: 0.8em;

    margin: 1em 0;

    }

    .success {

    background: green;

    color: #fff;

    }

    /* Actions */

    div.actions ul {

    margin: 0px 0;

    padding: 0;

    }

    div.actions li {

    display: inline;

    list-style-type: none;

    line-height: 2em;

    margin: 0 2em 0 0;

    white-space: nowrap;

    }

    div.actions ul li a {

    background:#fff;

    color: #003d4c;

    text-decoration: none;}

    div.actions ul li a:hover {

    color: #333;

    text-decoration: underline;

    }

    /* Related */

    div.related {

    clear: both;

    display: block;

    }

    /* Debugging */

    pre {

    color: #000;

    background: #f0f0f0;

    padding: 1em;

    }

    pre.cake-debug {

    background: #ffcc00;

    font-size: 120%;

    line-height: 140%;

    margin-top: 1em;

    overflow: auto;

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    22/28

    position: relative;

    }

    div.cake-stack-trace {

    background: #fff;

    border: 4px dotted #ffcc00;

    color: #333;

    margin: 0px;

    padding: 6px;

    font-size: 120%;

    line-height: 140%;

    overflow: auto;

    position: relative;

    }

    div.cake-code-dump pre {

    position: relative;

    overflow: auto;

    }

    div.cake-stack-trace pre, div.cake-code-dump pre {

    color: #000;

    background-color: #F0F0F0;

    margin: 0px;

    padding: 1em;

    overflow: auto;

    }

    div.cake-code-dump pre, div.cake-code-dump pre code {

    clear: both;

    font-size: 12px;

    line-height: 15px;

    margin: 4px 2px;

    padding: 4px;overflow: auto;

    }

    div.cake-code-dump span.code-highlight {

    background-color: #ff0;

    padding: 4px;

    }

    div.code-coverage-results div.code-line {

    padding-left:5px;

    display:block;

    margin-left:10px;

    }

    div.code-coverage-results div.uncovered span.content {

    background:#ecc;

    }

    div.code-coverage-results div.covered span.content {

    background:#cec;

    }

    div.code-coverage-results div.ignored span.content {

    color:#aaa;

    }

    div.code-coverage-results span.line-num {

    color:#666;

    display:block;

    float:left;

    width:20px;

    text-align:right;

    margin-right:5px;

    }

    div.code-coverage-results span.line-num strong {

    color:#666;

    }

    div.code-coverage-results div.start {

    border:1px solid #aaa;border-width:1px 1px 0px 1px;

    margin-top:30px;

    padding-top:5px;

    }

    div.code-coverage-results div.end {

    border:1px solid #aaa;

    border-width:0px 1px 1px 1px;

    margin-bottom:30px;

    padding-bottom:5px;

    }

    div.code-coverage-results div.realstart {

    margin-top:0px;

    }

    div.code-coverage-results p.note {

    color:#bbb;

    padding:5px;

    margin:5px 0 10px;

    font-size:10px;

    }

    div.code-coverage-results span.result-bad {

    color: #a00;

    }

    div.code-coverage-results span.result-ok {

    color: #fa0;

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    23/28

    0 comments

    Labels: CakePHP Examples

    }

    div.code-coverage-results span.result-good {

    color: #0a0;

    }

    1. step 3: configure security salt cakephp setup

    2. step 4: database configure for cakephp blog

    3. step 5: making homepage for cakephp blog

    4. step 7: controller for posts cakephp blog

    5. step 8: mak ing model for posts cakephp blog

    6. step 9: view for posts cakephp blog cakephp examples

    7. step 10: making view post details for cakephp blog

    8. MySQL NULLIF() Function NULL Value Example

    9. MySQL IFNULL() Function Datetime Example

    10. MySQL IFNULL() Nested Function Example

    then fire-up your favorite browser to see the effect of installing template to

    cakephp blog. Like the blow screenshot:

    Related Tutorial Examples

    Recommend this on Google

    step 5: making homepage for cakephp blog

    "/app/views/pages/home.ctp"

    20 steps to make CakePHP Blog

    Posted: September 1, 2010

    This is Md. Iqbal Hosan, a computer engineer, web developer and OCP DBA welcome you to learn how to make

    CakePHP Blog, a sample cakephp project by 20 cool steps.

    STEP 5: MAKING HOMEPAGE FOR CAKEPHP BLOG

    Make a folder pages if it is not already created at /app/views/ and

    create a file home.ctp into /app/views/pages/ then copy and paste the

    blow code into the file.

    It is time to fire-up your favorite browser to see the effect of making

    homepage home.ctp like the blow screenshot:

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    24/28

    0 comments

    Labels: CakePHP Examples

    1. step 2: download cakephp and setup cakeblog

    2. step 3: configure security salt cakephp setup

    3. step 4: database configure for cakephp blog

    4. step 6: template setup for cakephp blog

    5. step 7: controller for posts cakephp blog

    6. step 8: mak ing model for posts cakephp blog

    7. MySQL NULLIF() Function Number Value Example

    8. MySQL NULLIF() Function Boolean Value Example

    9. MySQL NULLIF() Function NULL Value Example

    10. PERL Example: Use of Multidimentional Array in PERL

    Related Tutorial Examples

    Recommend this on Google

    step 4: database configure for cakephp blog

    cakeblog.sql

    CREATE TABLE `posts` (

    `id` int(10) unsigned NOT NULL auto_increment,

    `title` varchar(50) default NULL,

    `body` text,

    `created` datetime default NULL,

    `modified` datetime default NULL,

    PRIMARY KEY (`id`)

    ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

    INSERT INTO `posts` VALUES

    (1,'Hello world of cakephp','This is the body part of hello

    world of cakephp.','2010-08-20 23:49:58','2010-08-26 11:27

    :05'),

    (2,'What is models in cakephp','Models represent data and a

    re used in CakePHP applications for data access. A model us

    ually represents a database table but can be used to access

    anything that stores data such as files, LDAP records, iCa

    l events, or rows in a CSV file.','2010-08-20 23:49:58','20

    10-08-26 11:29:38'),

    (3,'What is views in cakephp','Views are the V in MVC. View

    s are responsible for generating the specific output requir

    ed for the request. Often this is in the form of HTML, XML,

    or JSON, but streaming files and creating PDF\'s that user

    s can download are also responsibilities of the View Layer.

    ','2010-08-20 23:49:58','2010-08-26 11:30:28'),

    (4,'What is controllers in cakephp','A controller is used t

    o manage the logic for a part of your application. Most com

    monly, controllers are used to manage the logic for a singl

    e model. For example, if you were building a site for an on

    line bakery, you might have a RecipesController and a Ingre

    dientsController managing your recipes and their ingredient

    s. In CakePHP, controllers are named after the model they h

    andle, in plural form.','2010-08-26 11:31:17','2010-08-26 11:31:17');

    STEP 4: DATABASE CONFIGURE FOR CAKEPHP BLOG

    Make a database cakeblog and run the blow sql script to make a table

    posts and insert some demo data into it:

    Making database cakeblog and running "cakeblog.sql" in the sql editor.

    Like the below screen shot:

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    25/28

    0 comments

    Labels: CakePHP Examples

    1. 20 steps to make CakePHP Blog Project

    2. step 2: download cakephp and setup cakeblog

    3. step 3: configure security salt cakephp setup

    4. step 5: making homepage for cakephp blog

    5. step 6: template setup for cakephp blog

    6. step 7: controller for posts cakephp blog

    7. MySQL NULLIF() Function Datetime Value Example

    8. MySQL NULLIF() Function String Value Example

    9. MySQL NULL value Example using PHP

    10. MySQL Stored Procedure: Creating Table using Stored Procedure Ex ample

    Now rename the file database.php.default to database.php found in

    /app/config and make the following changes to configure the database for

    cakeblog:

    then the home page becomes like the blow screen shot i.e. CakePHP can

    connect to your database and database config file "database.php" is

    available at "/app/config/" folder.

    Related Tutorial Examples

    Recommend this on Google

    step 3: configure security salt cakephp setup

    STEP 3: CONFIGURE SECURITY SALT CAKEPHP SETUP

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    26/28

    0 comments

    Labels: CakePHP Examples

    1. 20 steps to make CakePHP Blog Project

    2. step 2: download cakephp and setup cakeblog

    3. step 4: database configure for cakephp blog

    4. step 5: making homepage for cakephp blog

    5. step 6: template setup for cakephp blog

    6. step 7: controller for posts cakephp blog

    7. MySQL IFNULL() Function String Example

    8. MySQL coalesce() Function Example

    9. MySQL Stored Procedure Function: How to Drop a Function Example

    10. Apache mod_rewrite Example: Hellow world!! program using htaccess

    To configure security salt open file /app/config/core.php and change the

    value of Security.salt. Like the following screen shot:

    Once you replace the default Security.salt value, your application will look

    Like the following screen shot in the browser:

    Related Tutorial Examples

    Recommend this on Google

    step 2: download cakephp and setup cakeblog

    STEP 2: DOWNLOAD CAKEPHP AND SETUP CAKEBLOG

    It is time to download CakePHP form http://cakephp.org. Download 1.2.7 as

    I am proceeding with it.

    Now copy the downloaded zip file into your web root and unzip the file. As

    I am using Xampp server my default web root is htdocs. Like the following

    screen shot:

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    27/28

    0 comments

    Labels: CakePHP Examples

    1. 20 steps to make CakePHP Blog Project

    2. step 3: configure security salt cakephp setup

    3. step 4: database configure for cakephp blog

    4. step 5: making homepage for cakephp blog

    5. step 6: template setup for cakephp blog

    6. MySQL NULLIF() Function Boolean Value Example

    7. MySQL NULLIF() Function NULL Value Example

    8. How To Find MySQL SERVER VERSION Information

    9. Arithmetic operators in SQL Command MySQL Example

    10. PERL Example: Use of Arrays in PERL

    Rename the folder to cakeblog. Like the following screen shot:

    We are done. Now fire-up your favorite browser to the cakeblog

    (http://127.0.0.1/cakeblog/), you should get the following screen shot:

    Related Tutorial Examples

    Recommend this on Google

  • 7/29/2019 Examples_ CakePHP Examples Anglais

    28/28

    Older PostsHome

    Subscribe to: Posts (Atom)

    4 comments

    Labels: Basic Tutorial Examples, CakePHP Examples

    20 steps to make CakePHP Blog Project

    CakePHP is a very powerful framework to make web application rapidly.

    Unfortunately, I find very few articles on web for making CakePHP project unlessbook.cakephp.org. Thus I write this series of articles step by step to make a

    sample CakePHP Blog project. So, developers just follow me:

    1. step 2: download cakephp and setup cakeblog

    2. step 3: configure security salt cakephp setup

    3. step 4: database configure for cakephp blog

    4. step 5: making homepage for cakephp blog

    5. MySQL NULLIF() Nested Function Example

    6. MySQL IFNULL() Function Datetime Example

    7. MySQL group concat function SQL Example

    8. MySQL Stored Procedure: INSERT INTO SELECT... Example

    9. MySQL TRUNCATE TABLE Example

    10. Google Maps Static API Example Class Using PHP

    20 STEPS TO MAKE CAKEPHP BLOG

    This is Md. Iqbal Hosan, a computer engineer; web developer and OCP

    DBA welcome you to learn how to make CakePHP Blog, a sample CakePHP

    project by 20 cool steps.

    Why making this project

    Related Tutorial Examples

    Recommend this on Google