Storing (html and php) Content in MySQL - help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have been trying to wrap my mind around how to accomplish this for a few
days, and done estensive searching on Google.

I know there are free CMS systems available for download, but I want to
write my own code so I can maintain it and extend it, I need it to be
customizable.

So far what I have worked up is this:

The mysql row contains a page_id field, title field, content field, and
sidebar content field.

in index.php:
include("module.php")
$username = findLoggedinUsername()

eval ($content)


in module.php:
$result = mysqlquery("select * from content where page_id = get['id']")
$row = fetcharray9$result)
$content = $row['content']
$title = $row['title']

etc.

The content mysql field contains:

$ct = <<<END
<p>Welcome $username, to the interweb</p>
END;

echo $ct


In the heredoc, I can use variables like $username, but not like
$row['username'].

So far this method works just fine, however I want to be able to edit the
content through the website itself. Am I on the right track or is this
awkward? I am implementing a new, login system (mine isn't secure enough)
and I want to implement it correctly.

How should I go about storing content (which may or may not include php)
into a page content field?

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux