Odoo博客封面图片没有显示(Odoo blog cover image not showing)

我创建了自定义的最新博客模板。 但我无法在缩略图中显示封面图片。

封面图片应该在这里:

在这里输入图像描述

我已经编写了以下代码来显示封面图片:

<div class="panel">
    <t t-set="properties" t-value="json.loads(post.cover_properties)">
       <a class="o_panel_cover" t-attf-href="#{blog_url('', ['blog', 'post'], blog=post.blog_id, post=post)}" t-att-style="background-image: #{cover_properties.get('background-image')};">
       </a>
    </t>
    <div class="panel-heading mt0 mb0">
        <h4 class="mt0 mb0">
          <a t-attf-href="#{blog_url('', ['blog', 'post'], blog=post.blog_id, post=post)}" t-field="post.name"></a>
          <span t-if="not post.website_published" class="text-warning">
             <span class="fa fa-exclamation-triangle ml8" title="Unpublished"/>
          </span>
        </h4>
    </div>

写入代码图像后不加载,它显示如下:

在这里输入图像描述

我如何显示图像?


I have created custom latest blog template. But I can't show cover images in thumbnails.

Cover image should be here:

enter image description here

I have written following code to show the cover image:

<div class="panel">
    <t t-set="properties" t-value="json.loads(post.cover_properties)">
       <a class="o_panel_cover" t-attf-href="#{blog_url('', ['blog', 'post'], blog=post.blog_id, post=post)}" t-att-style="background-image: #{cover_properties.get('background-image')};">
       </a>
    </t>
    <div class="panel-heading mt0 mb0">
        <h4 class="mt0 mb0">
          <a t-attf-href="#{blog_url('', ['blog', 'post'], blog=post.blog_id, post=post)}" t-field="post.name"></a>
          <span t-if="not post.website_published" class="text-warning">
             <span class="fa fa-exclamation-triangle ml8" title="Unpublished"/>
          </span>
        </h4>
    </div>

After writing the code image not loading and it shows like this:

enter image description here

How can I show the image?


原文:https://stackoverflow.com/questions/40797953
2023-04-02 09:04

满意答案

尝试从图像中删除escape => false ,并在图像之前添加斜杠作为其相对于app/webroot文件夹的斜杠,如下所示:

echo $this->Html->link(
    $this->Html->image('/<your-img-folder>/logo.png',array('height' => '100', 'width' => '100')),
    array(
        'controller' => 'zones', 
        'action' => 'index'
    ), array('escape' => false)
);

try removing escape => false from your image, and add slash before your image as its relative to your app/webroot folder , as:

echo $this->Html->link(
    $this->Html->image('/<your-img-folder>/logo.png',array('height' => '100', 'width' => '100')),
    array(
        'controller' => 'zones', 
        'action' => 'index'
    ), array('escape' => false)
);

相关问答

更多

cakephp分页链接#hash(cakephp pagination link with #hash)

在第三个参数中,您可以指定一个url键,该键与分页URL合并。 路由器接受#键,所以你可以尝试这样的事情: echo $this->Paginator->sort('name', 'Name', array( 'url'=> array( '#' => 'dist' ) )); In the third parameter you can specify a url key, which is merged with the pagination url. The router ...

CakePHP链接帮助(CakePHP Link Help)

http://book.cakephp.org/view/1442/link $title HTML特殊字符将被转换为HTML实体。 要禁用此转换,请在$options数组中将escape选项设置为false 。 http://api.cakephp.org/class/html-helper#method-HtmlHelperlink 选项 escape设置为false以禁用标题和属性的转义。 echo $this->Html->link('<span>Log in</span>', '/', ...

CakePHP中的图像链接(Image link in CakePHP)

尝试从图像中删除escape => false ,并在图像之前添加斜杠作为其相对于app/webroot文件夹的斜杠,如下所示: echo $this->Html->link( $this->Html->image('/<your-img-folder>/logo.png',array('height' => '100', 'width' => '100')), array( 'controller' => 'zones', 'action' =>...

在Cakephp HTMLhelper中使用$ confirmMessage警报的图像链接 - 可能吗?(Image link with $confirmMessage alert in Cakephp HTMLhelper - possible?)

CakePHP使用Html助手做到了这一点,你真的很亲密! <?php echo $this->Html->link($this->Html->image('clearall.png', array( 'alt' => 'Clear list') ), array( ...

如何生成'a href =“javascript:void(0)”'像cakephp中的链接?(How to generate 'a href=“javascript:void(0)”' like link in cakephp?)

<?php echo $this->Html->link( '/path/to/image/', 'javascript:void(0)' ); ?> 您可以设置图像的路径,也可以使用Html帮助程序生成图像标记代码。 第二个参数将设置href。 <?php echo $this->Html->link( '/path/to/image/', 'javascript:void(0)' ); ?> Y...

CakePHP:图像里面的链接,想把链接指向图像位置(CakePHP: image inside link, want to make link point to image location)

这应该可以做到这一点: echo $html->image('image.png', array('url' => '/' . IMAGES_URL . 'image.png')); This should do the trick: echo $html->image('image.png', array('url' => '/' . IMAGES_URL . 'image.png'));

在HTML中无法识别Cakephp链接(Cakephp Link is not recognized in HTML)

解决方案 :这不是PHP问题而是CSS问题...特别是我的Jquery插件(ImageViewer)中的z-index问题rolley HTML的模式是: <article><div class="info"><nav></nav</div></article><article><div class="info"><nav></nav</div></article><article><div class="info"><nav></nav</div></article> 问题是每个文章标签中的导...

如何在cakephp中显示最后一个链接(How to show the last link in cakephp)

我认为这对你有所帮助 Cake PHP中的最后一个链接 I Think this will be helpfull for you Last Link In Cake PHP

cakephp下载链接后面的图像或媒体文件不起作用(cakephp download link behind the image or media files not working)

你可以像这样添加文件名来点击 <?php echo $this->Html->link($file['Audio']['filename'], 'uploads' . DS . $file['Audio']['User_id'] . DS . $file['Audio']['filename'] . DS . $file['Audio']['filemime'], array('target' => '_blank')); ?> 为了更多的理解,只需抛出这个cakephp.org链接来了解htm...

cakephp中链接和postLink之间的区别(Difference between link and postLink in cakephp)

在第一种情况下( Html->link() ),您只有一个指向URL的链接。 如果以“http://”开头,则将其视为外部对象,否则应遵循约定controller/action/view 。 在第二种情况下( Form->postLink() ),您可以创建一个<form>元素,以便根据您设置的选项在$_GET[]或$_POST[]传递 - 默认为POST 。 来自Cakephp API的所有信息。 In the first case (Html->link()), you have only a...

相关文章

更多

solr4.3+tomcat入门部署(转自http://qindongliang1922.iteye.com/blog/1893254)

solr4.3+tomcat入门部署 博客分类: Solr solr4.3 ...

又开始写blog啦

我经常会有一些想法,尤其在等车或者坐公交车的时候。 常常想过了就忘了,干嘛不找个地方记下来呢? 发微博 ...

C#中Image.FromFile()的用法

谁能告诉我这个方法的具体用法我是这样写的Image.FromFile(&quot;1.jpg&quot ...

微信的研究【转http://blog.csdn.net/chief1985/article/details/7902016】

下面是个人研究微信android 4.2版本的一些结果,不一定正确。 1. 微信android使用的是 ...

讨论下blog数据表分表的方法

有一张blog数据表,数据很多的话需要分表。 blog表的字段: blog_id, user_id ...

Vivek's blog - Roll your own autocomplete solution using Tries.

Vivek's blog - Roll your own autocomplete solution ...

Param's Blog: Nutch 1.3 and Solr Integration

Param's Blog: Nutch 1.3 and Solr Integration Nut ...

如何在jsp中显示数据库的图片

图片在数据库中以连接&lt;image src=&quot;&quot;&gt;的方式存在.. 我可 ...

Java添加图片水印

周末在家上围脖,看到sina围脖上图片都有水印,想到Java有专门Image的处理包,同样应该可以实现 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本