Welcome Guest, Not a member yet? Register   Sign In
Problem with load->helper
#1

[eluser]frizbee[/eluser]
Hey everyone,

I have problem with loading helpers.
Here is what i have but in not load.
Code:
public function __constract()
    {
        parent::__constract();
        
        $this->load->helper('html');
        
    }
here is how i call doctype()
Code:
echo doctype('html5');

I found that all tutorials on youtube and official website is based on 1.7 version and it's totally different from 2.0.2
Almost everything what i do, is not working.
#2

[eluser]WanWizard[/eluser]
And what happens if you do this? Any error messages? If it doesn't echo as expected, what does it echo?

We can't help you when the problem is described simply as "not working"...
#3

[eluser]InsiteFX[/eluser]
And if you expect to see it echoed to the screen you are wrong! You need to view the html souce to see it...
Code:
<?php echo doctype('html5');?>

Seems like a lot work just to write:
Code:
<!DOCTYPE html>

InsiteFX
#4

[eluser]frizbee[/eluser]
I found error.
I have to load helpers in config.php
Code:
$autoload['helper'] = array('url','html','form');

And I don't need them to load in Controller (blog.php) file

Code:
$this->load->helper('html');

It's not shown in tutorials and manuals even on official website.
In 2.0.2 manuals it sais:
Code:
Loading a Helper

Loading a helper file is quite simple using the following function:

$this->load->helper('name');
Where name is the file name of the helper, without the .php file extension or the "helper" part.

For example, to load the URL Helper file, which is named url_helper.php, you would do this:

$this->load->helper('url');
#5

[eluser]InsiteFX[/eluser]
Oh Really then what is this?

Auto-loading Helpers

If you find that you need a particular helper globally throughout your application, you can tell CodeIgniter to auto-load it during system initialization. This is done by opening the application/config/autoload.php file and adding the helper to the autoload array.

InsiteFX
#6

[eluser]cideveloper[/eluser]
If you just copied and pasted the code you showed then the problem is "constract". It is not "constract" it is "construct"
#7

[eluser]frizbee[/eluser]
Thank you everyone it's working now.
I will study CI further




Theme © iAndrew 2016 - Forum software by © MyBB