view e2gallerypro/php/parsexml.php @ 3:3f6b44aa6b35 judyates

[svn r4] added ability to buy stuff, from a Prints page, but it doesn't work well with the css, and it also has not been fitted into the perl make system.
author rlm
date Mon, 22 Feb 2010 08:02:39 -0500
parents
children
line wrap: on
line source
1 <script type="text/javascript">
2 var imagesloaded = new Array();
3 var maingalleries = new Array();
4 <!--(E)2 Gallery Parse XML output Javascript-->
5 maingalleries = [
6 <?php
7 if($myPHPVersion=="4"){
8 require('php/xmlparse.v4.php');
9 }else{
10 require('php/xmlparse.v5.php');
11 }
12 //Get the XML document loaded into a variable
13 $xml = file_get_contents($e2xmlurl);
15 //Set up the parser object
16 $parser = new XMLParser($xml);
18 //Work the magic...
19 $parser->Parse();
20 $i=0;
21 $k=0;
22 $l=0;
23 foreach($parser->document->gallery as $gallery){
24 if($i!=0){
25 echo',';
26 }
27 foreach($gallery->item as $item){
28 $l++;
29 $finalnum=$l-1;
30 }
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."}";
32 $i++;
33 foreach($gallery->item as $item){
34 $k++;
35 }
36 }
38 ?>
39 ];
41 var galleryimages = new Array();
43 galleryimages = [
44 <?php
45 $j=0;
46 foreach($parser->document->gallery as $gallery){
47 foreach($gallery->item as $item){
48 if($j!=0){
49 echo',
50 ';
51 }
52 if(isset($item->sellprint[0])){
53 $sellprintSet = $item->sellprint[0];
54 }else{
55 $sellprintSet = NULL;
56 }
57 if($sellprintSet != NULL || $sellprintSet!=""){
58 if($item->sellprint[0]->tagAttrs['type']=='paypal'||$item->sellprint[0]->tagAttrs['type']=='google'){
59 $sellprint = "true";
60 $selltype = ",'paytype':'".$item->sellprint[0]->tagAttrs['type']."'";
61 $pNum = 1;
62 $pricing ="";
63 if($item->sellprint[0]->price!= NULL ){
64 foreach($item->sellprint[0]->price as $price){
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']."'";
66 $pNum++;
67 }
68 }
70 }else{
71 $sellprint = "false";
72 $selltype = "";
73 $pricing="";
74 $pNum = 1;
75 }
76 }else{
77 $sellprint = "false";
78 $selltype = "";
79 $pricing="";
80 $pNum = 1;
81 }
82 if($item->tagAttrs['type']=='image'){
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."}";
84 }else{
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."}";
86 }
87 $j++;
88 }
89 }
90 ?>
92 ];
93 <!--End (E)2 Gallery Parse XML output Javascript-->
94 </script>