basically:
<?php $this->widget('CLinkPager', array(
'pages' => $pages,
)) ?>
when render: 'Go to page:...'
i want to push 'Go to page: ' to my element (ext: Go to page), somebody can help me?
If I am not wrong you might want to access the header property of CLinker page which defaults to Go to page
<?php $this->widget('CLinkPager', array(
'pages' => $pages,
'header'=> 'whatever you want'
)) ?>
Related
On my site I have panel control and some content. Site is build on Yii framework.
panel menu:
<?php
$this->breadcrumbs=array(
'Muzyka media'=>array('admin'),
'Lista',
);
$this->renderPartial('_submenu',array('model'=>$model));
?>
and content:
<?php
$this->widget('bootstrap.widgets.TbGridView',array(
'id'=>'muzyka-media-grid',
'type'=>'stripped bordered condensed',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'name',
array(
'name'=>'mime_type',
'value'=>array($this,'displayMediaContent'),
'type'=>'raw',
'htmlOptions'=>array('class'=>'span3'),
'filter'=>CHtml::listData(MuzykaMedia::model()->findAll(),'mime_type','mime_type'),
),
'file_extension',
array(
'name'=>'file_size',
'filter'=>false
),
'count_views',
array(
'class'=>'bootstrap.widgets.TbButtonColumn',
),
),
));
?>
Both parts work separately but for some reason I can't see, when put one after another the sub-menu doesn't render.
Your code is definitely Yii1.1. If you're rendering partial views from inside another view, as you seem to be doing here, then you need to echo the result, so your code should look like this;
<?php
$this->breadcrumbs=array(
'Muzyka media'=>array('admin'),
'Lista',
);
echo $this->renderPartial('_submenu',array('model'=>$model));
?>
I am trying to achieve the link as cake_proj/prefix2/controller2/action on this page who's link is - cake-proj/ but 'prefix1' => true in my routes.php as this is the home page, so ultimately its link is cake_proj/prefix1/controller1/action. So now I am trying to achieve cake_proj/prefix2/controller2/action with the help of Html helper's link method-
<?php
echo $this->Html->link(
'<i class="glyphicon glyphicon-group"></i> Test Link', array(
'prefix' => 'prefix2',
'controller' => 'controller2',
'action' => 'prefix_action'), array(
'escape' => FALSE)
);
?>
But with this I am getting the link as cake_proj/prefix1/controller2/prefix_action notice here it doesn't change the prefix. I don't want to loose the CakePHP's routing capability, but still want to get over this problem. I referred some of the previously answered questions but not worked for me. Please help.
A solution for you.. though not tested works perfectly for me. Here is the solution, cheers!
in AppController.php
public function beforeFilter() {
$this->set('prefixUsed',$this->request->prefix);
}
in your_view.ctp
<?php
echo $this->Html->link(
'<i class="glyphicon glyphicon-group"></i> Test Link', array(
$prefixUsed => false,
'prefix2' => true
'controller' => 'controller2',
'action' => 'prefix_action'), array(
'escape' => FALSE)
);
?>
Here the idea is to set a variable $prefixUsed in AppController.php to be used by each and every views and even by layouts in beforeFilter(), and then using that variable into views to set it to false and making your desired 'prefix' => true. We are using $prefixUsed to dynamically determine the prefix. Let me know if this worked or not for you, till then GoodBye... ;)
I have recently built some admin dashboard for managing projects and blog posts together. I wanted to put both in one dashboard and show as two tables with pagination. So in controller, I put something like this:
$this->Paginator->settings = array(
'Project'=>array(
'limit' => 10,
'order' => array(
'Project.created_time' => 'desc'
),
'paramType' => 'querystring'
),
'Post'=>array(
'limit' => 10,
'order' => array(
'Post.created_time' => 'desc'
),
'paramType' => 'querystring'
)
);
$projects = $this->Paginator->paginate('Project');
$posts = $this->Paginator->paginate('Post');
$this->set('projects', $projects);
$this->set('posts', $posts);
and in the view I use
<?php echo $this->Paginator->numbers(array('model'=>'Post')); ?>
and
<?php echo $this->Paginator->numbers(array('model'=>'Project')); ?>
to manage the pages link of each model.
But the problem is when I click one page link, the other one is changing to that page as well. The url only give the paged link as dashboard?page=5
Is there anyway that I can access them separately? Like dashboard?project_page=5 ordashboard?post_page=5.
Thanks for any ideas.
I have a Yii Layout, called Main, it loads all the CSS and the JavaScript, correctly ordered.
So, i have two views, one just have pure HTML, and the other one have something like this :
<?php
$dataProvider=new CActiveDataProvider('agenda');
$dataProvider->pagination->pageSize=5;
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'enablePagination'=>true,
'itemView'=>'_agenda', // refers to the partial view named '_agenda'
'pager' => array(
'class' => 'CLinkPager',
'header' => false,
'htmlOptions' => array('class' => 'pager'),
'maxButtonCount' => '10',
'cssFile'=>'css/my.css',
),
));
?>
My problem :
The second one throw this exception Undefined is not a function and aim to the line with $(document).foundation(); in the code.
Is the only error it throws, and both have the same JavaScripts and CSS imported.
They are incompatible?
Solved, i just had conflicts with the Foundation's jQuery and Yii's jQuery.
The solution is just use this at top :
<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>
Remove others jQuery and move the foundation.min.js to the bottom.
I have breadcrumbs such as Home > Instance > Action in all my view pages. How can I remove the 'Home' link from all the breadcrumbs?
$this->breadcrumbs=array(
'Keypairs'=>array('admin'),
'Manage',
);
This can be done by setting the homeLink property to false, in your CBreadcrumbs widget initialization. This is usually done in a layout file.
In the default Yii app, in protected/views/layouts/main.php:
<?php if(isset($this->breadcrumbs)):?>
<?php $this->widget('zii.widgets.CBreadcrumbs', array(
'links'=>$this->breadcrumbs,
'homeLink'=>false // add this line
)); ?><!-- breadcrumbs -->
<?php endif?>
in layouts/main.php add 'homeLink' => false
<?= Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs'])? $this->params['breadcrumbs'] : [],
'homeLink' => false
]) ?>