Professional CodeIgniter, Thomas Myer

Chapter 10: Launch
305
$this-
>
upload-
>
display_errors();
exit();
}
$image = $this-
>
upload-
>
data();
if ($image[`file_name']){
$data[`image'] = "/images/".$image[`file_name'];
}
}
if (strlen($_FILES[`thumbnail'][`image'])){
if(!$this-
>
upload-
>
do_upload(`thumbnail')){
$this-
>
upload-
>
display_errors();
exit();
}
$thumb = $this-
>
upload-
>
data();
if ($thumb[`file_name']){
$data[`thumbnail'] = "/images/".$thumb[`file_name'];
}
}
}
//snipped for brevity
}//end of function


Detecting JavaScript and Cookie Compatibility

You may be expecting a huge dump of code to see if JavaScript and cookies are enabled. There ' s no way
that you ' d want to go through with something like that at this point in the project, so the following
minimalist code is offered as a decent check for JavaScript compatibility:
<
noscript
>
You will not be able to view this site if JavaScript is not enabled.
Please turn on JavaScript to use this site.
<
/noscript
>

That ' s it -- that ' s all you need to put in your template view, and you ' re 100 percent covered. If they don ' t
have JavaScript turned on, they get this message. There really is no way to test to see if JavaScript is
turned on (after all, if it is off, you can ' t run a test to see if it is on). Even the following minimal test
seems pretty bizarre:
if (true){
//do something here, we must be on
}else{
//well shucks, JavaScript turned off, there's no way to send an error message!
}
The
<
noscript
>

option is very straightforward and displays just the error message. You might want to
add some branding to it, like the Claudia ' s Kids logo, maybe a phone number or other information, but
that ' s about as good as it gets. (You could also contemplate removing the AJAX handlers from the
shopping carts, but that seems a bit much.)
c10.indd 305
c10.indd 305
6/10/08 5:38:37 PM
6/10/08 5:38:37 PM


Другие страницы

 
Cкачать книги бесплатно без регистрации в электронном виде (pdf, chm, txt).Вы можете читать книги онлайн на нашем сайте литературного портала книг.Большая подборка учебников, пособий, интересных книг.Электронные книги на английском языке скачать бесплатно без смс.