Tag Archives: writing

How to write a true, meaningful sentence


I’m trying to put together few very important things (VIT) about story-writing. Although I’m mainly concerned about story-writing, these simple rules may also be applied to any writing in English.
Before I start I should express my gratitude to one book – The Elements of Style, written by William Strunk Jr., in 1918. You may download the original copy of the book from this link: http://www.gutenberg.org/ebooks/37134
This article may be regarded as an extension of that book.

1) Control

It starts with control and ends with control.
You must learn to control everything in life. We love our freedom, but, we can’t harm anybody. Right? Think every word as an animate being. Treat them as your friends; not your slaves. The process is: one word, one sentence, one paragraph and finally one story. It starts with ‘one word’. So, be careful while you choose your words. You are free to select any word; it’s your freedom; but, if you opt for a wrong word you actually hurt it.

Read the rest of this entry

A CMS without database


//I’d like to add, as “code” is not working here, it remains incomplete.
//In near future I’d like to complete it….

Probably PHP has more flexibility than any other web language. For instance, you need not declare data type. You name your variables according to your requirements and later use them.

PHP vastly based on array concept. Few Global arrays like $_POST, $_SERVER and $_FILE play a major role throughout the process of building an application. So far I learnt, I can assure, for small or even medium size application PHP is unparalleled.

Let us build a Simple Content Management  System in PHP that will not take any help of database instead the content will be saved in a text file in a folder you mentioned.

Suppose you’d like to save your data in a folder called “cms”. So the path will be like this : cms/data.txt.

Let us start with a form that takes user inputs. The code is simple. Data passed through post method and we’ll catch them in a separate page.
First the form.

<code><fieldset><legend>Adding Contents</legend><form method=”post” action=”add_data.php”><br>Name : <input type=”text” name=”uname” /><br>Comments : <textarea name=”txt” cols=”50″ rows=”5″></textarea><br><br><hr><input type=”submit” value=”Send” /></form></fieldset>></code>

Next add_data.php page where we add contents in a text file:
$id = 1;

if (file_exists(“data.txt”))
$fp = fopen(“data.txt”, ‘r’);
$str = fread($fp, filesize(“data.txt”));
$str_arr = explode(“|”, $str);
foreach ($str_arr as $rec)
if ($rec)

$mode = (file_exists(“data.txt”))? ‘a’ : ‘w’;
$fp = fopen(“data.txt”, $mode);
$str = $id . “–” . $_POST[‘uname’] .”–” . $_POST[‘txt’] . “|”;

fwrite($fp, $str);

header(“location: index.php”);

As you see in the last line after you add data it redirects you to the index.php page. The code is:
$fp = fopen("data.txt", 'r');
$str = fread($fp, filesize("data.txt"));
$str_arr = explode("|", $str);

echo ”

“; echo “”;foreach ($str_arr as $rec)
if ($rec)
$rec_arr = explode(“–“, $rec);
foreach ($rec_arr as $col)
echo ”
“;echo “”;
echo “Edit“;
echo ”



echo “Add data“;

I’d like to edit and delete data on index page. But that part in the next blog. Till the next one happy coding!