Cakephp Blog Tutorial Part 4 – Using the Read and Html Link Methods

A tutorial for building a blog using the Cakephp framework. In this video we used the model’s read method as well as the html link helper method. You can download this videos source code at www.andrews-custom-web-design.com

No related content found.

Revisions

There are no revisions for this post.

Tags: , , , , , , , , ,

20 Responses to “Cakephp Blog Tutorial Part 4 – Using the Read and Html Link Methods”

  1. BlakMetall December 18, 2011 at 11:37 AM #

    What if as a parameter i want to send a slash?? “/”. i tried this and give me some error.

  2. actionowl December 18, 2011 at 12:24 PM #

    @andrewperk I was hoping there was a good reason 🙂
    Thanks for putting these videos up!

  3. andrewperk December 18, 2011 at 12:51 PM #

    @actionowl Also you should now use the new syntax for calling helpers by using $this before, like so: $this->Html->link() and $this->Form->input().

  4. andrewperk December 18, 2011 at 1:43 PM #

    @actionowl If at any point you change your URL’s using routing in the future you do not have to go to all of your views and update each link individually. The link helper method will update the link to go to the proper URL location automatically. But if you use a regular

  5. actionowl December 18, 2011 at 2:20 PM #

    What is the advantage of using the $Html->link() method over manually writing an anchor tag with a relative link? Calling a class method, and creating an array seems like an unnecessary performance hit.

  6. andrewperk December 18, 2011 at 2:52 PM #

    @0248maheshgupta The associated model name can be any models that your current model is associated with. For instance in this video we are dealing with blog posts. We retrieve the post and store it in a $post variable. We can access that post using $post[‘Post’], which is the first key. If this post had associated comments you could also access that posts comments through the same $post variable using the associated model name: $post[‘Comment’].

  7. 0248maheshgupta December 18, 2011 at 3:26 PM #

    Hey, this helped me a lot in understanding the PHP and CakePHP for a learner like me. I went through online documentation for the find method, it says the return is an array, with two keys 1, Modelname and other for AssociatedModelName, Could anyone tell me what is AssociatedModelName.

  8. puniek95 December 18, 2011 at 3:37 PM #

    fucking awesome!

  9. videct December 18, 2011 at 3:57 PM #

    this was wonderful. thank you so much. 🙂

  10. jeeremie December 18, 2011 at 4:42 PM #

    Yiu make it super easy to understand CakePHP. Thank you so much. I have been reading the official docs for a while… So useless for beginners.

    Maybe what you could explain is how to link to the previous/next posts

  11. mora88marmora December 18, 2011 at 5:19 PM #

    you videos are awesome , continue 🙂

  12. heohni December 18, 2011 at 5:40 PM #

    Hi! I love your videos!! Keep on going!! I am one of your biggest fans!
    Can you tell me what syntax highlight you use?
    I mean, did you setup your ctp files to get parsed as html files within phpstorm?

  13. mahmedseif December 18, 2011 at 6:03 PM #

    Warning (2): htmlentities() [function.htmlentities]: charset `1′ not supported, assuming iso-8859-1 [COREcakelibsviewhelpershtml.php, line 294]

    Fatal error: Cannot unset string offsets in C:xamppcakephpcakelibsviewhelpershtml.php on line 299

  14. mahmedseif December 18, 2011 at 6:16 PM #

    Warning (2): htmlentities() [function.htmlentities]: charset `1’ not supported, assuming iso-8859-1 [COREcakelibsviewhelpershtml.php, line 294]

    Fatal error: Cannot unset string offsets in C:xamppcakephpcakelibsviewhelpershtml.php on line 299

  15. m00m00mm December 18, 2011 at 6:54 PM #

    thanks mate!
    your tutorials are awesome!!!

  16. konteu December 18, 2011 at 7:47 PM #

    The created and modified date for me doesn’t work, it just show a bunch of zeros.

  17. erhmirhnem December 18, 2011 at 8:05 PM #

    u r 2uu gud

  18. BettyBoop186 December 18, 2011 at 8:12 PM #

    @andrewperk Thanks a lot for your explanation. It has sense.
    Thanks again.

  19. andrewperk December 18, 2011 at 8:29 PM #

    @BettyBoop186 When you create a php file you don’t have to close the php tag, it is not required by php. That’s why my controllers and models don’t have closing php tags, this actually helps prevent some errors that can pop up such as whitespace after the class. On files that you are outputting something afterward like html, you must close the php tag, we always do this inside of our views.

  20. BettyBoop186 December 18, 2011 at 8:42 PM #

    A little question: Why don’t you close your php tags in some of your examples?
    Thanks. I love your videos.

Leave a Reply