如何更改cakephp视图中的默认标记路径


How to change the default tag path in cakephp views

我有一个小问题与Cakephp 2.1.3的图像路径。现在我必须使用:

<td background="../../img/login25.png" width="22" height="15"></td>

我需要在我的视图中设置所有标签的路径。我怎样才能在我的视图中改变路径,这样我就可以使用:

 <td background="login25.png" width="22" height="15"></td>

谁能告诉我们在哪里以及怎么做?我找了几个小时,但我能找到的只是$this->Html函数的路径。由于

…我可以建议另一种方法,在样式表中使用CSS设置背景图像吗?然后这些路径将是相对于样式表位置的。

'background'不是td元素的有效属性。

我甚至不会问你用表做什么!: -)

use css code to call file in td with id or class.

<td class="myimage" width="22" height="15"></td>
use the css code bellow in .css file you are calling or create css file and save to app/webroot/css/ directory.
.myimage { 
  background: url("pathtoimgfolder/b_grijs_a.png");
 }
 For Example : I want to use image from app/webroot/img/a.png
 so I am using :
.myimage { 
   background: url("../img/a.png");
}

:)快乐编码

找到了:

 <td background="<?php echo $this->webroot; ?>img/login25.png"  width="22" height="15"></td>