Multiple Pages

From Hack Wars Wiki

Jump to: navigation, search

Contents

HTTP

This is an approach using fetchGetVariable() and replaceContent() to use multiple pages on your website. Each page is saved on one file in your in-game HD. If you have a lot of pages then this code needs a lot of space in your HD!

HTTP: ENTER

This right here is the http script. Go to Applications > Script Editor > File > New > HTTP Script. Then in the enter tab put this:

int main() {
string page=""+fetchGetVariable("page");// looks for the name of the page like "***.***.*.***?page=home"
string site="";// starts the site variable
 
if (page=="home") { // if the page is home
    site=readFile("Page1");// reads the content of the file "Page1" to represent the page
}else if (page=="page1") {// if the page is page1
    site=readFile("Page2");// reads the content of the file "Page2" to represent the page
}
replaceContent("content", site);// replaces <?content?> in your html with the site variable
}

Leave and Submit can be empty or have any code you want. Compile it and install it, make sure it's default HTTP script.

Files

Create the following files with their following content (Mind the capitalization of the filenames). Fill in your own IP when you see YOURIP.

Page1

This is page 1.<br>
<a href="YOURIP">back</a>   

Page2

This is page 2.<br>
<a href="YOURIP">back</a>

HTML code of your website

This is the HTML code. It can be edited to your feeling. You would put that in your Website Editor (Applications > Internet > Site Editor). Fill in your own IP when you see YOURIP.

<!-Title of your website->
<font size='50'>Navigation</font>
<br /><br />
<center>
<!-Links->
<a href="YOURIP?page=page1">Page 1</a>   
<a href="YOURIP?page=page2">Page 2</a>   
<br /><br />
</center>
<!-Website Content->
<?content?>
Personal tools