We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Module action resulting in blank screen (!?)

Development and Programming

dstechroom's avatar
dstechroom
113 posts
15 years ago
dstechroom's avatar dstechroom

Hello - This is regarding EE 2.0.2 build 20100430

I have a module with an action - It seems to be installed correctly:

//upd.zipsearch.php
function install()
    {
        $data = array(
            'module_name' => 'Zipsearch' ,
            'module_version' => $this->version,
            'has_cp_backend' => 'n',
            'has_publish_fields' => 'n'
        );

        $this->EE->db->insert('modules', $data);
        
        $sql = "INSERT INTO exp_actions (class, method) VALUES ('Zipsearch', 'do_zip_search')";
        $this->EE->db->query($sql);
        
        return TRUE;
    }

Looking at phpmyadmin, I can see that the module does appear to be installed correctly. I can also see that the associated action ID is 27. The class is “Zipsearch” (The classname I’m using for the module class) and the method being used is “do_zip_search” which should relate to the do_zip_search() function which is present in my module class.

However, if I go to http://mysite.com/index.php?ACT=27, all I get is a blank page. If I go to ACT=10 (which is the action ID of the search module), it will perform as expected.

I’m confused because the module name, classname, constructor function and the related “do_zip_search()” function all seem to be correct.

Debugging shows that the last sql call was:

SELECT `class`, `method`
FROM (`exp_actions`)
WHERE `action_id` = '27'

Which results in the correct action class and method being shown.

I also have debugging turned on in /webroot/index.php, and I still receive a completely blank screen (no errors).

Any ideas?

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
15 years ago
Bjørn Børresen's avatar Bjørn Børresen

How does mod.zipsearch.php’s do_zip_search() method look - what does it return? If you put a die(“Hi there!”) in it, do you see that text when you go to http://mysite.com/index.php?ACT=27 ? If so you know it’s getting called, and it’s probably something wrong with the way you return the data.

       
dstechroom's avatar
dstechroom
113 posts
15 years ago
dstechroom's avatar dstechroom

woops, let this one slip by.

I have edited do_zip_search() to only return true, return false, do nothing at all and to have all the code in there I want, all with the same affect of generating a blank screen.

Iterations I’ve done:

function do_zip_search() {
   return true;
}

function do_zip_search() {
   return false;
}

function do_zip_search() {
   //do all sorts of stuff
}

function do_zip_search() {
   
}

function do_zip_search() {
   die('for the love of god, please show up');
}
       
dstechroom's avatar
dstechroom
113 posts
15 years ago
dstechroom's avatar dstechroom

well this is random, but the die() statement appears to be working.

I guess my question for setting up such actions is whether or not it needs to return true or false, or whether the action must redirect you somewhere for you to see anything at all?

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
15 years ago
Bjørn Børresen's avatar Bjørn Børresen

Yes, it should output the results (ie if you call it via ajax) or redirect you to somewhere you can see the results.

If you don’t output anything, a blank page makes sense 😊

       
dstechroom's avatar
dstechroom
113 posts
15 years ago
dstechroom's avatar dstechroom

Thanks for your help - For some reason I though it would be like a extension where it does something in the background and then continues to render the page.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.