CJUi not showing

Hi!

I have copied example from webpage




$this->beginWidget('zii.widgets.jui.CJuiDialog', array(

    'id'=>'mydialog',

    // additional javascript options for the dialog plugin

    'options'=>array(

        'title'=>'Dialog box 1',

        'autoOpen'=>false,

    ),

));


    echo 'dialog content here';


$this->endWidget('zii.widgets.jui.CJuiDialog');


// the link that may open the dialog

echo CHtml::link('open dialog', '#', array(

   'onclick'=>'$("#mydialog").dialog("open"); return false;',

));



I have put it into my view and it doesn’t work.

I have put it into layout it didn’t work, until I removed everything (event <body></body>).

It is very strange, but when I add <body> tags, CJUI doesn’t work:




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>	

	<title><?php echo CHtml::encode($this->pageTitle); ?></title>

</head>

<body>

<?php

	

$this->beginWidget('zii.widgets.jui.CJuiDialog', array(

    'id'=>'mydialog',

    // additional javascript options for the dialog plugin

    'options'=>array(

        'title'=>'Dialog box 1',

        'autoOpen'=>false,

    ),

));


    echo 'dialog content here';


$this->endWidget('zii.widgets.jui.CJuiDialog');


// the link that may open the dialog

echo CHtml::link('open dialog', '#', array(

   'onclick'=>'$("#mydialog").dialog("open"); return false;',

));?>

</body>

</html>



Unless you are adding this to views/layouts/main.php, there shouldn’t be anything like this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>  

        <title><?php echo CHtml::encode($this->pageTitle); ?></title>

</head>

<body>

If that IS your main layout file then it isn’t loading JQuery or any css files, which are needed by the widget.

Look at the html in the default protected/views/layouts/main.php file to see how it should look.

I have removed css as I am using bootrstrap widget.

Now I have found out that when I add bootstrap in my preload then CJUi is not working. When I remove it, it works.