Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Include w wybranym miejscu
Forum PHP.pl > Forum > PHP
nigraS
Witam, w folderze znajduje się plik index.php oraz folder include, a w nim plik header.php

Strona wygląda tak, wszystko tam opisałem o co mi chodzi.
http://x.nigras.info/v4/

w pliku index.php dałem taką komendę
<? include("include/header.php"); ?>

tekst zawarty w index.php, pojawia się na samym dole, co zrobić, by pokazał się z boku?


Proszę o pomoc.
zzeus
A w którym miejscu strony robisz include tego pliku ?
Mlodycompany
daj caly kod indexu to bedzie łatwiej.
Civil
To jest HTML, w którym miejscu includujesz w kodzie w tym się pojawia, nie ma komendy w php, która pozwoli Ci zdecydować o tym gdzie na stronie ma się pojawić includowany plik.
Mlodycompany
  1. <tr>
  2. <td>
  3. <?php include('include/header.php'); ?>
  4. </td>
  5. </tr>

wystarczy ze tak zrobi i bedzie gralo
nigraS
Aktualnie index.php wygląda tak.

  1. <td style="background-position: left top; width:280px; height:374px; background-repeat:repeat-x; background-attachment:scroll">
  2. <div style="margin-left:40px; margin-right:36px; text-align:justify">
  3.  </div>
  4. </td>
  5. <td style="width:486px; height:374px">
  6. <table>
  7. <tr>
  8. <td style="width:40px; height:374px"></td>
  9. <td style="width:446px; height:374px">
  10. <br style="line-height:50px">
  11. <img src="images/t1_2.gif" alt=""><br>
  12. <br style="line-height:20px">
  13. <table>
  14. <tr>
  15. <td style="width:165px; height:233px">
  16. <br style="line-height:5px">
  17. <img src="images/p1_1.gif" alt=""><br>
  18. <br style="line-height:12px">
  19. <img src="images/name.gif" alt=""><br>
  20. </td>
  21. <td style="width:244px; height:233px; text-align:justify">
  22. <br>
  23. <br style="line-height:28px">
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. <table>
  31. <strong>To jest tekst znajdujący się w index.php</strong>
  32. <tr>
  33. <td>
  34. <?php include('include/header.php'); ?></td>
  35. </tr>
  36. </table>
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. <br> </td>
  47. </tr>
  48. </table>
  49.  
  50. </td>
  51. </tr>
  52. </table>
  53. </td>


Wcześniej wyglądał tak.

  1. <table>
  2. <tr>
  3. <td style="background-position: left top; width:280px; height:374px; background-repeat:repeat-x; background-attachment:scroll"> </td>
  4. <td style="width:486px; height:374px">
  5. <table>
  6.  
  7. </table>
  8. <table>
  9. <tr>
  10. <td style="width:165px; height:233px"><br style="line-height:5px">
  11. <img src="images/p1_1.gif" alt="p1"><br>
  12. <br style="line-height:12px">  
  13. </td>
  14. <td style="width:244px; height:233px; text-align:justify"><br>
  15. <br style="line-height:28px">
  16. <? include("include/header.php"); ?>
  17. <b><font color="#FFFF00" size="5">Ten tekst znajduje sie w index.php </font></b> <br>
  18. </td>
  19. </tr>
  20. </table></td>
  21. </tr>
  22. </table>
Mlodycompany
i jaki jest rezultat?
nigraS
Wcześniej był napis na dole strony, teraz jest nad nią :/
Mlodycompany
Jak masz tabele w HTMLu to masz wiersze i komórki. Robisz sobie taka tabele na potrzeby twojej stronki. Wstawiasz tekst do komórek. I w tym miejscu gdzie chcesz wstawic include to wpisujesz do komurki <? include('include/header.php'); ?>. Ja tak robie na każdej stronie i mi działa.
nigraS
Plik header.php wygląda tak:
Kod
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK HREF="style.css" TYPE="text/css" REL="stylesheet">



<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<BODY onLoad="MM_preloadImages('images/m1_1.gif','images/m2_1.gif','images/m3_1.gif','images/m4_1.gif','images/m5_1.gif')">
<table align="center" style=" border-left:#0F0F0F 1px solid; border-right:#0F0F0F 1px solid; height:100%">
  <tr>
    <td  style="width:766px; height:800px">
        <table>
          <tr>
            <td  style="width:766px; height:339px; background:url(images/bg_flash.gif) no-repeat left top ">
                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                       codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,24"
                       width="766" height="339">
                <param name="movie" value="flash/header_v8.swf?button=1">
                <param name="quality" value="high">
                <param name="menu" value="false">
                <!--[if !IE]> <-->
                <object data="flash/header_v8.swf?button=1"
                        width="766" height="339" type="application/x-shockwave-flash">
                 <param name="quality" value="high">
                 <param name="menu" value="false">
                 <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">
                 FAIL (the browser should render some flash content, not this).
                </object>
                <!--> <![endif]-->
               </object>
            </td>
          </tr>
          <tr>
            <td  style="width:766px; height:374px">
                <table>
                  <tr>
                    <td  style="width:280px; height:374px; background:#313333 url(images/px.gif) repeat-x left top">
                      <div style="margin-left:40px; margin-right:36px; text-align:justify">
                            <br style="line-height:48px">
                            
                            
                            
                            <!-- REKLAMA -->
                        
                            
                            
<script type="text/javascript"><!--
google_ad_client = "pub-1586112902783329";
/* v4 */
google_ad_slot = "7517986658";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>                            
                            
                
                            
                            
                            <!-- KONIEC -->
                            
                            
                            
                            
                            <br style="line-height:28px">
                            <br>
                        </div>
                    </td>
                    <td  style="width:486px; height:374px">
                        <table>
                          <tr>
                            <td  style="width:40px; height:374px"></td>
                            <td  style="width:446px; height:374px">
                                <br style="line-height:50px">
                                        <br>
                                <br style="line-height:20px">
                                <table>
                                  <tr>
                                    <td  style="width:22px; height:233px">
                                        <br style="line-height:5px">
                                        <br>
                                        <br style="line-height:12px">
                                        <br>
                                    </td>
                                    <td  style="width:387px; height:233px; text-align:justify">
                                        
                                        
                                        
                            


<font color="#FFFF00" size="5">Co zrobić, by tekst, który znajduje się w
                                        index.php znalazł się TU?</font>                                    
                                        
                                        
                                        <p>
                                        
                                        
                                        <br> </td>
                                  </tr>
                                </table>
                                
                            </td>
                          </tr>
                        </table>
                    </td>
                  </tr>
                </table>
            </td>
          </tr>
          <tr>
            <td  style="width:766px; height:87px">
                <table>
                  <tr>
                    <td  style="width:766px; height:2px; background:url(images/bg_px.gif) no-repeat left top"></td>
                  </tr>
                  <tr>
                    <td  style="width:766px; height:85px">
                        <table>
                          <tr>
                            <td  style="width:280px; height:85px; background:#161717">
                                <div class="footer">
                                    <br style="line-height:16px">
                                    Customer Service:<br>
                                    FAX:     +1 800 559 6580 <br>
                                    E-mail:  <a href="#">customers@companyname.com</a><br>
                                </div>
                            </td>
                            <td  style="width:486px; height:85px; background:#0E0F0F">
                              <div class="footer">
                                    <br style="line-height:16px">
                                      <b><a href="index.html">main page</a></b>   <span>|</span>   <b><a href="index-1.html">company</a></b>   <span>|</span>   <b><a href="index-2.html">SERVICES</a></b>   <span>|</span>   <b><a href="index-3.html">support</a></b>   <span>|</span>   <b><a href="index-4.html">CONTACTS</a></b><br>
                                    YourCompany.Com © 2007 | <span><a href="index-5.html">
                                    Privacy Policy</a></span>
                            
                              </div>
                            </td>
                          </tr>
                        </table>
                    </td>
                  </tr>
                </table>
            </td>
          </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td  style="width:766px; height:100%">
        <table style="height:100%">
            <tr>
                <td  style="width:280px; height:100%; background:#161717"></td>
                <td  style="width:486px; height:100%; background:#0E0F0F"></td>
            </tr>
        </table>
    </td>
  </tr>
</table>
</BODY>
</HTML>


a tak index.php, jednak, tekst nadal jest na górze :/

Plik index.php
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE></TITLE>
  5. <meta http-equiv="Content-Style-Type" content="text/css">
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  7. <LINK HREF="style.css" TYPE="text/css" REL="stylesheet">
  8.  
  9.  
  10.  
  11. <script type="text/JavaScript">
  12. <!--
  13. function MM_swapImgRestore() { //v3.0
  14. var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  15. }
  16.  
  17. function MM_preloadImages() { //v3.0
  18. var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  19. var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  20. if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  21. }
  22.  
  23. function MM_findObj(n, d) { //v4.01
  24. var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  25. d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  26. if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  27. for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  28. if(!x && d.getElementById) x=d.getElementById(n); return x;
  29. }
  30.  
  31. function MM_swapImage() { //v3.0
  32. var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  33.  if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  34. }
  35. //-->
  36. </script>
  37. <BODY onLoad="MM_preloadImages('images/m1_1.gif','images/m2_1.gif','images/m3_1.gif','images/m4_1.gif','images/m5_1.gif')">
  38. <table align="center" style=" border-left:#0F0F0F 1px solid; border-right:#0F0F0F 1px solid; height:100%">
  39. <tr>
  40. <td style="width:766px; height:800px">
  41. <table>
  42. <tr>
  43. <td style="background-position: left top; width:766px; height:339px; background-color:transparent; background-repeat:no-repeat; background-attachment:scroll">
  44. &nbsp;</td>
  45. </tr>
  46. <tr>
  47. <td style="width:766px; height:374px">
  48. <table>
  49. <tr>
  50. <td style="background-position: left top; width:280px; height:374px; background-repeat:repeat-x; background-attachment:scroll">
  51. <div style="margin-left:40px; margin-right:36px; text-align:justify">
  52. &nbsp;</div>
  53. </td>
  54. <td style="width:486px; height:374px">
  55. <table>
  56. <tr>
  57. <td style="width:40px; height:374px"></td>
  58. <td style="width:446px; height:374px">
  59. <table>
  60. <tr>
  61. <td style="width:22px; height:233px">
  62. <br style="line-height:5px">
  63. <br>
  64. <br style="line-height:12px">
  65. <br>
  66. </td>
  67. <td style="width:387px; height:233px; text-align:justify">
  68.  
  69. &nbsp;
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87. <font color="#FFFF00" size="5">Co zrobić, by tekst, który znajduje się w 
  88. index.php znalazł się TU?</font><br>
  89.  
  90.  
  91. <? include('include/header.php'); ?>
  92.  
  93.  
  94.  
  95.  
  96.  
  97. <p>
  98.  
  99.  
  100. <br> </td>
  101. </tr>
  102. </table>
  103.  
  104. </td>
  105. </tr>
  106. </table>
  107. </td>
  108. </tr>
  109. </table>
  110. </td>
  111. </tr>
  112. <tr>
  113. <td style="width:766px; height:87px">
  114. <table>
  115. <tr>
  116. <td style="width:766px; height:2px; background:url(images/bg_px.gif) no-repeat left top"></td>
  117. </tr>
  118. <tr>
  119. <td style="width:766px; height:85px">
  120. <table>
  121. <tr>
  122. <td style="background-position: 0% 0%; width:280px; height:85px; background-image:none; background-repeat:repeat; background-attachment:scroll">
  123. <div class="footer">
  124. &nbsp;</div>
  125. </td>
  126. <td style="background-position: 0% 0%; width:486px; height:85px; background-image:none; background-repeat:repeat; background-attachment:scroll">
  127. <div class="footer">
  128. &nbsp;</div>
  129. </td>
  130. </tr>
  131. </table>
  132. </td>
  133. </tr>
  134. </table>
  135. </td>
  136. </tr>
  137. </table>
  138. </td>
  139. </tr>
  140. <tr>
  141. <td style="width:766px; height:100%">
  142. <table style="height:100%">
  143. <tr>
  144. <td style="width:280px; height:100%; background:#161717"></td>
  145. <td style="width:486px; height:100%; background:#0E0F0F"></td>
  146. </tr>
  147. </table>
  148. </td>
  149. </tr>
  150. </table>
  151. </BODY>
  152. </HTML>
Mlodycompany
wiesz co zrob. dodaj do tabeli obramowanie i bedziesz widzial dlaczego.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.