Author Topic: 3 Pages in One  (Read 1292 times)

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
3 Pages in One
« on: February 02, 2009, 05:29:32 AM »
Well to save loading time in my game I'm gonna recode some pages into one,

I have game stats for example it uses like 5 pages because I'm lazy anyone show mw how to code into the one file?

I did do a little google search but random crap comes up.

Thanks,

Sean

P.S  An example would be nice with no data other than Page 1 goes her, Page to goes here ect

Offline raestlyn

  • Level 29
  • **
  • Posts: 463
  • Reputation: +9/-5
    • View Profile
Re: 3 Pages in One
« Reply #1 on: February 02, 2009, 06:36:29 AM »
Do you mean you want the page have tabs or what?


I can send you pics of my cocks if you want reference.


Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: 3 Pages in One
« Reply #2 on: February 02, 2009, 09:25:49 AM »
Not sure what exactly you are looking for but  switch may work.

Code: [Select]
<?php

echo "<a href=\"page.php\">Home</a> | <a href=\"page.php?page=1\">Page 1</a> | <a href='page.php?page=2'>Page 2</a> | <a href='page.php?page=3'>Page 3</a><br>";
$page=abs((int) $_GET['page']); 
$pg=array("1","2","3");
if(!
in_array($page,$pg) and isset($_GET['page']))
{
 die(
"Page Not Found");
}
switch(
$page)
{
case 
1:
echo
" Page 1";
break;
case 
2:
echo
" page 2";
break;
case 
3:
echo
" page 3";
break;
default :
echo 
"Hello and welcome";
}
?>


I think that does what you are looking for but not sure if it helps on load.

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Re: 3 Pages in One
« Reply #3 on: February 02, 2009, 09:34:39 AM »
I'm not 100% sure myself, So 5 pages can be in the one and the url would be like

Page One - page.php

Page Two - page.php?page2

Page Three - page.php?page3

Hope that makes scence.

Thanks, Sean

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: 3 Pages in One
« Reply #4 on: February 02, 2009, 09:38:48 AM »
yes  that would be what you get with what i posted you can go on as many pages as you like on the one  page. You would just need to edit it a bit more to work with tour need as it is you have 4 pages the home and pages 1-3

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Re: 3 Pages in One
« Reply #5 on: February 02, 2009, 09:44:14 AM »
Not sure what exactly you are looking for but  switch may work.

Code: [Select]
<?php

echo "<a href=\"page.php\">Home</a> | <a href=\"page.php?page=1\">Page 1</a> | <a href='page.php?page=2'>Page 2</a> | <a href='page.php?page=3'>Page 3</a><br>";
$page=abs((int) $_GET['page']); 
$pg=array("1","2","3");
if(!
in_array($page,$pg) and isset($_GET['page']))
{
 die(
"Page Not Found");
}
switch(
$page)
{
case 
1:
echo
" Page 1";
break;
case 
2:
echo
" page 2";
break;
case 
3:
echo
" page 3";
break;
default :
echo 
"Hello and welcome";
}
?>


I think that does what you are looking for but not sure if it helps on load.
[/quote



Yes, But how do I make it so when I click on page two it can be its own page?

Say for example have a different picture on each page without the others showing.

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: 3 Pages in One
« Reply #6 on: February 02, 2009, 09:47:25 AM »
If you click on page 2 it should only show what you have coded for page 2. I tested it locally and each page showed there own content. it is still all the same file but the code dose not run unless the page points to it.

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Re: 3 Pages in One
« Reply #7 on: February 02, 2009, 09:53:44 AM »
If you click on page 2 it should only show what you have coded for page 2. I tested it locally and each page showed there own content. it is still all the same file but the code dose not run unless the page points to it.


Where do I put the stuff for page two? 

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: 3 Pages in One
« Reply #8 on: February 02, 2009, 09:57:33 AM »
This is what you edit for each page
Code: [Select]
<?php
switch($page)
{
case 
1:
echo
" Page 1"//edit for page 1
break;
case 
2:
echo
" page 2";  //edit for page 2
break;
case 
3:
echo
" page 3"// edit for page 3
break;
default :
echo 
"Hello and welcome";  //edit for the base page
}

?>


Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Re: 3 Pages in One
« Reply #9 on: February 02, 2009, 10:02:38 AM »
This is what you edit for each page
Code: [Select]
<?php
switch($page)
{
case 
1:
echo
" Page 1"//edit for page 1
break;
case 
2:
echo
" page 2";  //edit for page 2
break;
case 
3:
echo
" page 3"// edit for page 3
break;
default :
echo 
"Hello and welcome";  //edit for the base page
}

?>



Thanks so much, I'll try it in a min. :P

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: 3 Pages in One
« Reply #10 on: February 02, 2009, 10:08:16 AM »
No prob. If you need help adding more pages  to it  let me know as you have to edit some things on it. I add a very small security feature not sure if it works very well but it should help a bit.

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Re: 3 Pages in One
« Reply #11 on: February 02, 2009, 10:16:33 AM »
No prob. If you need help adding more pages  to it  let me know as you have to edit some things on it. I add a very small security feature not sure if it works very well but it should help a bit.

Still having problmes, You got MSN?

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: 3 Pages in One
« Reply #12 on: February 02, 2009, 10:19:18 AM »
yahoo but they co exist
« Last Edit: February 02, 2009, 03:26:09 PM by toxin »

Offline jannesiera

  • Level 35
  • **
  • Posts: 1,026
  • Reputation: +6/-1
    • View Profile
    • BBGameDesign
Re: 3 Pages in One
« Reply #13 on: February 02, 2009, 01:18:35 PM »
That all works, but why would you want to do that?

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: 3 Pages in One
« Reply #14 on: February 02, 2009, 01:44:58 PM »
It has its uses. Small sites mainly but can go well with other

Offline jannesiera

  • Level 35
  • **
  • Posts: 1,026
  • Reputation: +6/-1
    • View Profile
    • BBGameDesign
Re: 3 Pages in One
« Reply #15 on: February 02, 2009, 02:30:17 PM »
It has its uses. Small sites mainly but can go well with other

Mhm, I still don't get it. Okay, for small sites... But what other purpuses can it have?

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Re: 3 Pages in One
« Reply #16 on: February 02, 2009, 03:06:23 PM »
It has its uses. Small sites mainly but can go well with other

Mhm, I still don't get it. Okay, for small sites... But what other purpuses can it have?


I think it does make the loading time that split sec quicker, Also when I got through my files its alot neater having 1 file for the space of five.

Did you know its possible to code a whole mafia game in one script. Well 95% of it..


Offline raestlyn

  • Level 29
  • **
  • Posts: 463
  • Reputation: +9/-5
    • View Profile
Re: 3 Pages in One
« Reply #17 on: February 02, 2009, 04:28:10 PM »
i rather use AJAX tabs, its faster and easier to use. I'm not saying that wouldn't work, I personally don't like that solution :)


I can send you pics of my cocks if you want reference.


 


SimplePortal 2.3.3 © 2008-2010, SimplePortal