Betreff: Re: Zufällige Videos mit Xoopstube von LupusC am 14.05.2008 08:55:36
Ich kenne das Modul nicht, hab aber jetzt mal schnell den Sourcecode überflogen
1. Hast du in den Optionen die Anzahl der zufälligen Videos auf 2 gestellt? 2. Sind genug Videos published, nicht abgelaufen und als online gesetzt? 3. Editiere mal bitte xoopstube_top.php und ersetze in der function b_xoopstube_random folgende Zeilen
unset( $_block_check_array );
return $block;
mit
print "<!-- ";
print_r($videorandom);
print " -->";
unset( $_block_check_array );
return $block;
Ist zwar eine etwas russische Lösung, sollte aber als Kommentar den Inhalt von $videorandom anzeigen. Poste bitte mal den Inhalt hier. Du kannst dann den Teil wieder rausnehmen.
4. Nach dem zuletzt von dir geposteten Code muss ich mal annehmen, dass nur ein Video in $videorandom ist, denn 2 idente foreach schleifen bringen nunmal ein identes Ergebnis.
5. In zwei nebeneinanderliegenden Spalten was Ausgeben ist mit den smarty Templates eine kleine Herausforderung. Ich hab mal sowas für einen xt:Commerce Shop realisiert. Ich habs nicht ausprobiert, aber von smarty her dürfte es keine Probleme geben. Was xoops mit dem Template anstellt kann ich dir aber nicht sagen.
<{* $cols is the number of columns you want *}>
<{assign var='cols' value=2}>
<{math assign="width" equation="100 / x" x=$cols}>
<table border="0" cellspacing="1" cellpadding="1" width="100%">
<{section name=tr loop=$videorandom step=$cols}>
<tr valign="bottom" style="padding: 0 0 10px 0;">
<{section name=td start=$smarty.section.tr.index loop=$smarty.section.tr.index+$cols}>
<{if $videorandom[td].cid|default:false}>
<td width="<{$width}>%" align="center">
<a href="<{$xoops_url}>/modules/<{$videorandom[td].dirname}>/singlevideo.php?cid=<{$videorandom[td].cid}>&lid=<{$videorandom[td].id}>"><small><{$videorandom[td].title}></small>
<br />
<small>(<{$videorandom.date}>)</small>
<br />
<a href="<{$xoops_url}>/modules/<{$videorandom[td].dirname}>/singlevideo.php?cid=<{$videorandom[td].cid}>&lid=<{$videorandom[td].id}>"><{$videorandom[td].videothumb}></a>
</td>
<{else}>
<td width="<{$width}>%" align=left> </td>
<{/if}>
<{/section}>
</tr>
<{/section}>
</table>
In der Zeile
<{assign var='cols' value=2}>
Kannst du selbst einstellen wieviele Spalten du willst. Wenn du 5 Spalten willst, dann einfach value=5 draus machen. Die Spaltenbreite berechnet sich automatisch aus der Anzahl der Spalten. Leere Spalten werden NICHT eliminiert. Die CSS Verhübschung musst du allerdings selbst machen.
Falls das nicht klappen sollte, und du nur 2 Spalten haben willst, dann muss man ne hartcodierte Version in Angriff nehmen (grusel). Untenstehend der Code (ebenfalls nicht getestet)
<table cellspacing="1" align="center" border="0" width="100%">
<tr>
<{if $videorandom[0].dirname}>
<td align="center" class="even" style="padding: 4px;vertical-align: top;" width="50%">
<a href="<{$xoops_url}>/modules/<{$videorandom[0].dirname}>/singlevideo.php?cid=<{$videorandom[0].cid}>&lid=<{$videorandom[0].id}>"><small><{$videorandom[0].title}></small></a>
<br />
<small>(<{$videorandom[0].date}>)</small>
<br />
<a href="<{$xoops_url}>/modules/<{$videorandom[0].dirname}>/singlevideo.php?cid=<{$videorandom[0].cid}>&lid=<{$videorandom[0].id}>"><{$videorandom[0].videothumb}></a>
<{else}>
<td width="50%" align=left> </td>
<{/if}>
</td>
<{if $videorandom[1].dirname}>
<td align="center" class="even" style="padding: 4px;vertical-align: top;" width="50%">
<a href="<{$xoops_url}>/modules/<{$videorandom[1].dirname}>/singlevideo.php?cid=<{$videorandom[1].cid}>&lid=<{$videorandom[1].id}>"><small><{$videorandom[1].title}></small></a>
<br />
<small>(<{$videorandom[1].date}>)</small>
<br />
<a href="<{$xoops_url}>/modules/<{$videorandom[1].dirname}>/singlevideo.php?cid=<{$videorandom[1].cid}>&lid=<{$videorandom[1].id}>"><{$videorandom[1].videothumb}></a>
<{else}>
<td width="50%" align=left> </td>
<{/if}>
</td>
</tr>
</table>
Ich hoffe, dass dir das weiterhilft
|