$EXT->end_script not Working
Posted: 28 October 2006 09:09 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

Hello, I’m having a little trouble with the $EXT->end_script variable in the ‘submit_new_entry_start’ hook.  In it I’m setting the variable like so:

global $EXT;
$EXT->end_script = true;

However in cp.publish.php when the extension is returned:

$edata = $EXT->call_extension('submit_new_entry_start');
if (
$EXT->end_script === TRUE) return;

end_script is never filled.  It always comes back as a bool(false) when var_dump()ed.  What makes it even stranger is that I can set $EXT->dummy_var = ‘hello’; in my extension and when I var_dump() it in cp.publish.php it comes out as ‘hello’, as you would expect.

I only have one extension enabled, so it’s not conflicting with something.  Has anyone else had this problem?

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 28 October 2006 09:22 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

A quick update: when I var_dump() $EXT inside of my extension right after setting end_script to TRUE then it show’s up as TRUE.  So somewhere between my extension returning a value and the cp.publish.php picking back up it’s loosing it’s value?

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 28 October 2006 09:26 AM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

More figuring: when I var_dump() $this in the core.extension.php class directly after the extension was called end_script is already set to FALSE:

$this->last_call = call_user_func_array(array(&$this->OBJ[$class_name], $method), $args);
var_dump($this);

so somewhere in the call_user_func_array line my end_script variable is getting lost.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 28 October 2006 09:31 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

Figured it out!  I was running the following code in my EXT:

$EXT->end_script = TRUE;
$EE->new_entry_form('preview', $LANG->line('validation_error_'.$field['field_list_items']));

and what was happening was the var was being set to true and then the new_entry_form would run, and reinitialize the variable (i guess).  So, switching the order of the two allowed the new_entry_form to run and then the var to be set.

$EE->new_entry_form('preview', $LANG->line('validation_error_'.$field['field_list_items']));
$EXT->end_script = TRUE;

I guess sometimes it helps to talk things out in a forum when your stuck.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

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 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64905 Total Logged-in Users: 58
Total Topics: 81838 Total Anonymous Users: 40
Total Replies: 440027 Total Guests: 240
Total Posts: 521865    
Members ( View Memberlist )