Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:20:09+00:00 2026-05-25T15:20:09+00:00

I have a case where on my view file there are 6 links and

  • 0

I have a case where on my view file there are 6 links and clicking on them opens CJuiDialog boxes . I am keeping all the 6 dialog boxes code in the same view file along with links and that is causing the file to be big and loading them all together once .The ideal scenario is the dialog boxes should get loaded only when the use clicks on the links .

So is there any way we can keep only the links code in the main view file and keeping all the dialogue boxes in separate files and loading them only when the user clicks on the links

I mean

index.php ( view containing only links)
_dialog1 ( containing code for first dialog )
_dialog2 ( containing code for second dialog )
_dialog3 ( containing code for third dialog )
_dialog4 ( containing code for fourth dialog )
_dialog5 ( containing code for fifth dialog )
_dialog6 ( containing code for sixth dialog )

Sample Code

//First Dialog code

     $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
            'id'=>'mydialog1',
            'options'=>array(
                'title'=>'Dialog box 1',
                'autoOpen'=>false,
                'modal'=>true,      
            ),
        ));

        echo 'First dialog content here';

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

        echo CHtml::link('open dialog', '#', array(
            'onclick'=>'$("#mydialog1").dialog("open"); return false;',
        ));

//2nd dialog code 

$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
            'id'=>'mydialog2',
            'options'=>array(
                'title'=>'Dialog box 1',
                'autoOpen'=>false,
                'modal'=>true,      
            ),
        ));

        echo 'dialog2 content here';

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

        echo CHtml::link('open dialog', '#', array(
            'onclick'=>'$("#mydialog2").dialog("open"); return false;',
        ));

Solution I came with

//In controller

       public function actionOpenDialog1()
    {
        $data = array();
        $this->renderPartial('_dialogContent1', $data, false, true);
    }
       public function actionOpenDialog2()
    {
        $data = array();
        $this->renderPartial('_dialogContent2', $data, false, true);
    }

//In index.view

<div id="data">
</div>

<?php
echo CHtml::ajaxButton ("Open first dialog", CController::createUrl('dialogTesting/openDialog1'),array('update' => '#data'));

echo CHtml::ajaxButton ("Open second dialog", CController::createUrl('dialogTesting/openDialog2'),array('update' => '#data'));
?>

//_dialogContent1.php

<?php

 $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
            'id'=>'mydialog1',
            'options'=>array(
                'title'=>'Dialog box 1',
                'autoOpen'=>true,
                'modal'=>true,
            ),
        ));

        echo 'first dialog content here';

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


//_dialogContent2.php

<?php

 $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
            'id'=>'mydialog1',
            'options'=>array(
                'title'=>'Dialog box 1',
                'autoOpen'=>true,
                'modal'=>true,
            ),
        ));

        echo 'first dialog content here';

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

Thanks a lot for your help

Regards

Kiran

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:20:10+00:00Added an answer on May 25, 2026 at 3:20 pm

    My answer

    //In controller

       public function actionOpenDialog1()
    {
        $data = array();
        $this->renderPartial('_dialogContent1', $data, false, true);
    }
       public function actionOpenDialog2()
    {
        $data = array();
        $this->renderPartial('_dialogContent2', $data, false, true);
    }
    

    //In index.view

    ‘#data’));

    echo CHtml::ajaxButton (“Open second dialog”, CController::createUrl(‘dialogTesting/openDialog2’),array(‘update’ => ‘#data’));
    ?>

    //_dialogContent1.php

    $this->beginWidget(‘zii.widgets.jui.CJuiDialog’, array(
    ‘id’=>’mydialog1’,
    ‘options’=>array(
    ‘title’=>’Dialog box 1’,
    ‘autoOpen’=>true,
    ‘modal’=>true,
    ),
    ));

        echo 'first dialog content here';
    
        $this->endWidget('zii.widgets.jui.CJuiDialog');
    

    ?>

    //_dialogContent2.php

    $this->beginWidget(‘zii.widgets.jui.CJuiDialog’, array(
    ‘id’=>’mydialog1’,
    ‘options’=>array(
    ‘title’=>’Dialog box 1’,
    ‘autoOpen’=>true,
    ‘modal’=>true,
    ),
    ));

        echo 'first dialog content here';
    
        $this->endWidget('zii.widgets.jui.CJuiDialog');
    

    ?>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following case: Edited: removed link In IE7 gives me different view
I have the following case where I want to accept the following routs '/type/view/23'
I have an application with Textfields in my MainViewController.m file. There is also a
I have a custom UIViewController inited from a nib file with the following view
Is there something wrong with the .dll file? Shouldn't it just consider the code
I have a controller called votes_controller.rb . In that file there is the following
I have a table view with a data source/delegate in another file. In addition,
Is there any way to make a single View (in this case a TextView)
I have successfully loaded a view from an xib file on to a window(another
Problem description: I have a view with set of links: <% @feeds.each do |f|

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.