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.
@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 <a href link you'll need to go back to each link and update the href if you change a URL.
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.
@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'].
@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.
What if as a parameter i want to send a slash?? "/". i tried this and give me some error.
BlakMetall 2 months ago
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.
actionowl 2 months ago
@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 <a href link you'll need to go back to each link and update the href if you change a URL.
andrewperk 2 months ago
@andrewperk I was hoping there was a good reason :)
Thanks for putting these videos up!
actionowl 2 months ago
@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().
andrewperk 2 months ago
@andrewperk Wish I would have seen that 45 mins ago lol
ProTheist 2 months ago in playlist More videos from andrewperk
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.
0248maheshgupta 5 months ago
@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'].
andrewperk 5 months ago
fucking awesome!
puniek95 7 months ago
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
jeeremie 8 months ago
you videos are awesome , continue :)
mora88marmora 9 months ago
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?
heohni 1 year ago
Warning (2): htmlentities() [function.htmlentities]: charset `1' not supported, assuming iso-8859-1 [CORE\cake\libs\view\helpers\html.php, line 294]
Fatal error: Cannot unset string offsets in C:\xampp\cakephp\cake\libs\view\helpers\html.php on line 299
mahmedseif 1 year ago
Warning (2): htmlentities() [function.htmlentities]: charset `1' not supported, assuming iso-8859-1 [CORE\cake\libs\view\helpers\html.php, line 294]
Fatal error: Cannot unset string offsets in C:\xampp\cakephp\cake\libs\view\helpers\html.php on line 299
mahmedseif 1 year ago
thanks mate!
your tutorials are awesome!!!
m00m00mm 1 year ago
The created and modified date for me doesn't work, it just show a bunch of zeros.
konteu 1 year ago
u r 2uu gud
erhmirhnem 1 year ago
A little question: Why don't you close your php tags in some of your examples?
Thanks. I love your videos.
BettyBoop186 1 year ago 2
@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.
andrewperk 1 year ago 6
@andrewperk Thanks a lot for your explanation. It has sense.
Thanks again.
BettyBoop186 1 year ago