Announcement

Collapse
No announcement yet.

How to include to an existing file?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to include to an existing file?

    Hello,

    I want my vBulletin 3 to be included in an existing PHP file (table). How do I do that? Thanks.

  • #2
    Normally you would add your opening and closing table code to the header and footer templates, respectively:

    Admin CP -> Styles & Templates -> Style Manager -> Common Templates (in the menu)

    Also in that same section, you can add PHP code like this to the phpinclude_start template to include the output of another file on your server:

    Code:
    ob_start();
    require("yourheader.html");
    $variable = ob_get_contents();
    ob_end_clean();
    Then you can use $variable in your templates and it will evaluate to the output of yourheader.html.

    Comment


    • #3
      I'm a bit confused how to do that.

      Well, this is the site where I want to include the forums.

      It must be included in this tag:

      HTML Code:
      <tr width="100%" height="400">
         <td colspan="2" id="table"><div align="center">vBulletin 3 comes here!</div></td>
      </tr>

      Comment


      • #4
        From the page source, put this code at the bottom of the headinclude template:

        Code:
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <script type="text/javascript" src="menu.js"></script>
        
        <SCRIPT language=JavaScript src="menu/milonic_src.js" type=text/javascript></SCRIPT>
        
        <script	language=JavaScript>
                if (parent.frames.length) {	top.location=document.location;}
        	if(ns4)_d.write("<scr"+"ipt language=JavaScript src=menu/mmenuns4.js><\/scr"+"ipt>");
        	else _d.write("<scr"+"ipt language=JavaScript src=menu/mmenudom.js><\/scr"+"ipt>");
        </script>
        <SCRIPT language=JavaScript src="menu/menu_data.js" type=text/javascript></SCRIPT>
        <SCRIPT language=JavaScript src="menu/contextmenu.js" type=text/javascript></SCRIPT>
        Put this code at the top of the header template:

        Code:
        <div align="center">
          <table width="780" height="400" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td id="outborder"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr> 
                    <td colspan="2"><img src="logo.jpg" width="780" height="100" /></td>
        
                  </tr>
                  <tr> 
                    <td align="center" colspan="2" bgcolor="#000000" height="25">
                    <script>
                    with(milonic=new menuname("Main Menu")){
                    style=background;
                    top=118;
                    left=139;
                    alwaysvisible=1;
                    orientation="horizontal";
                    position="relative";
                    aI("text=Home;url=http://www.tennis-handicapping.com/index.php;status=Back To Home Page;;image=http://www.tennis-handicapping.com/menu/home.gif;");
                    aI("text=Purchase;url=http://www.tennis-handicapping.com/purchase.php;status=Purchase;");
                    aI("text=Records;showmenu=Records;status=Records;onsubimage=http://www.tennis-handicapping.com/menu/on_downboxed.gif");
                    aI("text=Free Picks;showmenu=Free Picks;status=Free Picks;onsubimage=http://www.tennis-handicapping.com/menu/on_downboxed.gif");
                    aI("text=Statistics;url=http://www.tennis-handicapping.com/stats.php;status=Stats;");
                    aI("text=Calendar;status=Calendar;showmenu=Calendar;onsubimage=http://www.tennis-handicapping.com/menu/on_downboxed.gif");
                    aI("text=Players;url=/menusample.php;showmenu=Players;onsubimage=http://www.tennis-handicapping.com/menu/on_downboxed.gif");
                    aI("text=Community Forums;url=http://forums.tennis-handicapping.com;status=Community Forums;");
                    aI("text=About;url=http://www.tennis-handicapping.com/;status=About;");
                    aI("text=Contact;url=http://www.tennis-handicapping.com/contact.php;status=Contact;");
                    }
                    drawMenus();
                    </script>
                    </td>
                  </tr>
                  <tr> 
                    <td id="navigation3" width="466"><div align="left">
        							
        	Welcome Guest! 
                Please <strong><a href="register.php?PHPSESSID=d461b14c5e097963a1d33cf2c90c6c74" onfocus="if(this.blur)this.blur()">register</a></strong> 
                or <strong><a href="index.php?PHPSESSID=d461b14c5e097963a1d33cf2c90c6c74" onfocus="if(this.blur)this.blur()">login</a></strong>.
                						</div></td>
        
              			<td id="navigation3" width="220"><div align="right">
        							Registered Members: 25						</div></td>
              		</tr>
              		<tr width="100%" height="400">
              			<td colspan="2" id="table"><div align="center">
        Put this code at the bottom of the footer template:

        Code:
        </div></td>
            			</tr>
              </table></td>
            </tr>
        
          </table>
          <p><div align="center"><font size="1" face="Verdana" color="#FFFFFF">Copyright &copy;2003-2005 Tennis-Handicapping.com. All rights reserved.<br />Online since July 19, 2003</font></div></p>
        </div>
        No doubt there will be some code tweaking involved. For example, you will need to update the relative paths in this HTML code so they point to the right place.

        Comment


        • #5
          Except for the footer everything works fine.

          Comment


          • #6
            It looks to me like everything is working:

            http://forums.tennis-handicapping.com/

            Though you might want to edit the default header and footer code to make the forum fit better into the layout.

            Comment


            • #7
              So my own copyright from my site (at the bottom) gets killed by the footer template?

              Comment


              • #8
                Your page source contains this:

                Code:
                <?php include("http://www.tennis-handicapping.com/php/copyright.php"); ?>
                PHP code will not parse in the footer. You need to evaluate the output of that file to a variable using the method from my previous post.

                Comment


                • #9
                  I have this in the phpinclude_start

                  Code:
                  ob_start();
                  include("http://www.tennis-handicapping.com/php/copyright.php");
                  $your_code = ob_get_contents();
                  ob_end_clean();
                  Output in footer

                  HTML Code:
                  <p>$your_code</p>

                  Comment


                  • #10
                    Can you post the entire contents of your phpinclude_start template?

                    Comment


                    • #11
                      Code:
                      /*
                      // Example of how to include a seperate file:
                      
                      ob_start();
                      include("http://www.tennis-handicapping.com/php/copyright.php");
                      $your_code = ob_get_contents();
                      ob_end_clean();
                      
                      // Now place a reference to $your_code where you want the resulting HTML to be displayed.
                      // This will most likely be the header or footer template.
                      */

                      Comment


                      • #12
                        Your code is commented out. Remove the red code:

                        Code:
                        [color=red]/*[/color]
                        // Example of how to include a seperate file:
                        
                        ob_start();
                        include("http://www.tennis-handicapping.com/php/copyright.php");
                        $your_code = ob_get_contents();
                        ob_end_clean();
                        
                        // Now place a reference to $your_code where you want the resulting HTML to be displayed.
                        // This will most likely be the header or footer template.
                        [color=red]*/[/color]

                        Comment


                        • #13
                          I'm a bloke and haven't see that. You are right, Sir. Thank you.

                          Comment

                          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                          Working...
                          X