[Plone-IT] portlet con news casuale

Vito Falco vitofalco a gmail.com
Gio 24 Dic 2009 08:45:41 UTC


Ciao,
sempre così, ad occhio, potresti utilizzare lo stesso codice del portlet di
weblion
[..]

<img tal:replace="structure pobj/image" />

Vito

Il giorno 24 dicembre 2009 09.42, Fabrizio Rota <fabrizio.rota a gmail.com> ha
scritto:

> Con structure pobj/Text avevo già provato
> Con structure pobj/getText funziona bene!
> GRAZIE
>
> Sapresti anche come fargli estrarre la immagine che opzionalmente si può
> inserire  nella news e che viene usata nella vista riassuntiva?
> Grazie ancora
>
> faber
>
> Il giorno 24 dicembre 2009 09.35, Vito Falco <vitofalco a gmail.com> ha
> scritto:
>
> Ciao,
>> perchè usi il SearchableText?
>>
>> Io, ad occhio, avrei fatto un <div tal:replace="structure
>> pobj/getText">This element is a comment.</div>
>> oppure
>> <div tal:replace="structure pobj/Text">This element is a comment.</div>
>>
>> Vito
>>
>> Il giorno 24 dicembre 2009 09.26, Fabrizio Rota <fabrizio.rota a gmail.com>ha scritto:
>>
>>> Sto modificando questo codice di weblion
>>> https://weblion.psu.edu/trac/weblion/wiki/RandomImagePortlet (usato per
>>> mostrare in un portlet una immagina casuale) in modo che mostri il contenuto
>>> di una news casuale.
>>>
>>>
>>> <div metal:define-macro="portlet">
>>>      <div  id="portlet_randomphoto"
>>>              tal:define="presults python:context.portal_catalog(portal_type='Image',
>>>                          path='/yaks/images-randomize')"
>>>              tal:condition="presults">
>>>              <div>
>>>
>>>                <span tal:define="pobj python:random.choice(presults).getObject()">
>>>                      <img tal:replace="structure pobj/image" />
>>>                      <span tal:content="string:${pobj/Description}">[displays description of image]</span>
>>>                </span>
>>>           </div>
>>>      </div>
>>> </div>
>>>
>>>
>>>
>>> Sto provando con questo codice
>>>
>>> <div metal:define-macro="portlet">
>>>      <div  id="portlet_randomphoto"
>>>              tal:define="presults
>>> python:context.portal_catalog(portal_type='News Item',
>>>                          path='/test/news')"
>>>              tal:condition="presults">
>>>              <div>
>>>
>>>                <span tal:define="pobj
>>> python:random.choice(presults).getObject()">
>>>
>>>                      <span
>>> tal:content="string:${pobj/Description}">[displays description of
>>> image]</span>
>>>                    <div tal:replace="structure pobj/SearchableText">This
>>> element is a comment.</div>
>>>                </span>
>>>           </div>
>>>      </div>
>>> </div>
>>>
>>> Ma non riesco ad estrarre il testo della news in modo decente.
>>> Con SearchableText, infatti,  il testo viene fuori come non formattato e
>>> si prende pure la descrizione della immagine a commento della news.
>>> Forse che il testo della news non viene estratto con getObject()?
>>> C'è qualche altro modo di ottenerlo?
>>>
>>> a presto
>>>
>>> faber
>>>
>>> --------------------
>>> "Life is what happens to you while you're busy making other plans" - J.
>>> Lennon
>>>
>>> _______________________________________________
>>> Plone-IT mailing list
>>> Plone-IT a lists.plone.org
>>> http://lists.plone.org/mailman/listinfo/plone-it
>>> http://www.nabble.com/Plone---Italy-f21728.html
>>>
>>
>>
>>
>> --
>> "Design is the method of putting form and content together. Design, just
>> as art, has multiple definitions; there is no single definition. Design can
>> be art. Design can be aesthetics. Design is so simple, that's why it is so
>> complicated." by Paul Rand
>>
>> _______________________________________________
>> Plone-IT mailing list
>> Plone-IT a lists.plone.org
>> http://lists.plone.org/mailman/listinfo/plone-it
>> http://www.nabble.com/Plone---Italy-f21728.html
>>
>
>
>
> --
> Fabrizio
>
> --------------------
> "Life is what happens to you while you're busy making other plans" - J.
> Lennon
>
> _______________________________________________
> Plone-IT mailing list
> Plone-IT a lists.plone.org
> http://lists.plone.org/mailman/listinfo/plone-it
> http://www.nabble.com/Plone---Italy-f21728.html
>



-- 
"Design is the method of putting form and content together. Design, just as
art, has multiple definitions; there is no single definition. Design can be
art. Design can be aesthetics. Design is so simple, that's why it is so
complicated." by Paul Rand
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.plone.org/pipermail/plone-plone-it/attachments/20091224/a429305d/attachment.html>


Maggiori informazioni sulla lista Plone-IT