diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/e2gallerypro/php/parsexml.php	Mon Feb 22 08:02:39 2010 -0500
     1.3 @@ -0,0 +1,94 @@
     1.4 +<script type="text/javascript">
     1.5 +var imagesloaded = new Array();
     1.6 +var maingalleries = new Array();
     1.7 +<!--(E)2 Gallery Parse XML output Javascript-->
     1.8 +maingalleries  = [
     1.9 +<?php
    1.10 +if($myPHPVersion=="4"){
    1.11 +	require('php/xmlparse.v4.php');
    1.12 +}else{
    1.13 +	require('php/xmlparse.v5.php');
    1.14 +}
    1.15 +//Get the XML document loaded into a variable
    1.16 +$xml = file_get_contents($e2xmlurl);
    1.17 +
    1.18 +//Set up the parser object
    1.19 +$parser = new XMLParser($xml);
    1.20 +
    1.21 +//Work the magic...
    1.22 +$parser->Parse();
    1.23 +$i=0;
    1.24 +$k=0;
    1.25 +$l=0;
    1.26 +foreach($parser->document->gallery as $gallery){
    1.27 +	if($i!=0){
    1.28 +		echo',';
    1.29 +	}
    1.30 +	foreach($gallery->item as $item){
    1.31 +		$l++;
    1.32 +		$finalnum=$l-1;
    1.33 +	}
    1.34 +	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."}";
    1.35 +	$i++;
    1.36 +	foreach($gallery->item as $item){
    1.37 +		$k++;
    1.38 +	}
    1.39 +}
    1.40 +	
    1.41 +?>
    1.42 +];
    1.43 +
    1.44 +var galleryimages = new Array();
    1.45 +
    1.46 +galleryimages = [
    1.47 +<?php
    1.48 +$j=0;
    1.49 +foreach($parser->document->gallery as $gallery){
    1.50 +	foreach($gallery->item as $item){
    1.51 +		if($j!=0){
    1.52 +			echo',
    1.53 +';
    1.54 +		}
    1.55 +		if(isset($item->sellprint[0])){
    1.56 +			$sellprintSet = $item->sellprint[0];
    1.57 +		}else{
    1.58 +			$sellprintSet = NULL;
    1.59 +		}
    1.60 +		if($sellprintSet != NULL || $sellprintSet!=""){
    1.61 +			if($item->sellprint[0]->tagAttrs['type']=='paypal'||$item->sellprint[0]->tagAttrs['type']=='google'){
    1.62 +				$sellprint = "true";
    1.63 +				$selltype = ",'paytype':'".$item->sellprint[0]->tagAttrs['type']."'";
    1.64 +				$pNum = 1;
    1.65 +				$pricing ="";
    1.66 +				if($item->sellprint[0]->price!= NULL ){
    1.67 +					foreach($item->sellprint[0]->price as $price){
    1.68 +						$pricing .= ", 'price".$pNum."': '".$price->tagData."', 'pricecurrency".$pNum."': '".$item->sellprint[0]->tagAttrs['currency']."', 'pricecurrencysymbol".$pNum."': '".$item->sellprint[0]->tagAttrs['currencysymbol']."', 'pricesize".$pNum."': '".$price->tagAttrs['size']."'";
    1.69 +						$pNum++;
    1.70 +					}
    1.71 +				}
    1.72 +				
    1.73 +			}else{
    1.74 +				$sellprint = "false";
    1.75 +				$selltype = "";
    1.76 +				$pricing="";
    1.77 +				$pNum = 1;
    1.78 +			}
    1.79 +		}else{
    1.80 +				$sellprint = "false";
    1.81 +				$selltype = "";
    1.82 +				$pricing="";
    1.83 +				$pNum = 1;
    1.84 +			}
    1.85 +		if($item->tagAttrs['type']=='image'){
    1.86 +			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."}";
    1.87 +		}else{
    1.88 +			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."}";
    1.89 +		}
    1.90 +		$j++;
    1.91 +	}	
    1.92 +}
    1.93 +?>
    1.94 +	
    1.95 +];
    1.96 +<!--End (E)2 Gallery Parse XML output Javascript-->
    1.97 +</script>
    1.98 \ No newline at end of file