Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorsuthern
    • CommentTimeMar 14th 2008
     

    Is this normal? Try putting this function in your controller (any controller) and try accessing any methods that use that controller. ;-)

    function auto_complete_for_spot_find_spot() { // simple thing here ?> }

    When I do it, I get a white (error) screen. This makes it hard test functions that return strings of inline php (like ajax responses). Does anyone else have their app crash by putting the above function in a controller? Thanks!

    • CommentAuthorThijs
    • CommentTimeMar 14th 2008
     

    I get an

    Parse error: syntax error, unexpected $end in /Applications/MAMP/energy neighbourhoods/app/controllers/discussion_controller.php on line 122

    line 122 being the last line in the file (where the ?> is) and not the line where

    // simple thing here ?>
    

    is.

    I'm on changeset 479 from the trunk.

    • CommentAuthorJeff
    • CommentTimeMar 15th 2008
     

    PHP parser terminates php code blocks at ?>, including inside comments.

    So this would be valid code:

     <?php echo "Hello World"; // "blahblah"; ?>
    

    However, with your code posted above, the closing curly brace isn't enclosed in php tags, so it isn't parsed. Yes, it's annoying. Simply remove the ?> from your comment or use the muti-line comments: /* */.

    Refer to the PHP documentation

    • CommentAuthorsuthern
    • CommentTimeMar 17th 2008
     

    Ahh, I see why it's this way. I'll use multi-line comments in these special cases.

    Thanks!

Add your comments
    Username Password
  • Format comments as