Whats wrong with my php code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • teh ghey
    • Sep 2026

    #1

    Whats wrong with my php code?

    I get this error" Parse error: parse error, unexpected '=', expecting ')' in /home/content/g/h/o/ghostingadmin/html/arktos/plugins/system/comments.php on line 34

    here is the code. anyone know?

    class ContactController extends JController
    {
    /**
    * Display the view
    */
    function display()
    {
    $document =& JFactory::getDocument();

    $viewName = JRequest::getVar('view', 'category', 'default',
    'cmd');
    $viewType = $document->getType();

    // in
  • teh ghey

    #2
    this is in joomla btw

    Comment

    • teh ghey

      #3
      line 34 is function display()

      Comment

      • who
        So Fucking Banned
        • Aug 2003
        • 19593

        #4
        $document =& JFactory::getDocument();

        ->

        $document = JFactory::getDocument();

        Comment

        • teh ghey

          #5
          Originally posted by who
          $document =& JFactory::getDocument();

          ->

          $document = JFactory::getDocument();
          thank you!
          So I take something out and put that in?

          Comment

          • teh ghey

            #6
            that code didnt work. but thanks though ;/

            Comment

            • Libertine
              sex dwarf
              • May 2002
              • 17860

              #7
              Originally posted by who
              $document =& JFactory::getDocument();

              ->

              $document = JFactory::getDocument();
              No. =& is explicit reference assignment, it isn't a typo.

              teh ghey, I won't bore you with the technical details, but you are probably using PHP 4. Time to upgrade.

              As an aside: when asking for help, give the whole bloody file. Seriously.
              /(bb|[^b]{2})/

              Comment

              • teh ghey

                #8
                Originally posted by Libertine
                No. =& is explicit reference assignment, it isn't a typo.

                teh ghey, I won't bore you with the technical details, but you are probably using PHP 4. Time to upgrade.

                As an aside: when asking for help, give the whole bloody file. Seriously.
                last time I asked for help they said to just post the code block lol.
                thanks

                Comment

                • Libertine
                  sex dwarf
                  • May 2002
                  • 17860

                  #9
                  Originally posted by teh ghey
                  last time I asked for help they said to just post the code block lol.
                  thanks
                  But I'm fairly sure they meant the right code block. Which this isn't.

                  Your problem is this:
                  function onGetComments($mode, &$item, &$params=null)

                  Which is valid in PHP 5 but not in 4, since in 5 default values can be passed by reference, which they can't in 4.
                  /(bb|[^b]{2})/

                  Comment

                  • teh ghey

                    #10
                    Originally posted by Libertine
                    But I'm fairly sure they meant the right code block. Which this isn't.

                    Your problem is this:
                    function onGetComments($mode, &$item, &$params=null)

                    Which is valid in PHP 5 but not in 4, since in 5 default values can be passed by reference, which they can't in 4.
                    wow you sound good. thanks

                    Comment

                    Working...