dsfsw1233 2014-03-12 09:37
浏览 51

我的php / html / mysql cms有问题

I have some trouble with my cms. (My own cms)

  1. If I write www.example.com/example It works fine but if I write www.example.com/example/ the /example's content dosent show. Only the header, navigationbare, sidebar and footer shows up.

  2. I need to write php code in site_content (In the mysql table) currently I can only write html)

  3. It seems that google's spiders cant find my pages. Any way I can create a sitemap for google (The sitemap needs to get updated automaticaly when I add a new page in the mysql table (sites)

Structure of mysql

DataBase: website Table: Sites site_id site_link
site_title site_content

My 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>

And my .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>

Can anybody please help me??

  • 写回答

1条回答 默认 最新

  • dry0106 2014-03-12 10:14
    关注
    1. It could be that your .htaccess is only looking at the root directory of the site. /example/ is a new directory. I use a similar script that does include subdirectories, maybe you can use this:

      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. With 'write php code' I assume you mean saving php code to the database? That works in the same way as saving html code. However when you're loading it from the database again you can choose to display it as text or execute it as PHP code using eval(). Personally I'd look at including templates in PHP. Have a look at this: https://stackoverflow.com/a/19603372/3079918

    3. How long ago did you submit your website? It can take a few weeks before Google picks it up. If you really need a sitemap, build a script that will load your pages from the database and build them into a .xml file. Have a look at http://www.google.com/webmasters/ on how to submit the sitemap to Google.

    评论

报告相同问题?

悬赏问题

  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?