• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

php includes

  • 3,549
    Posts
    20
    Years
    <if (!$id) {

    $id = "main";

    $include = $id . ".html";

    }

    else {

    $include = $id . ".html";

    }

    if (is_file($include) == "1") {

    include $include;

    }

    else {

    echo include "404.html";

    }

    ?>

    <if (!$id) {

    $id = "main";

    $include = $id . ".html";

    }

    else {

    $include = $id . ".html";

    }

    if (is_file($include) == "1") {

    include $include;

    }

    else {

    echo include "404.html";

    }

    ?>
    that dont work, does anyone know of working codes?
     

    Simone

    ....... (>0_0<)
  • 945
    Posts
    20
    Years
    Try this one, i use it on my site so it should work. But i split up my nav bars into a left.inc and right.inc so i use include for that.

    <?php
    if (!$id) {
    $pworld = "main";
    $include = $id . ".html";
    }
    else {
    $include = $id . ".html";
    }
    if (is_file($include) == "1") {
    include $include;
    }
    else {
    include "404.html";
    }
    ?>

    ID = the page you name to include into the HTML. So ID will have your front page like news etc.. Also with the "html" that means it uses HTML pages instead of PHP pages.

    Also another include is like this
    <?php include ('Your page'); ?>

    thats very basic, and put that where you want the page to be.

    Hope this helps
     
  • 3,549
    Posts
    20
    Years
    thanks simone. i got that 1st 1 to work but i get an error message
    Warning: main(404.html): failed to open stream: No such file or directory in /data/hosted/thingsnotseen/index.php on line 154

    Warning: main(): Failed opening '404.html' for inclusion (include_path='./') in /data/hosted/thingsnotseen/index.php on line 154
    now what?
    [EDIT] Never mind. i got it to go to a 404 page that i made.
    now i gotta set up the news.
     
    Last edited:
  • 3,549
    Posts
    20
    Years
    ok... now whenever i click a link it goes to the page but it doesnt open in the the place where the main.html would go and the main.html wont open... it opens a 404 page that i setup
     

    Simone

    ....... (>0_0<)
  • 945
    Posts
    20
    Years
    You have to put the include in the part of the site you want. Also. MAKE SURE THE INCLUDE PAGE IS EXTERNAL so it opens from another link. Like my site. On the front part of index.php it includes pworld.html.. You just need to fiddle. but yeah if you post your source i'm sure i could help.
     
  • 3,549
    Posts
    20
    Years
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
    <HTML><HEAD><TITLE>Pokemon-Tns.co.nr</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
    <STYLE type=text/css>.style1 {
    FONT-SIZE: 10px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
    }
    .style2 {
    COLOR: #ffffff
    }
    .style3 {
    FONT-SIZE: 10px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
    }
    .style4 {
    FONT-SIZE: 9px; COLOR: #000000
    }
    .style5 {
    FONT-SIZE: 12px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
    }
    A:link {
    COLOR: #ffffff; TEXT-DECORATION: underline
    }
    A:visited {
    COLOR: #ffffff; TEXT-DECORATION: underline
    }
    A:hover {
    COLOR: #cccccc; TEXT-DECORATION: none
    }
    A:active {
    COLOR: #ffffff; TEXT-DECORATION: underline
    }
    </STYLE>
    <META content="MSHTML 6.00.2737.800" name=GENERATOR>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
    }
    //-->
    </script>
    </HEAD>
    <BODY bottomMargin=0 bgColor=#000000 leftMargin=0 topMargin=0 rightMargin=0>
    <TABLE cellSpacing=0 cellPadding=0 width=788 align=center border=0>
    <TBODY>
    <TR bgColor=#cccccc>
    <TD colSpan=4>
    <DIV align=center><IMG height=100 alt=Welcome src=""
    width=780></DIV></TD></TR>
    <TR bgColor=#999999>
    <TD colSpan=4><SPAN class=style1>Welcome to my Website </SPAN></TD></TR>
    <TR>
    <TD vAlign=top width=133 bgColor=#000000>
    <TABLE borderColor=#333333 cellSpacing=1 cellPadding=0 width="100%"
    border=0>
    <TBODY>
    <TR>
    <TD bgColor=#666666>
    <DIV class=style2 align=center><SPAN
    class=style5>::Site::</SPAN></DIV></TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> <a href="<A href="https://www.pokemon-tns.co.nr">Home">https://www.pokemon-tns.co.nr">Home </a></TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> <a href="<A href="mailto:[email protected]">Email">mailto:[email protected]">Email The Webbie</a> </TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Staff </TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Staff Login </TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Affiliates</TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD bgColor=#666666>
    <DIV class=style2 align=center><SPAN
    class=style5>::Games::</SPAN></DIV></TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> <a href="rs.html">Ruby and Sapphire</a> </TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Red/Blue/Yellow</TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Gold Silver Crystal </TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Colloseum </TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Tcg</TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> TCG2</TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Stadium 1&2</TD>
    </TR>
    <TR>
    <TD bgColor=#666666>
    <DIV class=style2 align=center><SPAN
    class=style5>::Fun::</SPAN></DIV></TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Downloads</TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> <a href="<A href="https://thingsnotseen.myfreebb.com">Forums">https://thingsnotseen.myfreebb.com">Forums </a></TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD bgColor=#666666>
    <DIV class=style2 align=center><SPAN
    class=style5>::Anime::</SPAN></DIV></TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> What Is Pokemon </TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Guide </TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Characters</TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> My Anime NEW! </TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD bgColor=#666666>
    <DIV class=style2 align=center><SPAN
    class=style5>::Non Pokemon.t::</SPAN></DIV></TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN><a href="https://unofficial-eresia.cjb.net"> Unofficial Eresia 5.0</a> </TD>
    </TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD bgColor=#666666>
    <DIV class=style2 align=center><SPAN
    class=style5>::Webbie Junk::</SPAN></DIV></TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR>
    <TR>
    <TD class="style2 style3" onmouseover="bgColor='#666666'"
    onmouseout="bgColor='#999999'" bgColor=#999999><SPAN
    class=style4>  >></SPAN> Link </TD></TR></TBODY></TABLE></TD>
    <TD width=9 bgColor=#333333></TD>
    <TD vAlign=top width=502 bgColor=#555555> <DIV class=style1 align=center>
    <P class=style2><STRONG>
    <HR width="100%" color=#000000 SIZE=1>
    </STRONG>
    <p><STRONG> </STRONG></p>
    <?php
    if (!$id) {
    $pworld = "main";
    $include = $id . ".php";
    }
    else {
    $include = $id . ".html";
    }
    if (is_file($include) == "1") {
    include $include;
    }
    else {
    include "404.html";
    }
    ?>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> 
    </p>
    <P></P>
    <STRONG> </STRONG></DIV></TD>
    <TD vAlign=top width=144 bgColor=#444444>
    <DIV class=style2 align=center><STRONG><SPAN class=style3>Recent News
    <HR width=100 color=#000000 SIZE=1>
    </SPAN></STRONG><SPAN
    class=style3>None!</SPAN><STRONG><SPAN
    class=style3>
    <P><STRONG><SPAN class=style3></SPAN></STRONG>
    Links<STRONG><SPAN class=style3>
    <HR width=100 color=#000000 SIZE=1>
    </SPAN></STRONG><SPAN
    class=style3> <!-- CO.NR Button Begin - https://www.freedomain.co.nr/ -->
    <a href="https://www.freedomain.co.nr/" target="_top">
    <img src="fr.gif" width="88" height="31" border="0"
    alt="Free Domain Name - <A href="https://www.YOU.co.nr"></a">www.YOU.co.nr"></a>
    <!-- CO.NR Button End - https://www.freedomain.co.nr/ --><BR>
    </SPAN><STRONG><SPAN
    class=style3></SPAN></STRONG>
    <P></P>
    <P><STRONG><SPAN class=style3></SPAN></STRONG>
    Affiliates<STRONG><SPAN class=style3>
    <HR width=100 color=#000000 SIZE=1>
    <select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
    <option value="<A href="https://www.pokemon-tns.co.nr">Select">https://www.pokemon-tns.co.nr">Select A Site</option>
    <option value="<A href="https://ngpokeforums.cjb.net">Ngpoke">https://ngpokeforums.cjb.net">Ngpoke Forums</option>
    <option value="<A href="https://pocketmonsters.t35.com">Pocket">https://pocketmonsters.t35.com">Pocket Monsters T35</option>
    <option value="<A href="https://thingsnotseen.myfreebb.com/">Pokemon-Tns">https://thingsnotseen.myfreebb.com/">Pokemon-Tns Forums</option>
    <option value="<A href="https://www.freewebs.com/podc/">Mt">https://www.freewebs.com/podc/">Mt. Akina</option>
    <option value="https://www.freewebs.com/dark_absol" selected>Dark Absol Temple</option>
    </select>
    <br>
    </SPAN></STRONG></SPAN></STRONG>
    <form name="form1" method="post" action="">
    <p>Affiliate Sign Up<br>
    Site Name
    <input type="text" name="textfield3">
    <br>
    URL
    <input type="text" name="textfield2">
    <br>
    EMAIL
    <input type="text" name="textfield">
    <br>
    <input name="textfield4" type="submit" value="Submit">
    <input name="reset" type="reset" value="Reset">
    </p>
    </form>
    <STRONG><SPAN
    class=style3>
    <P></P>
    <BR>
    </SPAN></STRONG></DIV></TD></TR>
    <TR bgColor=#666666>
    <TD colSpan=4>
    <DIV class="style1 style2" align=center>Design by
    <a href="<A href="https://www.pichusb.com">Pichu">https://www.pichusb.com">Pichu Secret Base</a> </DIV></TD></TR></TBODY></TABLE></BODY></HTML>


    ALSO ATTATCHED IS MY SITE IN A ZIP NOW CAN SOMEONE HELP ME?
     
    Last edited:

    Pikachu3828

    Webmaster of The Pika Club
  • 87
    Posts
    20
    Years
    • Seen Jan 8, 2012
    It's a shame most people don't realise the potential of PHP past includes. I'll try and catch you on AIM and help :D
     
    Last edited:
  • 3,549
    Posts
    20
    Years
    sorry to dp but i need to say that i got it fixed and this can be closed. but b4 it is can it be reopened if i need it to be
     
    Back
    Top