I don't say it is the ONLY way to do this, nor the best... but this is the way I figured out, after a lot of trial and error, and it works. So, I thought maybe someone else here on the forum can benefit from it.
Firstly, I renamed the page called "viewtopic.php" to "showtopic.php" so that I can have control of the actions taken when a forum member clicks on the link in his email - for example:
http://beleuramyhome.org.au/phpBB3/view ... ead#unread
If you click on such a link in your email, it will take you to the relevant page, BUT - outside of your website...
My challenge was to embed it - within... and I used an iFrame for that
// In the replacement page - viewtopic.php at the top
Code: Select all
<?php
session_start();
// Get the URL passed into the page
$uri = $_SERVER['REQUEST_URI'];
// I just need the URL arguments, so strip off the URL itself
$str = substr($uri, 22);
// Feed the arguments into a session variable
// I tried using the $str, but didn't work for some reason
$_SESSION['params'] = substr($uri, 22);
// Prepare for a redirect to my website page - with the iFrame in it
$newpage = "http://www.beleuramyhome.org.au/iframeurl.php?";
// Add the URL arguments
$newpage .= $str;
// Use this to redirect, because the URL is an argument and can't
// be hard coded. That's why I couldn't use the header() function...
echo '<META HTTP-EQUIV="Refresh" Content="2; URL='.$newpage.'">';
?>
Code: Select all
<?php
session_start();
// Get the URL passed in from the first step
$uri = $_SERVER['REQUEST_URI'];
// Strip the URL itself, I need only the arguments
$_SESSION['params'] = substr($uri, 15);
?>
Code: Select all
<script>
// This function is called on page load
window.onload = function()
{
// I will redirect the content into the iFrame, pointing to the
// new page created at the begining
var url = "http://beleuramyhome.org.au/phpBB3/showtopic.php?";
// Get the Session arguments
var args = "<?php echo $_SESSION['params'] ?>";
// Add those to the URL
url += args;
// The actual job of inserting it into the iFrame
document.getElementById("InlineFrame1").setAttribute("src", url);
// Try this URL to see how it works
// http://beleuramyhome.org.au/phpBB3/viewtopic.php?f=6&t=3&e=1&view=unread#unread
}
</script>