CakePHP:图像里面的链接,想把链接指向图像位置(CakePHP: image inside link, want to make link point to image location)
我在链接中有一些图像,我基本看起来像这样:
<a href="/path/to/img.png"><img src="/path/to/img.png" /></a>
点击链接应该加载它包含的图像。 我正在尝试使用CakePHP的HTML帮助程序来执行此操作,如下所示:
<?php echo $html->link( $html->image('img.png'), 'img.png', array('escape' => false) ); ?>
但是,当我这样做时,我得到以下代码:
<a href="/pages/img.png"><img src="/path/to/img.png" /></a>
如果不使用绝对URL ,我可以将链接的
href
属性指向图像的正确位置吗?谢谢!
I have some images inside links that I want to essentially look like this:
<a href="/path/to/img.png"><img src="/path/to/img.png" /></a>
Clicking on the link should load the image it contains. I'm trying to use CakePHP's HTML helper to do this, as follows:
<?php echo $html->link( $html->image('img.png'), 'img.png', array('escape' => false) ); ?>
When I do this, however, I get the following code:
<a href="/pages/img.png"><img src="/path/to/img.png" /></a>
Without using absolute URLs, can I make the link's
href
attribute point to the image's correct location?Thanks!
原文:https://stackoverflow.com/questions/1878301
最满意答案
当您预先设定一个值而没有为其分配密钥时,该集合会被重新键入。
Laravel prepend允许您传递第二个参数作为密钥。
所以你会想要像这样的东西:
$rostersList->prepend('Select Roster', '');
When you prepend a single value without assigning a key with it, the collection gets re-keyed.
Laravel prepend lets you pass a second parameter to use as the key.
So you would want something like:
$rostersList->prepend('Select Roster', '');
相关问答
更多-
好的,所以你希望总数取决于当月的组。 这是每个月的总数,Atleast这就是我的理解。 如果这就是你想要的那么你几乎就在那里,只需将你的表达范围改为组名 =Sum(IIf(Fields!statusfld.Value = "Booking",Fields!Booking.Value,nothing),"yourGroupname") 这将为您提供每个列组的总计。 或者您可以尝试以下方法 - 添加列组的总计在Tablix数据区域行组区域中,右键单击要为其总计的列组区域中的单元格,然后指向“添加总计”,并 ...
-
ID为CSV的值的CSV(CSV of IDs to CSV of Values)[2023-11-08]
尝试这个 SELECT ID, things = STUFF( ( SELECT ',' + t2.thing FROM Table2 AS t2 INNER JOIN Table1 AS ti ON ',' + ti.ids + ',' LIKE '%,' + CONVERT(VARCHAR(12), t2.id) + ',%' WHERE ti.ID = tout.ID FOR XML PATH, TYPE ).value('.[1]', 'nvarcha ... -
?apply描述的第一句话说: 如果X不是一个数组而是具有非空dim值的类的对象(如数据框),则应用尝试通过as.matrix将它强制转换为数组(如果它是二维的)(例如,数据帧)或通过as.array。 在R中矩阵只能是单一类型。当数据帧被强制为矩阵时,如果甚至有单个字符列,则所有内容都会以字符形式结束。 我想我欠你一个替代的描述,所以你走了。 数据框实际上只是列表,所以如果你想对每列应用一个函数,请使用lapply或sapply 。 The first sentence of the descriptio ...
-
没有使用循环或递归或访问所述数组的特定元素,没有本机方式来回显数组。 你也不正确地使用each函数,因为它返回一个键/值对作为结果(并且你没有捕获循环的结果。)你应该做这样的事情: $test = 1 ; foreach ($video_IDs as $v) { echo "{$test} - {$v}
"; $test++; } 如果你必须使用each ,这里是对原始代码的轻微更改,以便键/值对在每次迭代时都存储在$v $test = 1 ; while ($v = each( ... -
当您预先设定一个值而没有为其分配密钥时,该集合会被重新键入。 Laravel prepend允许您传递第二个参数作为密钥。 所以你会想要像这样的东西: $rostersList->prepend('Select Roster', ''); When you prepend a single value without assigning a key with it, the collection gets re-keyed. Laravel prepend lets you pass a second p ...
-
最好的是转置值,转换为numpy array并最后list s: result_temp = result.T.values.tolist() 我认为你可以使用list comprehension按列名称循环,并按[]按名称选择每个列并转换为list : result_temp = [result[x].tolist() for x in result.columns] 它是一样的: result_temp = [] for x in result.columns: result_temp.ap ...
-
使用pivot或unstack : df = df.pivot(index='Col1',columns='Col2',values='Col3') print (df) Col2 lmn pqr xyz Col1 A NaN 2.0 1.0 B 1.0 3.0 2.0 C NaN 2.0 NaN df = df.set_index(['Col1','Col2'])['Col3'].unstack() print (df) Col2 ...
-
您可以将第二个参数传递给lists ,这将设置生成的数组的键: $query = DB::table('friends')->where('id', $x)->orWhere('friendid', $x); $results = $query->lists('friendid', 'id); 如果您想将它全部作为单个数组的值,请使用: $query = DB::table('friends')->where('id', $x)->orWhere('friendid', $x); $ids = [ ...
-
create_list在循环内调用malloc 。 如果循环内的malloc在前N次是正确的,但是N + 1次失败,则返回NULL ,从而从前N个malloc中泄漏内存。 所以这显然是create_list中的一个错误,我希望valgrind能够报告这个错误。 你需要像这样的东西: if (n == NULL) { clear(&list); return NULL; /* we just return NULL if memory allocation fails */ } 除此之外, ...
-
使用ROW_NUMBER排名功能 - http://technet.microsoft.com/en-us/library/ms186734.aspx DECLARE @Offset INT = 9 SELECT ID , ROW_NUMBER() OVER (ORDER BY ID) + @Offset FROM Table Use the ROW_NUMBER ranking function - http://technet.microsoft.com/en-us/li ...