Accessing to global "data" variables from helper |
[eluser]asumaran[/eluser]
Hello. I want to do some functions to display some parts of my site, like wordpress. ie. the_title() displays the page title, previously declared in $data['title'] and get_the_title, retrieve the content (not displays) the content of $data['title'] the_meta()... get_the_meta()... and so on... This is my controller Code: <?php in basic_template, I have this Code: <html> and in my template_helper, I have this: Code: function the_title() When I run the code, It give to me a error "undefined variable: data" what I'm doing wrong? please help *sorry for my bad english
[eluser]danmontgomery[/eluser]
In class members Code: $data should be Code: $this->data
[eluser]asumaran[/eluser]
It didn't works, or I didn't get it how to do please, you could explain a little? thanks in advance
[eluser]danmontgomery[/eluser]
Code: <?php You can't really access controller members from helpers, helper functions are not members of any class and shouldn't be expected to access anything they aren't given. http://php.net/manual/en/language.oop5.php
|
Welcome Guest, Not a member yet? Register Sign In |