MyBB Community Forums

Full Version: This is a way off the track question in case I want to try this
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi I was wondering when you register or are waiting for the search results a page appears with a box saying 'blah blah' before redirecting. How do you go about doing this in case I want to add this to other parts of my website. I think its really neat. I also like how the session times out and won't let you go back too far.
Cheers
Nanny
If you other parts of the website are included in mybb and using its templates and functions, you will only need to use

redirect("url here", "message in here") 

if it is a side site, you will need to create the redirection you self, for example


if($something) {
echo "<html>
<head>
<title> page Title</title>


</head>

 <body> <table width=\"50%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tborder\" align\"center\"> 
   <tr>
     <td class=\"thead\"><div align=\"left\" class=\"largetext\">
       <div align=\"center\">Title </div>
     </div></td>
  </tr>
   <tr>
     <td class=\"trow1\"><ul>
         <div align=\"center\"><span class=\"smalltext\">Message </span><br>
         </div>
     </ul></td>
  </tr>
</table></body>
</html>"; 
header("Location: $url");
} else {
echo "<html>
<head>
<title>Title</title>


</head>

 <body> <table width=\"50%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tborder\" align\"center\"> 
   <tr>
     <td class=\"thead\"><div align=\"left\" class=\"largetext\">
       <div align=\"center\">Title </div>
     </div></td>
  </tr>
   <tr>
     <td class=\"trow1\"><ul>
         <div align=\"center\"><span class=\"smalltext\">Message </span><br>
         </div>
     </ul></td>
  </tr>
</table></body>
</html>"; 
header("Location: $url");
}
 
you will need to use this code in one of your php file that you want a redirection in


reagrds
no, Location will just redirect it without the user seeing the page at all, you would need something like this.
<meta http-equiv="refresh" content="2;url=www.test.com" />
below <title> tag.
where 2 is the seconds where to redirect after. and url is the url to the page it wants to redirect to.
zaher1988 Wrote:

if($something) {
echo "<html>
<head>
<title> page Title</title>


</head>

 <body> <table width=\"50%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tborder\" align\"center\"> 
   <tr>
     <td class=\"thead\"><div align=\"left\" class=\"largetext\">
       <div align=\"center\">Title </div>
     </div></td>
  </tr>
   <tr>
     <td class=\"trow1\"><ul>
         <div align=\"center\"><span class=\"smalltext\">Message </span><br>
         </div>
     </ul></td>
  </tr>
</table></body>
</html>"; 
header("Location: $url");
} else {
echo "<html>
<head>
<title>Title</title>


</head>

 <body> <table width=\"50%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tborder\" align\"center\"> 
   <tr>
     <td class=\"thead\"><div align=\"left\" class=\"largetext\">
       <div align=\"center\">Title </div>
     </div></td>
  </tr>
   <tr>
     <td class=\"trow1\"><ul>
         <div align=\"center\"><span class=\"smalltext\">Message </span><br>
         </div>
     </ul></td>
  </tr>
</table></body>
</html>"; 
header("Location: $url");
}
 

Won't work at all as PHP would return an error saying "headers already sent"
goshhh, how have i missed <meta http-equiv="refresh" content="2;url=www.test.com" /> !! sleepy head :/ Toungue

So, summary, you don't really have to use php for this.
<html>
<head>
<title>Title</title>
<meta http-equiv="refresh" content="2;url=www.test.com" />
</head>
 <body> <table width="50%"  border="0" cellpadding="0" cellspacing="0" class="tborder" align="center"> 
   <tr>
     <td class="thead"><div align="left" class="largetext">
       <div align="center">Title </div>
     </div></td>
  </tr>
   <tr>
     <td class="trow1"><ul>
         <div align="center"><span class="smalltext">Message </span><br>
         </div>
     </ul></td>
  </tr>
</table>
</body>
</html>
Would work just fine in an html file.
But not with conditionals !! and conditional messages Smile
It is preferable to have a template and then use the php to modify the message and use conditions.

regards
Well thank you so much for all the information I really appreciate this.
Thanks again.
Hi just on this subject again to see if you know if using it for search pages and using this method will it bring you eventually to the search results page with the results?
Hi nanny,

When you click the 'go button', the search page first runs the query in the database then it stores the returned data in a "searchlog" table with a unique session ID. It then redirects you to a page where it "shows" the results, which basicly fetches the results set in the "searchlog" table and parses it to the browser.
Pages: 1 2