Yii Framework Forum: Widget prints extra content, why? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Widget prints extra content, why? Rate Topic: -----

#1 User is offline   mudlee 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 07-February 11

Posted 13 May 2011 - 12:41 PM

Hi all!
I'll try to write my problem with many details, but I can't show all of my codes.
First of all, here is the view, add.php which contains a widget:
<div class="box grid_8 round_all"><?php $this->widget('application.components.global.widget.AddOrder',array('form'=>$form));?></div>

Here is the run function of the widget php, which is important:
public function run()
	{
		switch(Yii::app()->user->partner_group_id)
		{
			case PartnerGroupType::_DEFAULT:
				$order_default=new OrderDefault();
				$this->_string=$this->render('application.views.order._addGlobalFreight',array(
					'order_default'=>$order_default,
					'form'=>$this->form
				));
				break;
		}
	}

And here is the widget template first line:
<h2 class="box_head grad_colour">

More info for the template: the first line hasnt got any character before the h2 opening tags.

My problem is, when I see the source of the page, the widget generates some extra character which is my problem in the design. I have tried var_dump the render function result in the run function, and I saw these characters before the var_dump content!
I have attached a screenshot.
My question is, what is that? Where is the bug?
Many thanks!
mudlee

Attached File(s)

  • Attached File  sc1.jpg (148.15K)
    Number of downloads: 17

0

#2 User is offline   Asgaroth 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 371
  • Joined: 17-July 09
  • Location:Bogota, Colombia

Posted 13 May 2011 - 01:10 PM

Is there anything in the AddOrder class before teh declaration maybe, or after? can you attach that class please?
- Extension: Dynamic DataProvider Behavior
- Extension: XUpload - jQuery File Upload Extension
- Extension: PhpQuickProfiler - A Web Log Router that will help you profile your application
- Extension: XDateView - A Date grouped Grid View
- Extension: Foundation - An easy to use, powerful, and flexible framework for building prototypes and production code on any kind of device.



- Wiki: How to generate Yii like Documentation
- Wiki: How to re enable logging during unit testing
0

#3 User is offline   mudlee 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 07-February 11

Posted 13 May 2011 - 02:01 PM

View PostAsgaroth, on 13 May 2011 - 01:10 PM, said:

Is there anything in the AddOrder class before teh declaration maybe, or after? can you attach that class please?


Nothing. The class has a private $_string(which contains the render result) and public $form (which comes from the add.php). Thats all.
0

#4 User is offline   PoL 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 506
  • Joined: 05-November 08
  • Location:Buenos Aires, Argentina

Posted 13 May 2011 - 03:31 PM

do you try to user renderPartial instead?
Don't say what you think, think what you say
The problem is communication! Excess of communication!
0

#5 User is offline   Asgaroth 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 371
  • Joined: 17-July 09
  • Location:Bogota, Colombia

Posted 13 May 2011 - 06:19 PM

View PostPoL, on 13 May 2011 - 03:31 PM, said:

do you try to user renderPartial instead?


There is no renderPartial in a widget... is there?
- Extension: Dynamic DataProvider Behavior
- Extension: XUpload - jQuery File Upload Extension
- Extension: PhpQuickProfiler - A Web Log Router that will help you profile your application
- Extension: XDateView - A Date grouped Grid View
- Extension: Foundation - An easy to use, powerful, and flexible framework for building prototypes and production code on any kind of device.



- Wiki: How to generate Yii like Documentation
- Wiki: How to re enable logging during unit testing
0

#6 User is offline   mudlee 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 07-February 11

Posted 14 May 2011 - 01:34 AM

View PostAsgaroth, on 13 May 2011 - 06:19 PM, said:

There is no renderPartial in a widget... is there?

Yes, we can't use it.
0

#7 User is offline   mudlee 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 07-February 11

Posted 14 May 2011 - 01:48 AM

I have tried an another thing, but it is very ... I can't find the word :D
So, i put into the template a simple text, for example: "ASD"
with this simple text, it's ok, I don't see the wrong characters.
But when I start the template with a html tag... I don't understand... :)
I've attached a screenshot again

Attached File(s)

  • Attached File  error.jpg (58.2K)
    Number of downloads: 15

0

#8 User is offline   mudlee 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 07-February 11

Posted 14 May 2011 - 03:24 AM

I saved the page, and in the source, I found this: ďťżďťż
But I didn't put into my code? I don't know where is it..
0

#9 User is offline   mudlee 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 07-February 11

Posted 14 May 2011 - 03:41 AM

I found the problem... the view file starting with these characters...
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users