annotate e2gallerypro/php/parsexml.php @ 5:788bb81ec9dd judyates

[svn r6] tested paypal; ready to put up new money-making gallery!
author rlm
date Mon, 22 Feb 2010 08:52:08 -0500
parents 3f6b44aa6b35
children
rev   line source
rlm@3 1 <script type="text/javascript">
rlm@3 2 var imagesloaded = new Array();
rlm@3 3 var maingalleries = new Array();
rlm@3 4 <!--(E)2 Gallery Parse XML output Javascript-->
rlm@3 5 maingalleries = [
rlm@3 6 <?php
rlm@3 7 if($myPHPVersion=="4"){
rlm@3 8 require('php/xmlparse.v4.php');
rlm@3 9 }else{
rlm@3 10 require('php/xmlparse.v5.php');
rlm@3 11 }
rlm@3 12 //Get the XML document loaded into a variable
rlm@3 13 $xml = file_get_contents($e2xmlurl);
rlm@3 14
rlm@3 15 //Set up the parser object
rlm@3 16 $parser = new XMLParser($xml);
rlm@3 17
rlm@3 18 //Work the magic...
rlm@3 19 $parser->Parse();
rlm@3 20 $i=0;
rlm@3 21 $k=0;
rlm@3 22 $l=0;
rlm@3 23 foreach($parser->document->gallery as $gallery){
rlm@3 24 if($i!=0){
rlm@3 25 echo',';
rlm@3 26 }
rlm@3 27 foreach($gallery->item as $item){
rlm@3 28 $l++;
rlm@3 29 $finalnum=$l-1;
rlm@3 30 }
rlm@3 31 echo "{'name':'".$gallery->title[0]->tagData."', 'imgpath': '".$gallery->gallerypath[0]->tagData."','lrgpath': '".$gallery->largeimgpath[0]->tagData."', 'thumbpath': '".$gallery->thumbpath[0]->tagData."', 'mainthumb': '".$gallery->mainthumb[0]->tagData."', 'src':'".$gallery->mainthumbsrc[0]->tagData."', 'description':'".$gallery->description[0]->tagData."', 'start':".$k.", 'end':".$finalnum.", 'gallerynum':".$i."}";
rlm@3 32 $i++;
rlm@3 33 foreach($gallery->item as $item){
rlm@3 34 $k++;
rlm@3 35 }
rlm@3 36 }
rlm@3 37
rlm@3 38 ?>
rlm@3 39 ];
rlm@3 40
rlm@3 41 var galleryimages = new Array();
rlm@3 42
rlm@3 43 galleryimages = [
rlm@3 44 <?php
rlm@3 45 $j=0;
rlm@3 46 foreach($parser->document->gallery as $gallery){
rlm@3 47 foreach($gallery->item as $item){
rlm@3 48 if($j!=0){
rlm@3 49 echo',
rlm@3 50 ';
rlm@3 51 }
rlm@3 52 if(isset($item->sellprint[0])){
rlm@3 53 $sellprintSet = $item->sellprint[0];
rlm@3 54 }else{
rlm@3 55 $sellprintSet = NULL;
rlm@3 56 }
rlm@3 57 if($sellprintSet != NULL || $sellprintSet!=""){
rlm@3 58 if($item->sellprint[0]->tagAttrs['type']=='paypal'||$item->sellprint[0]->tagAttrs['type']=='google'){
rlm@3 59 $sellprint = "true";
rlm@3 60 $selltype = ",'paytype':'".$item->sellprint[0]->tagAttrs['type']."'";
rlm@3 61 $pNum = 1;
rlm@3 62 $pricing ="";
rlm@3 63 if($item->sellprint[0]->price!= NULL ){
rlm@3 64 foreach($item->sellprint[0]->price as $price){
rlm@3 65 $pricing .= ", 'price".$pNum."': '".$price->tagData."', 'pricecurrency".$pNum."': '".$item->sellprint[0]->tagAttrs['currency']."', 'pricecurrencysymbol".$pNum."': '".$item->sellprint[0]->tagAttrs['currencysymbol']."', 'pricesize".$pNum."': '".$price->tagAttrs['size']."'";
rlm@3 66 $pNum++;
rlm@3 67 }
rlm@3 68 }
rlm@3 69
rlm@3 70 }else{
rlm@3 71 $sellprint = "false";
rlm@3 72 $selltype = "";
rlm@3 73 $pricing="";
rlm@3 74 $pNum = 1;
rlm@3 75 }
rlm@3 76 }else{
rlm@3 77 $sellprint = "false";
rlm@3 78 $selltype = "";
rlm@3 79 $pricing="";
rlm@3 80 $pNum = 1;
rlm@3 81 }
rlm@3 82 if($item->tagAttrs['type']=='image'){
rlm@3 83 echo"{'filetype':'".$item->tagAttrs['type']."', 'path':'".$gallery->gallerypath[0]->tagData."','src':'".$item->src[0]->tagData."', 'width':'".$item->demensions[0]->tagAttrs['width']."', 'height':'".$item->demensions[0]->tagAttrs['height']."', 'lrgwidth':'".$item->large[0]->tagAttrs['width']."', 'lrgheight':'".$item->large[0]->tagAttrs['height']."', 'lrgpath':'".$gallery->largeimgpath[0]->tagData."','title': '".$item->title[0]->tagData."', 'author':'".$item->author[0]->tagData."', 'copyright':'".$item->copyright[0]->tagData."', 'description':'".$item->description[0]->tagData."','forsale':".$sellprint."".$selltype." ".$pricing.",'numOfPrices':".($pNum-1).", 'imgid':".$j."}";
rlm@3 84 }else{
rlm@3 85 echo"{'filetype':'".$item->tagAttrs['type']."','mediaURL':'".$item->mediaurl[0]->tagData."', 'path':'".$gallery->gallerypath[0]->tagData."','src':'".$item->src[0]->tagData."', 'width':'".$item->demensions[0]->tagAttrs['width']."', 'height':'".$item->demensions[0]->tagAttrs['height']."', 'lrgwidth':'".$item->large[0]->tagAttrs['width']."', 'lrgheight':'".$item->large[0]->tagAttrs['height']."', 'lrgpath':'".$gallery->largeimgpath[0]->tagData."','title': '".$item->title[0]->tagData."', 'author':'".$item->author[0]->tagData."', 'copyright':'".$item->copyright[0]->tagData."', 'description':'".$item->description[0]->tagData."','forsale':".$sellprint."".$selltype." ".$pricing.",'numOfPrices':".($pNum-1).", 'imgid':".$j."}";
rlm@3 86 }
rlm@3 87 $j++;
rlm@3 88 }
rlm@3 89 }
rlm@3 90 ?>
rlm@3 91
rlm@3 92 ];
rlm@3 93 <!--End (E)2 Gallery Parse XML output Javascript-->
rlm@3 94 </script>