Jump to content

Recommended Posts

Hi

I have an editxml.php file that takes this code:

Hi

	<img src="RLW_001.jpg" title="Please click on photograph to purhase" caption="RLW_001.jpg" link="" />

 

and when run, turns it into this code:

 

<img src="BST 001.jpg" title="Please click on photograph to purchase" caption="BST 001.jpg" link="javascript:NewWindow=window.open('/Payment_page.php?name=BST 001.jpg&album=Brighton speed trials 2006','myWindow','width=300,height=660,toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');NewWindow.focus(); void(0);" />

 

I need to change the editxml.php so that it creates a xml file like this

 

<img src="ECO_007.jpg" title="Please click on Photograph to purchase" caption="ECO_007.jpg" link="http://www.michaelshuttleworth.com/Payment_page2.php?name=ECO_007.jpg&album=Ecofair_2006" target="_self" />

 

Ignore the filenames (i have taken them from different sources)

 

Here is the editxml.php code that needs changing:

 

<html>
<head>
  <title>PHP Test</title>
</head>
<body>


<?php 

$file = "images.xml"; 
$descriptor = fopen ($file, "r");
$contents = fread($descriptor , filesize($file));
$album = '';

$pos1 = strpos($contents, 'javascript:NewWindow');
if ($pos1 == false) {

$pieces = explode('link=""', $contents);
$op = "";

for ($i = 0; $i < count($pieces); $i++) {

	$tnpos = strpos($pieces[$i], 'tnPath="');
	if ($tnpos !== false)
	{
		$titpos = strpos($pieces[$i], 'ssp_director/albums/', $tnpos);
		$titpos += 20;
		$titend = strpos($pieces[$i], '/', $titpos) - $titpos;
		$album = substr($pieces[$i], $titpos, $titend);
//echo $album;
	}

	$halves = explode('<img src="', $pieces[$i]);
	$fileid = substr($halves[1], 0, 7);
	if (count($halves) > 1) {
		$halves[0] .= '<img src="';

		$pos1 = strpos($halves[1], 'unavailable');
		if ($pos1 == false) {
			$halves[1] .= "link=\"javascript:NewWindow=window.open('/Payment_page.php?name=" . $fileid . ".jpg&album=" . $album . "','myWindow','width=300,height=730,toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');NewWindow.focus(); void(0);\""; 
		} else {
			$halves[1] .= 'link=""';
		}
	}
	$op .= $halves[0] . $halves[1];
}

fclose($descriptor);
unlink($file);
//$descriptor = fopen ('images.txt', "w"); 
$descriptor = fopen ($file, "w"); 
fwrite($descriptor,$op);

echo 'done! '; 
echo count($pieces);
echo ' pieces processed';

fclose($descriptor);

} else {
echo 'This file has been processed already';
}

?>

</body>
</html>	

 

I guess the javascript newwindow code needs replacing, i have tried but can't quite get it right.

 

If anyone out there can show me what to change i would be so so grateful.

 

Many thanks

 

Mike

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.