1

I have the following directory structure:

-> views

---> product
  |- view.php
  |- gridView.php

---> site
  |- index.php

gridView.php is a partial view that I wish to use in index.php under site. If I copy gridView.php to site/gridView.php, the following works:

<?php
  $this->widget('zii.widgets.CListView', array(
    'dataProvider'=> $dataProvider,
    'itemView' => 'gridView',
    'summaryText' => '',
    'emptyText' => '
    ', 
  ));
?>

But if I only leave a copy under /product/, the above does not work.

How can I get the index.php view to work using the same gridView.php file located in product? I've tried the following, but it does not work:

<?php
  $this->widget('zii.widgets.CListView', array(
    'dataProvider'=> $dataProvider,
    'itemView' => 'product/gridView',
    'summaryText' => '',
    'emptyText' => '
    ', 
  ));
?>

Any ideas?

tereško
  • 58,060
  • 25
  • 98
  • 150
rockstardev
  • 13,479
  • 39
  • 164
  • 296

1 Answers1

1

If you want to access views from another controller you should always preceed the view name with a / followeed by the controller ID. So in your case that's /product/gridView.

Michael Härtl
  • 8,428
  • 5
  • 35
  • 62