I’m using YiiStrap + YiiWheels. Has anyone encountered this error:
include(TbHtml.php): failed to open stream: No such file or directory
while putting yiiWheel’s grid view widget before yiistrap’s modal widget
<?php //Create grid view
$this->widget('yiiwheels.widgets.grid.WhGridView', array(
'filter'=>$dataProvider,
'fixedHeader' => true,
'headerOffset' => 40, // 40px is the height of the main navigation at bootstrap
'type'=>'striped bordered',
'dataProvider' => $dataProvider->search(),
'template' => "{items}",
'columns' => $gridColumns,
));
<?php //Create modal
$this->widget('bootstrap.widgets.TbModal', array(
'id'=>'myModal',
//header/title of modal
'header' => 'Sample Modal',
//modal content
'content' => 'content',
//footer where the modal's buttons are located
'footer' => array(
TbHtml::button('Close', array('data-dismiss' => 'modal')),
TbHtml::button('Create', array('data-dismiss' => 'modal', 'color' => TbHtml::BUTTON_COLOR_PRIMARY)),
),
));
?>
<?php //Button that opens modal
echo TbHtml::button('Create New Transaction', array(
'style' => TbHtml::BUTTON_COLOR_PRIMARY,
'size' => TbHtml::BUTTON_SIZE_LARGE,
'data-toggle' => 'modal',
'data-target' => '#myModal',
));
?>
It’s weird 'cause when I place the modal widget before the grid view widget, everything works just fine. is this some kind of bug? Do you guys have any idea how to fix this?
Ummm… I think this has gone a bit weirder. I tried placing the modal widget before and after the gridview widget and everything rendered perfectly (both modals worked). But when I remove the widget before the gridview, the error is produced. Any insights on this one? I’m a bit confused now…
Sorry. It’s not the modal that’s wrong, it’s the TbHtml::button(). But still, the error is produced when I placed my button after the gridview widget. somehow the web app couldn’t see the TbHtml.php.
I imported the TbHtml.php right after the gridview widget.
<?php //Create grid view
$this->widget('yiiwheels.widgets.grid.WhGridView', array(
'filter'=>$dataProvider,
'fixedHeader' => true,
'headerOffset' => 40, // 40px is the height of the main navigation at bootstrap
'type'=>'striped bordered',
'dataProvider' => $dataProvider->search(),
'template' => "{items}",
'columns' => $gridColumns,
));
?>
<?php
Yii::import('bootstrap.helpers.TbHtml');
?>
<?php //Button that opens modal Create Transaction
echo TbHtml::button('Create New Transaction', array(
'style' => TbHtml::BUTTON_COLOR_PRIMARY,
'size' => TbHtml::BUTTON_SIZE_LARGE,
'data-toggle' => 'modal',
'data-target' => '#scdCreateTransaction-modal',
));
?>
I did try importing the TbHtml class before the gridview widget but the error is still produced. It would be great if someone could explain this. Could this have anything to do with the yiiwheel widget being read first or something?