Quantcast
Channel: Planet Plone - Where Developers And Integrators Write
Viewing all articles
Browse latest Browse all 3535

UW Oshkosh How-To's: Add image to news portlet

$
0
0

I would love to take credit for this but I didn't write any of it! Im posting this here so its easy for me to find when I forget how to do it later :). This elegent solution came from "Ida" from this thread

http://plone.293351.n2.nabble.com/News-portlet-able-to-show-preview-image-td4853505.html

This solution works with Plone 4.3

Problem:

The "News" portlet should also show the image that was assigned to it.

Directions:

  1. Login to your site and go to the zmi
  2. Choose "portal_view_customizations"
  3. Choose "news.pt"
  4. Choose the "Customize" button
  5. Copy the following code below and paste where you want it to appear. I wanted mine to appear before the text so I placed it before the <a href ="" part of the code
<!-- ADD IMAGE HERE-->
<img src="" alt="" tal:define="item_object obj/getObject;" tal:condition="exists:item_object/image_thumb" tal:replace="structure python: path('nocall:item_object/tag')(scale='thumb',
 css_class='tileImage')" />
<!-- END IMAGE HERE-->

settings:

You can adjust your "scale" to a variety of sizes that come from "Image Handling" in the "Settings" on your plone site. For me those are;
  • large
  • preview
  • mini
  • thumb
  • tile
  • icon
  • listing
Image in News Portlet Example

BONUS: Add the Description to the portlet as well ..

 Follow the directions above but use the following code to add the description (or summary) to the news portlet.
 
<!--ADD SUMMARY OR DESCRIPTION HERE-->
<p>         
  <span tal:replace="obj/Description">
            Description goes here!
  </span>
</p>
<!-- END SUMMARY  HERE-->
 
 

Viewing all articles
Browse latest Browse all 3535

Trending Articles