我的php / html / mysql cms有问题

时间:2014-03-12 09:37:57

标签: php mysql content-management-system

我的cms有些麻烦。 (我自己的cms)

  1. 如果我写www.example.com/example它工作正常,但如果我写www.example.com/example/ / example的内容dosent show。只显示标题,导航栏,侧边栏和页脚。

  2. 我需要在site_content(在mysql表中)编写php代码,目前我只能写html)

  3. 似乎google的蜘蛛无法找到我的网页。我可以用谷歌创建站点地图的任何方式(当我在mysql表(站点)中添加新页面时,站点地图需要自动更新

  4. mysql的结构

    DataBase:网站     表:站点         SITE_ID         SITE_LINK
            网站标题         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>
    

    任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分: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. 使用'write php code'我假设你的意思是将PHP代码保存到数据库中?这与保存HTML代码的方式相同。但是,当您再次从数据库加载它时,您可以选择将其显示为文本或使用eval()将其作为PHP代码执行。我个人会看到在PHP中包含模板。看看这个:https://stackoverflow.com/a/19603372/3079918

  3. 您提交网站多久了?谷歌可能需要几周的时间才能完成。如果您确实需要站点地图,请构建一个脚本,该脚本将从数据库加载您的页面并将其构建为.xml文件。请查看有关如何将站点地图提交给Google的http://www.google.com/webmasters/