KaareZ
KaareZ

Reputation: 645

I have trouble with my 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??

Upvotes: 0

Views: 79

Answers (1)

magnetronnie
magnetronnie

Reputation: 505

  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.

Upvotes: 1

Related Questions