Re: Problem using return from a class.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 9 Feb 2005 16:12:58 +0800, Jason Wong <php-general@xxxxxxxxxxxx> wrote:
> On Wednesday 09 February 2005 01:33, Ben Edwards (lists) wrote:
>
> > > Maybe you should post a bit of code to illustrate your problem ;)
> >
> > I'me just doing:-
> >
> >   return $radio_html;
> >
> > as the last line of the method.
> >
> > If I do
> >
> >   echo $radio_html;
> >
> > The condense of the variable gets outputted.
> >
> > I could post the method here but its a bit long.
>
> You only need to post concise code that illustrates your problem, a one
> liner to return a value is all the that your method needs.

All I woul post them would be 'retrun $radio_htlm'  I will post the
end of the method:

    if ( $columns == 0 ) {
      $radio_html .= $this->manditoryStar( $manditory );
    } else {
          if ( $manditory ) {
                $radio_html .=
                        "<tr><td colspan=$columns><p class=NormalText
><font color=red size=+1>" .
                        "*</font> You must select at least one option" .
                        "</font></p></td></tr>";
          }
      $radio_html .= "</table>";
    }

        $radio_html .= "\n\n<!--nend presenter.renderRadioReal-->\n\n";

        // really nagst hack as rtturn not working
        echo $radio_html;
        return $radio_html;

    ++$index;
  }

This works becouse I echo the varable, but not ideal.  The method call
is echo $object->method(...).  If the return was working I would get
the code returned twice, but I only get it returned once.  without the
'nasty hack' I get nothing;(.

Ben

> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> New Year Resolution: Ignore top posted posts
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> 
> --
> Ben Edwards - Bristol, UK, England
> WARNING:This email contained partisan views - dont ever accuse me of
> using the veneer of objectivity
> If you have a problem emailing me use
> http://www.gurtlush.org.uk/profiles.php?uid=4
> (email address this email is sent from may be defunct)
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux