Jump to content

Strange white screen problem


MuchDev
 Share

Recommended Posts

Hello hello. 
I am working on a fairly simple little utility module at the moment that hooks to Pages::saveReady. The issue is that when this module is active I am unable to access most of processwire unless I manually navigate to it. If I load a page like https://www.domain.com/processwire and the page performs a redirect I see a white screen. Clicking through and loading and even saving pages also causes a white screen. I have been trying to replicate this locally but of course the simple module performs perfectly. I have tried restoring the db and loading a new version of processwire and no dice. I am also running an exact copy of the db locally with a copy of the modules directory as well and am not getting this issue locally.  

Anyone see anything here that I should investigate? Weird things I don't know about php? Version issues?

**Edit**

I have just created a template using this exact code and it runs properly as well without any errors on my live site. 

 

<?php
class ApplyShippingClass extends WireData implements Module {

	public static function getModuleInfo() {
        return array(
            'title' => 'Apply Shipping Class When Page Saves',
            'version' => 006,
            'summary' => '',
			'singular' => true, 
			'autoload' => true,
            'href' => '',
        );
    }

    public function init() {
        $this->addHookAfter('Pages::saveReady', $this, 'applyClass');
    }

    function getSizeClassTitle($item)
    {
          //Max widths or heights to align with sizing classes

          $sizes =
              Array(
                  0 => Array(
                      'Value' => 6,
                      'Name' 	=> 'X-Small (0" - 6")'
                  ),
                  1 => Array(
                      'Value' => 12,
                      'Name' 	=> 'Small (6" - 12")'
                  ),
                  2 => Array(
                      'Value' => 24,
                      'Name' 	=> 'Medium (12" - 24")'
                  ),
                  3 => Array(
                      'Value' => 40,
                      'Name' 	=> 'Large (24" - 40")'
                  ),
                  4 => Array(
                      'Value' => PHP_INT_MAX ,
                      'Name' 	=> 'X-Large (40"+)'
                  ),	
          );

          for($i = 4; $i > 0; $i--)
          {
              if($item->artwork_width < $sizes[$i]['Value'] && $item->artwork_height < $sizes[$i]['Value']) 
              {
                  $largest = $sizes[$i]["Name"];
              }
          }

          return $largest;
	}
?>

 

Link to comment
Share on other sites

I can't spot anything wrong, but try to re-upload the file to the live site and make sure that there is no linefeed conversion active. Also, you should probably remove the closing php tag (?>), as it might simply be an issue of trailing (and perhaps even invisible) characters after that tag.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...