Codeigniter 1.7.2: function image() seems to no longer exist, what is the replacement?
A so开发者_JAVA技巧ciety I belong to have a website which someone who left a few years ago set up. It was done using codeigniter (which was probably rather excessive given that the website is pretty simple.)
The server it is hosted on updated Php recently, which resulted in the website completely breaking. It now simply returns a page full of deprecated function error messages like
"A PHP Error was encountered
Severity: 8192
Message: Function set_magic_quotes_runtime() is deprecated
Filename: codeigniter/CodeIgniter.php
Line Number: 60 "
Reading the CodeIgniter documentation it seemed the new version would work fine with the latest PhP installed on the server. I installed a the latest version of CodeIgniter (1.7.2) and copied over the views and database settings. I now get an error message about the image() function being undefined:
"Fatal error: Call to undefined function image() in /public_html/newSystem/application/views/welcome_index.php on line 32"
I tried searching through all the CodeIgniter documentation, and couldn't find any reference to this function.
it is used in the following fasion: <?=image('welcome_index_splash-text.gif')?>
which led me to believe it was related to the img() function which converts text into an element, but replacing image() with img() gave the same error message. (Well, with img being undefined instead of image)
Since I have never used CodeIgniter before, there is probably a very simple fix, but it doesn't seem readily available from the UsersGuide.
The lesson would be not to use a framework like CodeIgniter when static HTML would have done, but it wasn't my decision to set it up like this in the first place!
Thank you for any help.
Codeigniter has a helper function called img()
which returns the HTML code for the image provided as argument. If you get that error you're probably not including the right helper library like this:
$this->load->helper('html');
in your controller.
Reference: http://codeigniter.com/user_guide/helpers/html_helper.html
精彩评论