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

Blank Page when publishing or editing a weblog with Playa and php4 (Solved)

Development and Programming

Brian Hildreth's avatar
Brian Hildreth
45 posts
16 years ago
Brian Hildreth's avatar Brian Hildreth

Hello All,

I installed the Playa extension today, and when I try to publish a weblog with a playa field, all I get is a blank white screen. I noticed that the URL is missing some data as well. If I publish a plain weblog with no playa fields, everything works and the URL looks like this:

http://www.examplesite.com/admin_login/index.php?S=0&C=edit&M=view_entry&weblog_id=12&entry_id=39&U=update

But, when I try to publish a weblog with a playa field, the URL looks like this and the screen is blank:

http://www.examplesite.com/admin_login/index.php?S=0&C=edit&M=new_entry

Has anyone ran into this before?

       
Brian Hildreth's avatar
Brian Hildreth
45 posts
16 years ago
Brian Hildreth's avatar Brian Hildreth

Okay, so I took at look at my error logs when the blank page appears and this is the error that is being thrown.

[client xxx.xx.xxx.xxx] PHP Fatal error: Call to undefined function: str_split() in /var/www/vhosts/ccialaska.com/httpdocs/cci_login/extensions/ext.playa.php on line 642, referer: http://www.ccialaska.com/cci_login/index.php?S=6964679a30d3d065e06e4cf521e2e351cf1db7ce&C=edit&M=edit_entry&weblog_id=12&entry_id=38

Does that help?

       
Brian Hildreth's avatar
Brian Hildreth
45 posts
16 years ago
Brian Hildreth's avatar Brian Hildreth

So, I still can’t get this to work with PhP4. I tried the multi-relationship fix for PhP4 that was discussed, and that did not have any affect. I still get the blank page when publishing. What is weird though is that the entry is still submitted to the database. I can go to the edit page and find the entry that was published, but the playa field does not retain the value.

I remeber reading on the previous versions of Playa that we had to place the play extension and folder into the utilities folder, do we still need to do this?

I wish I could get this working. I would just upgrade to php5, but I am currently on a DV at media temple and there are a few other sites on that server that have been there for awhile and require php4 for their CMS.

       
Brian Hildreth's avatar
Brian Hildreth
45 posts
16 years ago
Brian Hildreth's avatar Brian Hildreth

okay, so the str_split function is what is causing the problem I took the original code around line 642:

foreach(str_split($title) as $char) {
if (in_array(strtolower($char), $whitelist)) $simpleTitle .= $char;
}

and wrapped it in a if statement that checks to see if that function exisits:

if (function_exists ('str_split')) { 
        foreach(str_split($title) as $char) {
        if (in_array(strtolower($char), $whitelist)) $simpleTitle .= $char;
            }
         }

I can now publish and edit with playa fields, but only the related ID is being returned. I have been looking around for str_split replacements for php4 and haven’t found anything that works yet. Does anybody have an idea how to rewrite that function for php4?

       
Brian Hildreth's avatar
Brian Hildreth
45 posts
16 years ago
Brian Hildreth's avatar Brian Hildreth

All right, I have it figured out.

Here is my updated code to make Playa work with php4 while still playing nice with php5.

if (function_exists ('str_split')) { 
  foreach(str_split($title) as $char) {
    if (in_array(strtolower($char), $whitelist)) $simpleTitle .= $char;
        }
      } else {
        $array = explode("\r\n",trim(chunk_split($title,1)));
            foreach($array as $char) {
            if (in_array(strtolower($char), $whitelist)) $simpleTitle .= $char;
        }       
}

This would replace the original code:

foreach(str_split($title) as $char) {
   if (in_array(strtolower($char), $whitelist)) $simpleTitle .= $char;
}

I am now a happy guy that this works.

       
rick.prince's avatar
rick.prince
111 posts
16 years ago
rick.prince's avatar rick.prince

Lifesaver - thanks!

       
Brian Hildreth's avatar
Brian Hildreth
45 posts
16 years ago
Brian Hildreth's avatar Brian Hildreth

No problem, glad it helped.

       
Austin Siewert's avatar
Austin Siewert
129 posts
16 years ago
Austin Siewert's avatar Austin Siewert

Thanks for sharing Brian, I couldn’t figure out what was going on either!

       
E P Alton's avatar
E P Alton
55 posts
16 years ago
E P Alton's avatar E P Alton

Thanks so much for this! I just installed Playa and was having the same issue.

Regards, Ed

       
gcylinder's avatar
gcylinder
49 posts
16 years ago
gcylinder's avatar gcylinder

I’ve been having the same problem, but when I made the code change you suggested above, the output to the template looks like this (projectsPipeline is my Playa field name):

{REL[14][projectsPipeline]SMNxRrizREL}

[14] is indeed the right id for the entry I’m trying to pull from the Playa field. Guess it’s just the display that’s hosed. Any clue how to fix this? I’m using Playa 1.3.3, PHP 5 and the only other non-stock extension I’m using is Mark Huot’s “File” extension.

UPDATE: Turns out my hosting provider said I had PHP 5, but I didn’t. And since the Playa extension requires PHP 4, that was the problem. For anyone else having this issue, tune into Mark Huot’s post on this thread about solving the REL issue (it worked for me):

http://ellislab.com/forums/viewthread/39595/P18/#192755

       
MediaGirl Inc.'s avatar
MediaGirl Inc.
186 posts
15 years ago
MediaGirl Inc.'s avatar MediaGirl Inc.

The fix worked like a charm. Thank you for posting this for everyone else!

       

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.