Sunday 23 November 2008 5:10:12 am
Hello again, Followed the block method and it works (thanks), this is what I did (just to test, I will make modifications later to optimize everything):
{*cache-block expiry=86412*}
{cache-block expiry=10}
{set-block variable=$shuffle_1}...operations1...{/set-block}
{set-block variable=$shuffle_2}...operations2...{/set-block}
{set-block variable=$shuffle_3}...operations3...{/set-block}
{set-block variable=$shuffle_4}...operations4...{/set-block}
{set-block variable=$shuffle_5}...operations5...{/set-block}
<script type="text/javascript" language="javascript">
//<![CDATA[
// some JS random function to pick var $shuffle 1-5
var i=0;
var givemearandomnumber=aleatorio(0,5);
//alert(givemearandomnumber);
if(givemearandomnumber==1)
document.getElementById('awaiting_content').innerHTML = '{$shuffle_1}';
if(givemearandomnumber==2)
document.getElementById('awaiting_content').innerHTML = '{$shuffle_2}';
if(givemearandomnumber==3)
document.getElementById('awaiting_content').innerHTML = '{$shuffle_3}';
if(givemearandomnumber==4)
document.getElementById('awaiting_content').innerHTML = '{$shuffle_4}';
if(givemearandomnumber==5)
document.getElementById('awaiting_content').innerHTML = '{$shuffle_5}';
//]]>
</script>
{/cache-block}
<b>Coments</b> It works fine, this is great because the page goes beyong my expectations when reloading, the time to reload goes from 2 to 5 secs. When it comes to a "view full" type of a page this method of displaying random data works well. But when displaying several pieces codes that each one of them should oputput random data, the things get a little complicaded, I will explain... I have this <b>folder "view full"</b> that outputs several <b>folder "view lines"</b> so you can click on every <b>folder "view line"</b> (it’s name or it’s image) and go trought the tree until you reach the final information (products). Each <b>folder "view line"</b> should go trought its children (the tree for whom he is the parent) and select randomly one of the folders (if any), get its image and display that image as a visual representation of the information that lies withing this tree of folders (messy explanation!) So the problem comes when I have to add the script on the <b>folder "view line"</b> template instead of the pagelayout, each <b>folder "view line"</b> will have to deal with a random image. So far so good, but there is a code :
<div id="awaiting_content">Data is being loaded...</div>
somewhere in te folder "view line" so data block can output there. The problem arises when several <b>folders "view line"</b> should be outputed, every block of code of the <b>folder "view line"</b> will have the same code <div id="awaiting_content">Data is being loaded...</div>
So all the contents goes always to the first block of folder “view line” (the first instance found of the <div id="awaiting_content"> </div> I need a workarround that will output unique <div> names for each block, I was wondering if using the node_id to do such a thing could accdomplish such a task. Any hints on putting javascript toghether with ezP script to “create the div” and to “output to the div” Thanks, jorge
Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com
|