Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12
  1. #11
    Join Date
    Mar 2007
    Posts
    4
    Tokens
    2,455
    Habbo
    Razzage

    Latest Awards:

    Default

    PHP Code:
     <?         
    if($_GET[page]){
        
    // checks if the page your looking for exists if not displays error
        
    if(!file_exists($_GET[page].".php")){
            echo
    "<strong>Missing File: </strong>".$_GET[page].".php";
        }else{
            
    // includes the page so the url is ?page=pagename
            
    include_once($_GET[page].".php"); 
        }
    }else{
        
    // Change home.php to your homepage
        
    include_once("home.php");
    }
    ?>

  2. #12
    Join Date
    Apr 2011
    Posts
    11
    Tokens
    0

    Default

    OK, heres some jquery to do that:

    HTML Code:
    var pageDirectory = "page"; // the directory in which the pages are located
    var returnID = "content"; // the id on the element in which you want the loaded page to go to
    
    //Coded by Aidan Taylor - www.aidantaylor.net
    $(document).ready(function(){
            //get the hash
    	var hash = window.location.hash;
    	if (hash != ""){
                    //take off the #!/ from the hash
    		var hash = hash.split("#!/");
                    //page route
    		var page = "./"+pageDirectory+"/"+hash[0]+hash[1];
                    //load the page
    		$("#"+returnID).load(page);//get the page
    	}
    	$("a").click(function(e){ //do when link is clicked
                   //get the href from the link
    		var url = $(this).attr("href");
                    //take off the #!/
    		var url = url.split("#!/");
                    //page route
    		var page = "./"+pageDirectory+"/"+url[0]+url[1];
                    //load the page
    		$("#"+returnID).load(page);
    	});
    });
    Your links will need to be like this:
    HTML Code:
    <a href="#!/page"></a>
    this is so that google picks it up and puts it down as a permanent url, if its just the #/page then google picks it up as non-permanent.

    You can also do things like this:
    HTML Code:
    <a href="#!/page/hiii"></a>
    this script will get the pages from the directory you put, e.g, if directory is page, and the page name is home, it the page like this ./page/page-name, and it will get the main index page e.g. index.php, index.html ect, unless you put in what the page extension is e.g: x!/page.html.
    Last edited by aidant; 24-05-2011 at 11:21 AM.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •