Tutorial in docs has errors, or? |
I've been monkeying through the tutorial in the docs:
Code: https://codeigniter4.github.io/CodeIgniter4/tutorial/index.html to get my head around this 'new' version. In this part: Code: https://codeigniter4.github.io/CodeIgniter4/tutorial/news_section.html At the bottom of the paragraph titled "Display the news" I see this: Code: <h2><?= esc($news['title']); ?></h2> Now, this throws and error in my case: Code: Undefined index: title So, in order to correct this I rewrite the above part to this: Code: <h2><?= $title; ?></h2> If you notice, I commented out the 'body' part as it throws the same error (undefined variable) and I can't seem to see that a 'body' is actually passed into the view anywhere? What part is it that I completely missed in the process? Remember there is the index method and the view method … defined in the Routes.php. Could it be that somewhere along the tutorial something was missed, or did I just totally screw it all up by myself (yeah, good boy there)? Yep, and as soon as I posted this ... I found the answer. I had mistyped Code: echo view('templates/header', $data); instead of this: Code: echo view('templates/header', $data); In my index method (note the missing 'over' in overview … ). Note to self: use copy/paste when following tutorials ... Rule of life: if you've banged your head against something for a while ... write a post in a forum somewhere (it probably doesn't matter which one) and boom, there's your answer.
well i'm a Slackware Linux user i.e a Slacker and even i don't like that coding lazyness for goodness sake you save a couple of chars with abomination abbreviation. Best thing is pretend you ddon't see it.
As for the rest of the documentation, I read it, implemented it and my web is working . So the moral of the story is .. |
Welcome Guest, Not a member yet? Register Sign In |