2015-11-07 53 views
-4

我有一些我的網站沒有正確託管PHP的代碼。切換到PHP兼容的服務器不是一種選擇。我如何將其更改爲HTML?如何將我的代碼從PHP更改爲HTML?

的index.php:

<head> 
     <link rel="stylesheet" type="text/css" href="CSS/index.css"> 
     <?php 
     include("common/common.php") 
     ?> 
    </head> 
    <body> 
     <?php 
      commonheader() 
     ?> 
     <h1>Coming Soon!</h1> 

的common.php:

<head> 
    <link rel="stylesheet" type="text/css" href="common.css"> 
</head> 
<?php 
    function commonheader() 
    { 
     ?> 
     <div class="header" 
      <nav> 
       <a href="index.php"><button type="button">Home</button></a> 
       <!--First Case (unnamed)--> 
       <button type="button"><span class="comingsoon">Coming soon!</span></button> 
       <!--Second Case (unnamed)--> 
       <button type="button"><span class="comingsoon">Coming soon!</span></button> 
       <a href="help.php"><button type="button">Help</button></a> 
      </nav> 
     </div> 
     <?php 
    } 
?> 

如果我需要附加的CSS文件,我可以。

+0

爲什麼downvotes?這是我做的嗎? – OldBunny2800

+0

https://httpd.apache.org/docs/2.2/howto/ssi.html並使用JS/Ajax。 –

+0

你可能得到了那些,因爲你沒有顯示任何努力。你的問題轉化爲「堆棧不是免費的代碼轉換服務」。 ;-) –

回答

1

你只需要刪除php code只有使用html

<head> 
     <link rel="stylesheet" type="text/css" href="CSS/index.css"> 

    </head> 
    <body> 
     <div class="header"> 
      <nav> 
       <a href="index.html"><button type="button">Home</button></a> 
       <!--First Case (unnamed)--> 
       <button type="button"><span class="comingsoon">Coming soon!</span></button> 
       <!--Second Case (unnamed)--> 
       <button type="button"><span class="comingsoon">Coming soon!</span></button> 
       <a href="help.html"><button type="button">Help</button></a> 
      </nav> 
     </div> 

     <h1>Coming Soon!</h1> 
+0

有沒有辦法讓它標準化,以便我可以在未來的網頁中使用它的網站? 例如: Foo.php: <?php commonheader(); ?> – OldBunny2800

+0

我相信你可以找到一個更好的方法來做到這一點...所以,不斷學習更多關於html的知識,你會發現你會想要標準化一個更好的代碼;) –

+0

我不明白,但隨你。感謝你的回答! – OldBunny2800

相關問題