One view that echos only a 0 or 1

Dear people,

For a project I have a script that makes a request to an off-site webservice (SOAP) to get data. This data is copied into the local database. If all goes well, it needs to return a single value: 1 (or 0 in case of error). If possible, I want to make use of all the nice Yii helper classes. So I thought make a controller that invokes the script and then return a value through a view. The view has no layout and I was hoping that there would be only the echoed returned value. But I overlooked the preloaded modules/extensions that publishes stuff (needed in all the other views of course). Therefore a full HTML document is returned.

Is there a way to override all the preloading stuff to not load for this single view? Or can the value be returned another way, perhaps through the contoller skipping the view right to the applicant?

Hopefully someone can help me out here!

Greetings

you can simply set a blank layout for your view:

$this->layout=’//layouts/blankLayout’;

but views are for showing results, not sending them

please explain why you want to do this, and where you want to send this single value?

I think renderPartial just loads the view:

http://www.yiiframework.com/doc/api/1.1/CController#renderPartial-detail

Why use a view at all?

Instead of


$this->render('some_view');

Why not


$result = 1; // $result equals 1 or 0


echo $result;

?

You want to use renderPartial and then set the third variable to true, which will allow you to store the results in a variable of your own.

Thanks!

This I overlooked indeed. There is no need for a ‘view’ so I will return the value instead of rendering a view.

:D