MyBB Community Forums

Full Version: Add custom page on site entering.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Don't really know how to explain this because ive never seen this before. I wanna k ow how to do this for my forum. http://brony.us when you koad the site a gif pops up and when u click it it redirects u to the sige. I wanna know how to do that. Dont wanna copy them but i wanna use my custom image. Anyone know how?

*Note* sorry for any spelling mistakes. Im on my phone.
Its a really easy thing they do there. They simply have the forums in the /f/ directory.
And have that as index page (probably some html file with just that .gif in it with a link wrapped around it (see code below for what they use) ).

Its simply a splash page.. a poorly done splash page because there is no way of skipping it.

Jquery cookie

Good tutorial how to make a nice.. (if 100% needed) splash page:
http://css-tricks.com/redirecting-to-a-s...h-cookies/

Its one with jquery and cookies but doesnt let the search engine bots skip it which isnt that great.

PHP cookie

Though a php one probably works better. If you do decide to go for a splash page using a cookie be mindful of the fact search bots are not able to pass and crawl your site. Without making exceptions for them (something not all of them like).

Example would be:

splashpage.php is a new file you would need to create.
<?
	//set a cookie for a year...
	setcookie('cookiename', true, time()+(3600*12*7*52));
?>
<!--HTML Splash page code below -->

And then add to index.php and portal.php at the top the following lines:
<?php
if(!isset($_COOKIE['Cookiename'])) { 

//If statement to check if cookie is there if not then it takes them to the splash page

header('Location:http://yourwebsite.com/splashpage.php');  // Redirect code
}

And yes if you wish you could check against the user agent. To see if its a search bot, but most dont like getting "exceptions" and seeing different content then the rest of your users do.

Index page change
Another way is to do what they did simply have the splash page in the site root (for example index.html) and with a simple link to the forums. This still allows search bots to crawl the site and at the same time gives you the splash page you wish.

This is what you have with the site you linked.


<title>BRONY.US</title>
<script language="JavaScript">
<!-- Activate cloaking device
var randnum = Math.random();
var inum = 4;
// Change this number to the number of images you are using.
var rand1 = Math.round(randnum * (inum-1)) + 1;
images = new Array
images[1] = "rainbow.gif"
images[2] = "rainbow2.gif"
images[3] = "derpy.gif"
images[4] = "spin.gif"
// Ensure you have an array item for every image you are using.
var image = images[rand1]
// Deactivate cloaking device -->
</script>
<body>
<center>
<script language="JavaScript">
<!-- Activate cloaking device
document.write('<a href="http://brony.us/f/"><img src="' + image + '"></a>')
// Deactivate cloaking device -->
</script>
</center>
</body>

Index page change with cookie redirect option

Personal favorite is the last one with the option for users to check a box to never see it again. So the page would auto redirect if a certain cookie is set. Which would still allow search bots to crawl your site. And allow users to skip the page if they do not wish to see it.
Oh thats a lot of typing. Thanks a lot for the help Smile it means a lot.