sendcard - the popular opensource PHP e-card script
 
 

 

 

 

STOP THE TRAFFIK

 

Getting sendcard to work in frames

Preamble

Many people like to include the link to the postcard in the email. Some however would prefer the people to visit their site and enter the pickup number in box on their site, as this increases the chances hat people will visit their site.

Stage 1: a new file

OK, this can be done using the previous code, but it also requires you to edit parts of the sendcard script.
We are going to create a file called view.php in directory sendcard/ containing the following code
<!-- view.php - put in the same directory as sendcard.php -->
<?php
// This builds the URL and allows you to edit the frameset more easily...
$sendcard_url = 'sendcard.php?view=1&id=' . $HTTP_GET_VARS['id'];
if ($HTTP_GET_VARS['sender_view'] == 1) {
	$sendcard_url .= '&sender_view=1';
}
?>
<html>
<head>
<title>A card just for you - powered by sendcard</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<frameset cols="150,*" frameborder="NO" border="0" framespacing="0"> 
  <frame name="leftFrame" scrolling="NO" noresize src="/yourmenu.php">
  <frame name="mainFrame" src="<?php echo $sendcard_url; ?>">
</frameset>
<noframes> 
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
Your browser doesn't support frames, but you may still <a href="<?php echo $sendcard_url; ?>">view your card</a>
</body>

</noframes> 
</html>
<!-- end view.php -->

Step 2: modifying sendcard

Open sendcard/functions.php and change the following line (right at the bottom of the file):
$str = str_replace("[card_url]", $sendcard_http_path . "sendcard.php?view=1&id=$id", $str);
to:
$str = str_replace("[card_url]", $sendcard_http_path . "view.php?view=1&id=$id", $str);
and this line:
$str = str_replace("[sender_card_url]", $sendcard_http_path . "sendcard.php?view=1&sender_view=1&id=$id", $str);
to:
$str = str_replace("[sender_card_url]", $sendcard_http_path . "view.php?view=1&sender_view=1&id=$id", $str);

This now means that when a card is sent the URL will look like http://www.yoursite.com/sendcard/view.php?view=1&id=1013031769610 and the card will open in the frame.

Stage 3: Test your changes

That's all the modifications made - now upload the files and send yourself a card to check it works.