2014-04-29 4 views
-1

이것은 상황입니다.PHP에서 HTML을 포함하면 CSS가 작동하지 않습니다.

나는 세 개의 파일이 있습니다

  1. index.html을
  2. completeupdate.html
  3. chronus.php을

(1)과 (2)입니다 거의 동일, (2) 단추를 제거하고 일부 본문 텍스트를 수정하도록 수정되었습니다. 나는 (3)에서 (2)를 부른다.

브라우저에서 직접 호출 한 경우 CSS가 정상적으로 작동하지만 (2)가 inside (3)에서 호출되므로 CSS가 작동하지 않습니다. enter image description here

: enter image description here 다음

이 (2)입니다 : UPDATE-1 여기

이 (가) (1)

<?php 
    //GETTING SEVER DATE 
    date_default_timezone_set('America/Sao_Paulo'); 
    $currentDate = date('Y-m-d H:i:s'); 

    //UPDATES THE LOG 
    function logUpdate() 
    {  
     //bunch of unharmfull and uninteresting code 
    } 

    logUpdate(); 
    include("../jude/updatecomplete.html"); 
?> 

입니다

:

이것은 PHP 스크립트는 어떻게

업데이트 1-end

012 3,516,

UPDATE-2 (1)에 대한

코드 : (2)에 대한

<!DOCTYPE HTML> 
<html> 
    <head> 
     <title>Judith Lars</title> 
     <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
     <meta name="description" content="" /> 
     <meta name="keywords" content="" /> 
     <link href="http://fonts.googleapis.com/css?family=Open+Sans:300,800" rel="stylesheet" type="text/css" /> 
     <link href="http://fonts.googleapis.com/css?family=Oleo+Script:400" rel="stylesheet" type="text/css" /> 
     <script src="js/jquery.min.js"></script> 
     <script src="js/config.js"></script> 
     <script src="js/skel.min.js"></script> 
     <script src="js/skel-panels.min.js"></script> 
     <noscript> 
      <link rel="stylesheet" href="css/skel-noscript.css" /> 
      <link rel="stylesheet" href="css/style.css" /> 
      <link rel="stylesheet" href="css/style-desktop.css" /> 
     </noscript> 
     <!--[if lte IE 8]><script src="js/html5shiv.js"></script><link rel="stylesheet" href="css/ie8.css" /><![endif]--> 
     <!--[if lte IE 7]><link rel="stylesheet" href="css/ie7.css" /><![endif]--> 
    </head> 
    <body class="homepage"> 

     <!-- Header Wrapper --> 
      <div id="header-wrapper"> 
       <div class="container"> 
        <div class="row"> 
         <div class="12u"> 

          <!-- Header --> 
           <header id="header"> 

            <!-- Logo --> 
             <div id="logo"> 
              <h1><a href="#" id="logo">Judith Lars</a></h1> 
              <span>Lorem ipsum dolor sit amet.</span> 
             </div> 
           </header> 

         </div> 
        </div> 
       </div> 
      </div> 

     <!-- Banner Wrapper --> 
      <div id="banner-wrapper"> 
       <div class="container"> 
        <div class="row"> 
         <div class="12u"> 

          <!-- Banner --> 
           <div id="banner" class="box"> 

            <div> 
             <div class="row"> 
              <div class="7u"> 
               <h2>Nam rutrum est gravida, adipiscing ipsum vel, viverra nisl.</h2> 
               <p>Donec viverra nisi in urna vestibulum, sed pharetra risus.</p> 
              </div> 
              <div class="5u"> 
               <ul> 
                <li><a href="../php/chronus.php" class="button big fa fa-arrow-circle-right">Update it now.</a></li> 
               </ul> 
              </div> 
             </div> 
            </div> 

           </div> 

         </div> 
        </div> 
       </div> 
      </div> 
     <!-- Footer Wrapper --> 
      <div id="footer-wrapper"> 
       <footer id="footer" class="container"> 
        <div class="row"> 
         <div class="3u"> 

          <!-- Contact --> 
           <section class="widget-contact last"> 
            <h2>Contact Us</h2> 
            <ul> 
             <li><a href="#" class="fa fa-twitter solo"><span>Twitter</span></a></li> 
             <li><a href="#" class="fa fa-facebook solo"><span>Facebook</span></a></li> 
            </ul> 
            <p>Av. João, 1234<br /> 
            São Paulo, São Paulo<br /> 
            (11) 1234-1234</p> 
           </section> 

         </div> 
        </div> 
        <div class="row"> 
         <div class="12u"> 
          <div id="copyright"> 
           &copy; App4U Sistemas de Informação Ltda. All rights reserved. 
          </div> 
         </div> 
        </div> 
       </footer> 
      </div> 

    </body> 
</html> 

코드 :

<!DOCTYPE HTML> 
<html> 
    <head> 
     <title>Judith Lars</title> 
     <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
     <meta name="description" content="" /> 
     <meta name="keywords" content="" /> 
     <link href="http://fonts.googleapis.com/css?family=Open+Sans:300,800" rel="stylesheet" type="text/css" /> 
     <link href="http://fonts.googleapis.com/css?family=Oleo+Script:400" rel="stylesheet" type="text/css" /> 
     <script src="js/jquery.min.js"></script> 
     <script src="js/config.js"></script> 
     <script src="js/skel.min.js"></script> 
     <script src="js/skel-panels.min.js"></script> 
     <noscript> 
      <link rel="stylesheet" href="http://www.app4u.com.br/labs/royalib/verti/css/skel-noscript.css" /> 
      <link rel="stylesheet" href="http://www.app4u.com.br/labs/royalib/verti/css/style.css" /> 
      <link rel="stylesheet" href="http://www.app4u.com.br/labs/royalib/verti/css/style-desktop.css" /> 
     </noscript> 
     <!--[if lte IE 8]><script src="js/html5shiv.js"></script><link rel="stylesheet" href="css/ie8.css" /><![endif]--> 
     <!--[if lte IE 7]><link rel="stylesheet" href="css/ie7.css" /><![endif]--> 
    </head> 
    <body class="homepage"> 

     <!-- Header Wrapper --> 
      <div id="header-wrapper"> 
       <div class="container"> 
        <div class="row"> 
         <div class="12u"> 

          <!-- Header --> 
           <header id="header"> 

            <!-- Logo --> 
             <div id="logo"> 
              <h1><a href="#" id="logo">Judith Lars</a></h1> 
              <span>Lorem ipsum dolor sit amet.</span> 
             </div> 
           </header> 
         </div> 
        </div> 
       </div> 
      </div> 

     <!-- Banner Wrapper --> 
      <div id="banner-wrapper"> 
       <div class="container"> 
        <div class="row"> 
         <div class="12u"> 

          <!-- Banner --> 
           <div id="banner" class="box"> 

            <div> 
             <div class="row"> 
              <div class="7u"> 
               <h2>Morbi ultrices ultrices sem, sed placerat tortor pulvinar sed. </h2> 
               <p>Nullam nec nulla nisi. Nunc mauris mi, pharetra eu placerat vitae, luctus nec enim.</p> 
              </div> 
             </div> 
            </div> 

           </div> 

         </div> 
        </div> 
       </div> 
      </div> 
     <!-- Footer Wrapper --> 
      <div id="footer-wrapper"> 
       <footer id="footer" class="container"> 
        <div class="row"> 
         <div class="3u"> 

          <!-- Contact --> 
           <section class="widget-contact last"> 
            <h2>Contact Us</h2> 
            <ul> 
             <li><a href="https://twitter.com/App4UBr" class="fa fa-twitter solo"><span>Twitter</span></a></li> 
             <li><a href="https://www.facebook.com/App4UBr" class="fa fa-facebook solo"><span>Facebook</span></a></li> 
            </ul> 
            <p>Av. João, 1234<br /> 
            São Paulo, São Paulo<br /> 
            (11) 1234-1234</p> 
           </section> 

         </div> 
        </div> 
        <div class="row"> 
         <div class="12u"> 
          <div id="copyright"> 
           &copy; App4U Sistemas de Informação Ltda. All rights reserved. 
          </div> 
         </div> 
        </div> 
       </footer> 
      </div> 

    </body> 
</html> 

UPDATE-2-END

수 누구든지 나를 위해 머리를 내밀어? 건배.

+0

(1) 또는 (2)에있는 코드의 샘플을 제공해주십시오. 또한 (3)의 "ONLY"코드 위에 PHP 스크립트가 있습니까? – Michael

+0

"작동하지 않음"을 정의하십시오. 오류가 있습니까? 빈 페이지? – bjb568

+0

PHP가 아닌 HTML 출력을 보여줍니다. 문제는 클라이언트에 있습니다. –

답변

0

모든 조언을 주셔서 감사합니다. 제안 된 세 가지 옵션 제안을 시도했지만 실제로 트릭을 만들 때 "phss"폴더에 "css"폴더를 넣었습니다.

그래서 나는 그것이 멋진 움직임이 아니라 생각이 들었다고 생각합니다. 감사합니다. .

0

상대 경로를 사용해야합니다.

CSS 파일에 /이라는 상대 파일 경로를 지정해야합니다.

비 상대 : <link rel="stylesheet" media="all" href="css/skin.css">

상대 : <link rel="stylesheet" media="all" href="/css/skin.css">

0

이 있습니다

include("../jude/updatecomplete.html"); 

그리고 그것에서 이런 일이있는 HTML 파일을 포함한다 :

<LINK href="../css/styles.css" rel="stylesheet" type="text/css" /> 

HTML 파일에 대한 참조가 있습니다. 그 위치에 관련된 CSS. 그러나 PHP 파일은 다른 위치에 있으므로 PHP 파일의 출력에 HTML 파일의 내용이 인쇄되면 브라우저는 CSS 파일을로드 할 수 없습니다. 상대 경로가 PHP 파일의 위치를 ​​기반으로 올바르지 않기 때문입니다.

0

PHP 스크립트가 포함 된 HTML의 다른 디렉토리에 있기 때문에 CSS가 작동하지 않습니다. 이렇게하면 HTML 파일에 포함 된 스타일 시트에 올바른 경로가 없습니다.

<link href="../css/style.css" rel="stylesheet">

그리고 당신은 PHP 스크립트하지만 직접하지 HTML 파일을 호출 할 때 작업을 시작하는 것을 볼 수 있습니다 : 그래서처럼 ../와 스타일 시트의 경로를 추가하십시오.

관련 문제