Enzo:

I think is better to try this with a different approach.

if you want a random set of videos you need to get all videos on your site, select randomly a subset and return them as a list. what you are doing right now is just getting the latest 5.

please take a look at http://plone.org/documentation/tutorial/borg/zope-3-views as this is the new way to do it. (I will try to implement this also on the code.)

also, take a look at code on trunk (I'll be releasing the new version this week... I hope). you will find that I have refactored it to make it easier to use and maintain (the old version really sucks): http://julius.jornada.com.mx/browser/code/ATGoogleVideo/trunk

saludos

Héctor Velarde
Desarrollo e Internet
La Jornada
+52 (55) 9183 0300 x4160

Enzo Cesanelli wrote:
Hi Héctor,
 sorry for delay... But, well, late is better than nothing :)

So you can find the Italian translations attached to this email...

I'd like also to ask you if you can figure out why the portlet I wrote (with
your help!) shows only the first published video (instead of a random set).
Here the code:

<html xmlns:tal="http://xml.zope.org/namespaces/tal";
       xmlns:metal="http://xml.zope.org/namespaces/metal";
       i18n:domain="Musicultura">
<metal:block use-macro="here/global_defines/macros/defines" />
<body>

<div metal:define-macro="portlet" tal:condition="isAnon">
<tal:recentlist tal:define="results
python:here.portal_catalog.searchResults(portal_type=['Google Video'],
                                         review_state='published',
                                         sort_on='effective',
                                         sort_order='reverse',
                                         sort_limit=5)[:10];">
     <dl class="portlet" id="portlet-youtube" tal:condition="results">
         <dt class="portletHeader">
             <a href="#"
           tal:attributes="href string:${portal_url}/archivio/video/2007/"
           i18n:translate="box_recent_videos">Guarda i Video</a>
         </dt>
         <dd tal:define="isGoogle
python:results[0].getObject().docId[1:].isdigit();
                         height python:test(isGoogle, '200px', '163px');"
             tal:attributes="style python:'margin: 0;; padding: 1em 0 1em
0em;; height: %s' % (height)"
             style="margin: 0; padding: 0;">
             <object tal:define="movie
python:'http://video.google.com/googleplayer.swf?docId=%s' %
results[0].getObject().docId;"
                     tal:attributes="data movie;"
                     tal:condition="isGoogle"
                     type="application/x-shockwave-flash"
data="http://video.google.com/googleplayer.swf?docId=1234567890123456789";
                     style="width: 200px; height: 163px;">
                 <param tal:attributes="value movie"
                        name="movie"
value="http://video.google.com/googleplayer.swf?docId=1234567890123456789";
/>
                 <param name="allowScriptAcess" value="sameDomain" />
                 <param name="quality" value="best" />
                 <param name="bgcolor" value="#FFFFFF" />
                 <param name="scale" value="noScale" />
                 <param name="salign" value="TL" />
                 <param name="FlashVars" value="playerMode=embedded" />
             </object>
             <object tal:define="movie
python:'http://www.youtube.com/v/%s' % results[0].getObject().docId;"
                     tal:attributes="data movie;"
                     tal:condition="not:isGoogle"
                     type="application/x-shockwave-flash"
                     data="http://www.youtube.com/v/ABCDEFGHIJ";
                     width="200" height="163"
                     style="width: 200px; height: 163px;">
                 <param tal:attributes="value movie"
                        name="movie"
value="http://www.youtube.com/v/ABCDEFGHIJ"; />
                 <param name="wmode" value="transparent" />
                 <embed tal:attributes="src movie"
                        src="http://www.youtube.com/v/ABCDEFGHIJ";
                        type="application/x-shockwave-flash"
                        wmode="transparent"
                        width="200"
                        height="163" />
             </object>
         </dd>
         <dd class="portletFooter" tal:condition="nothing">
             <span style="text-align: left; display: block;">Vedi
anche:</span>
             <tal:items tal:repeat="obj results">
             <a href=""
                style="display: block;"
                tal:attributes="href string:${obj/getURL}/view"
                tal:content="obj/pretty_title_or_id"
                tal:condition="not:repeat/obj/start">Title</a>
             </tal:items>
         </dd>
         <dd class="portletFooter">
             <a href="#"
           class="tile"
           tal:attributes="href
string:${portal_url}/archivio/video/2007/audizioni-live/"
           i18n:translate="box_more_videos">
            Elenco completo
        </a>
         </dd>
     </dl>
</tal:recentlist>
</div>

</body>
</html>

What's wrong? Any clue?
Anyway thank you:)

P.D. What about the nift product? Is it ready for production? Is it
difficult to make it work?

Best regards,
 Enzo Cesanelli





_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to