Part of the EllisLab Network
   
 
show_error and $heading issue
Posted: 21 November 2006 10:59 AM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  67
Joined  11-07-2006

Hi to all, the show_error function I’ve found in Exceptions.php CI’s class is the following:

/**
     * General Error Page
     *
     * This function takes an error message as input
     * (either as a string or an array) and displays
     * it using the specified template.
     *
     * @access    private
     * @param    string    the heading
     * @param    string    the message
     * @param    string    the template name
     * @return    string
     */
    
function show_error($heading, $message, $template = 'error_general')
    
{
        $message
= '<p>'.implode('</p><p>', ( ! is_array($message)) ? array($message) : $message).'</p>';

        if (
ob_get_level() > 1)
        
{
            ob_end_flush
();    
        
}
        ob_start
();
        include(
APPPATH.'errors/'.$template.EXT);
        
$buffer = ob_get_contents();
        
ob_end_clean();
        return
$buffer;
    
}

Seems it takes as mandatory title the first argument, and mandatory message the second argument.

But when I call it, it does take only 1 argument, as message. So $heading argument seems fixed at “An error occured”, not customizable. It shouldn’t looking at the function declaration.

So what’s stealing the $heading value from calls?

 Signature 

cool hmm mmmmh…

Profile
 
 
Posted: 21 November 2006 12:09 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  254
Joined  10-04-2006

It is quite strange what you told us !

1. Do you use show_error method from library exceptions and not show_error functions for CodeIgniter.php
2. Are you sure not to use error_php template which not include heading ?

 Signature 

Sylvain Gourvil
PHP Developer
French scuba divingMotivation and team building

Profile
 
 
Posted: 22 November 2006 02:57 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  67
Joined  11-07-2006

Seems my Zend Studio is calling the show_error function of CodeIgniter.php o_O?
How can I call the library instead?

 Signature 

cool hmm mmmmh…

Profile
 
 
Posted: 25 November 2006 06:20 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  67
Joined  11-07-2006
Tchinkatchuk - 21 November 2006 12:09 PM

It is quite strange what you told us !

1. Do you use show_error method from library exceptions and not show_error functions for CodeIgniter.php

Should i load / autoload the exceptions library before using show_error?
The only method loaded in my Zend Project refers to the CodeIgniter method.

 Signature 

cool hmm mmmmh…

Profile
 
 
Posted: 27 November 2006 03:56 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  254
Joined  10-04-2006

The function show_error is this one :

function show_error($message)
{
    $error
=& load_class('Exceptions');
    echo
$error->show_error('An Error Was Encountered', $message);
    exit;
}

If you are doing this

show_error(...);


you will not have any heading.

If you want to use Exceptions’ ons

$error =& load_class('Exceptions');
echo
$error->show_error($heading, $message);

 Signature 

Sylvain Gourvil
PHP Developer
French scuba divingMotivation and team building

Profile
 
 
Posted: 27 November 2006 07:52 AM   [ Ignore ]   [ # 5 ]  
Grad Student
Avatar
Rank
Total Posts:  67
Joined  11-07-2006
Tchinkatchuk - 27 November 2006 03:56 AM

The function show_error is this one :
If you want to use Exceptions’ ons

$error =& load_class('Exceptions');
echo
$error->show_error($heading, $message);

Would be also good autoloading the library exceptions and then call it with $this->exception->show_error($h,$m); ?

 Signature 

cool hmm mmmmh…

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 66430 Total Logged-in Users: 31
Total Topics: 84793 Total Anonymous Users: 5
Total Replies: 455044 Total Guests: 202
Total Posts: 539837    
Members ( View Memberlist )
Newest Members:  Dylan1978X_franbaguasllogocsaturkeyPeter BryanttherendStudioGeorgiaJZeerfedeghe