Hey Kumel
I thought I would create a tutorial for this so have written it up (tutorial not yet submitted) but hopefully this will help you. I have had to make certain assumptions so if any step needs clarification please drop me a line.
In the first place you need to add a new column to your 'blog' table - lets call the new column 'Permalink' and set it to varchar like you have set the 'title' column.
Permalink will store the SEO friendly part of the URL and we will get the _insert or _results pages to change a title from this format 'This is the blog title' to 'this_is_the_blog_title' - you can see an example of that here http://www.motley.co.uk/blog-article/Dont-let-bootstrapping-lead-to-handcuffing
Once you have added that column to the table, we need to open up the blog _insert and _update pages (I am not sure what you have named them)
On the _update page you need to click on 'Update Record' that you find in the server behaviours area. In the resulting Data Assist pop up window you should have 2 tabs: General and Bindings - click on 'Bindings' and look for the column named 'Permalink' that we created at the beginning. When you find it, highlight it, set the type to 'text' and then click on the lightning bolt. A new window will open which allows you to bind the form elements to the relevant columns. Bind the entry called 'title' (using your column name) - when you select the binding it should look like this <?php echo((isset($_POST["title"]))?$_POST["title"]:"") ?>
Click OK, and then OK again
Now, in the code view of the page you need to navigate to the Update Record which you can get to quickly by clicking the same in the server behaviours. In this area there will be 2 instances of the following:
$WA_AB_Split . "".((isset($_POST["title"]))?$_POST["title"]:"") ."" .
change the 2nd instance to this:
$WA_AB_Split . "".((isset($_POST["title"]))?preg_replace('/[^0-9a-z(),]/i','-',str_replace(array("’ ","br ","<",">","' ","%","!","?","@","\-","- ","/ ",".","\"","_","– ","\'","*","#","+ "),"",strtolower(stripslashes(str_replace("&", "and", str_replace("é", "e", $_POST["title"])))))):"") ."" .
This is basically to take whatever the user enters in as a title (eg This is a blog post) and changes it to this_is_the_blog_post
Now you need to do the same for the _insert page. (Update Record will be Insert Record etc)
The back end is now all set and we just need to address the .htaccess file which does the mod_rewriting and change the front end so that the new SEO friendly URL will display instead of ?id=1,2,3....... etc
In the front end you should have 2 blog pages. One shows the results of all blog posts (lets call this one blog.php) and the other is the one that displays the content of each blog article (lets call this one blog-article.php)
Lets open up blog.php.
Here I am making the assumption that your recordset is named 'Blog' - if it isnt, just change the rs references to whatever you have called it.
On blog.php we need to change the link structure from something that looks like this:
<a href="blog-article.php?BlogID=<?php echo($Blog->getColumnVal("BlogID")); ?>"> <?php echo($Blog->getColumnVal("BlogTitle")); ?></a>
the onpage url structure for the above would be /blog.php?BlogID=1,2,3...etc
to this:
<a href="article/<?php echo $Blog->getColumnVal("Permalink"); ?>"> <?php echo $Blog->getColumnVal("title"); ?></a>
the onpage url structure for this would look something like this /article/this_is_a_blog_post
Now lets open up blog-article.php
On this page we need to change the recordset so that the page is able to render the correct page based on the mod_rewrite that we will be doing in the .htaccess file at the end of this.
The recordset that you use to access the blog data needs to loo like this:
(if you're using MySQLi)
<?php
$Blog = new WA_MySQLi_RS("PageContents",$DBConnection,1);
$Blog->setQuery("SELECT * FROM blog WHERE id = ? OR Permalink = ?");
$Blog->bindParam("i", "".(isset($_GET['id'])?$_GET['id']:"") ."", "-1"); //paramOffersID
$Blog->bindParam("s", "".(isset($_GET['perm'])?$_GET['perm']:"") ."", "-1"); //paramPermalink
$Blog->execute();
?>
(if you're using MySQL)
<?php
$colname_BlogPerm = "-1";
if (isset($_GET['perm'])) {
$colname_BlogPerm = $_GET['perm'];
}
$colname_Blog = "-1";
if (isset($_GET['id'])) {
$colname_Blog = $_GET['id'];
}
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_Blog = sprintf("SELECT * FROM blog WHERE id = %s OR Permalink = %s", GetSQLValueString($colname_Blog, "int"), GetSQLValueString($colname_BlogPerm, "text"));
$Blog = mysql_query($query_Blog, $PowerCMSConnection) or die(mysql_error());
$row_Blog = mysql_fetch_assoc($Blog);
$totalRows_Blog = mysql_num_rows($Blog);
?>
Also on the blog-article.php page because we are changing the directory structure on the fly, we need to tell the page what the root of the site is so that it is able to reference all the files correctly. To do this, add this just after the opening <html> tag
on a local server: <base href="http://localhost/foldername/" />
on a live page: <base href="http://www.domainname.co.uk/" />
don't forget the trailing / in either of those examples
Save the blog.php and blog-article.php pages if you havent already done so.
Now we need to create the rewrite in the .htaccess file.
All you now need to do is create (or edit if you already have one) using the following code.
RewriteEngine on
RewriteRule ^article/(.*)$ blog-article.php?perm=$1 [NC,L,QSA,T=application/x-httpd-php]
Save and upload
Save that and now upload all the files and you should have a similar set up to the one found at http://www.motley.co.uk/blog.php
I hope that this helps but if you need any help or clarification please do let me know
All the best
Jamie