Posted By

rwczippy on 05/29/09


Tagged

php random SPRY


Versions (?)

Random XML Record in Spry using PHP


 / Published in: PHP
 

what was taking an embarrassingly long time in Spry took 2 lines in PHP

  1. <script language="JavaScript" type="text/javascript">
  2. <?php $num=rand(1,7); ?>
  3. var ds = new Spry.Data.XMLDataSet("data_in_XML.xml","record/thing[id='<? echo $num; ?>']");
  4. </script>
  5. .
  6. .
  7. .
  8. <div spry:region="ds">
  9. <p spry:repeat="ds"><strong>{ds::title}</strong></p>
  10. <p spry:repeat="ds">{ds::desc}</p>
  11. </div>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: rwczippy on May 29, 2009

Thanks to Jessie!

You need to login to post a comment.