开发者

CakePHP Pagination with Image

开发者 https://www.devze.com 2023-01-13 00:57 出处:网络
I have this code for previous arrow from HTML coder <img src=\"<?=$this->webroot?>img/arrow_button_prev.png\" alt=\"Previous Event\"

I have this code for previous arrow from HTML coder

<img src="<?=$this->webroot?>img/arrow_button_prev.png" alt="Previous Event"
        style="opacity:1.0;filter:alpha(opacity=100); " onmouseover="this.style.opacity=0.7;this.filter.alpha.opacity=70" 
        onmouseout="this.style.opacity=1.0;this.filter.alpha.opacity=100" />

And I need to rigg that image into pagination

 <?php echo $this->Paginator->prev('<< ' , array(), null, array('class'=>'di开发者_JAVA百科sabled'));?>

I tried to replace the << with the img tag and It outputs HTML codes. How can I achieve this?


Try this:

<?php
echo $this->paginator->prev($html->image('arrow_button_prev.png'), array('escape' => false), null, array('class'=>'disabled'));
?>


Try this for CakePHP 1.3: Ex: prev button:

<?php 
    $prev_img = $html->image("button/compare-slider-btn-l.png", array("width" => "31px", "height" => "90px", "id" => "cmp_slider_click_l"));
    echo $this->Paginator->prev(!$this->Paginator->hasPrev() ? null : $prev_img, array('escape' => false), !$this->Paginator->hasPrev() ? __($prev_img, false) : null, array('class'=>'disabled'));
?>


You will need to set "escape"=>false to prevent image tag being escaped.

0

精彩评论

暂无评论...
验证码 换一张
取 消