Jump to content
MuchDev

Strange white screen problem

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;
	}
?>

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

ACK I'll be damned that is exactly what it was, deleted the closing ?> and all is well. Figured the compiler would pick something like that up. Thanks dude!

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...