2014-03-12 26 views
0

我有一些麻煩與我的CMS。 (我自己的CMS)我有麻煩與我的PHP/HTML/MySQL的CMS

  1. 如果我寫www.example.com/example它工作正常,但如果我寫www.example.com/example/的/例子內容dosent表演。僅顯示標題,導航標題,側邊欄和頁腳。

  2. 我需要寫在SITE_CONTENT PHP代碼(在MySQL表)目前我只能寫HTML)

  3. 看來,谷歌的蜘蛛不能找到我的網頁。什麼辦法可以創建谷歌站點地圖(站點地圖,需要的時候我在mysql表中添加一個新的頁面(網站)的MySQL

    數據庫

結構得到automaticaly更新:網站 表:網站 SITE_ID SITE_LINK
SITE_TITLE SITE_CONTENT

我的index.php

<html> 
    <?php 
     include_once 'includes/mysqlconnect.php'; 
     $url=$_SERVER['REQUEST_URI']; 

     $query = mysql_query("SELECT * FROM sites WHERE site_link = '$url' OR site_link = '$url/'"); 
     WHILE($rows = mysql_fetch_array($query)): 

     $site_id = $rows['site_id']; 
     $site_link = $rows['site_link']; 
     $site_title = $rows['site_title']; 
     $site_template = $rows['site_template']; 
     $site_content = $rows['site_content']; 

     endwhile; 
    ?> 

    <head> 
     <meta charset="UTF-8"> 
     <title>KasCraft | <?php echo $site_title;?></title> 
     <LINK rel="stylesheet" type="text/css" href="http://kascraft.com/themes/default.css"> 
    </head> 
    <body class="body"> 
     <div class="container-all"> 
      <div><?php include_once 'includes/header.php';?> 
      </div> 
      <div class="container"> 
       <div><?php include_once 'includes/navigationbar.php';?></div> 
       <div><?php include_once 'includes/rightsidebar.php';?></div> 


       <div class="content"> 
        <?php echo $site_content;?> 
       </div> 
       <div> 
        <?php include_once 'includes/footer.php'; ?> 
       </div> 
      </div> 
     </div> 
    </body> 
</html> 

而且我的.htaccess

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /index.php [L] 
</IfModule> 

任何人可以幫我?

+3

將php代碼存儲在mysql數據庫中並不是一個好主意。你有沒有聽說過模板引擎樹枝?它可能一開始有點多,但它也可能是......好......少了1995 ;-) –

+0

那麼,有沒有辦法呢? – KaareZ

+0

當然。如果你拼命想這樣做,請查看http://us3.php.net/manual/de/function.base64-encode.php和http://us3.php.net/manual/de/function.base64- decode.php –

回答

1
  1. 這可能是你的.htaccess只查看網站的根目錄。/example /是一個新目錄。我使用了類似的腳本,它包含子目錄,也許你可以使用這個:

    RewriteEngine On 
    
    #In case of these folder, halt and don't continue. 
    RewriteRule ^(images|javascripts|styles)($|/) - [L] 
    
    #In every other case (exept these extentions) open index.php. 
    RewriteRule !.(gif|htm|html|ico|jpg|jpeg|js|png|txt|xml)$ index.php 
    
  2. 隨着「寫PHP代碼」我以爲你說我救了PHP代碼的數據庫?這與保存html代碼的方式相同。但是,當您再次從數據庫加載它時,可以選擇將其顯示爲文本,或使用eval()作爲PHP代碼執行。就我個人而言,我會考慮在PHP中包含模板。看看這個:https://stackoverflow.com/a/19603372/3079918

  3. 你提交你的網站多久了? Google可能需要幾周時間才能完成。如果你真的需要一個網站地圖,建立一個腳本,將從數據庫中加載你的網頁,並將它們構建成一個.xml文件。關於如何將網站地圖提交給Google,請參閱http://www.google.com/webmasters/