|
Posted by "Mark Steudel" on 11/28/05 19:13
Store each paragraph text in a database
Table 1 = tblPage
id Name
1 Welcome Page
2 About Page
Table 2 = Content
id pageid content
1 1 This is some content in a paragraph
2 1 This is some more content
3 1 This is the last content on this page
4 2 Some about content
Then when you display your page you pass the page id through the URL like:
http://www.domain.com/page.php?pageid=1
// get the page id of course do some validating is_numeric etc
$id = $_GET['pageid'];
// using pear db package
$res =& $db->query ( "SELECT * FROM tblContent WHERE pageid = '".$id."'" );
// loop through data and display it with an edit link
while( $res->fetchInto( $objData ) )
{
echo "<p>".$objData->content."<a
href=\"edit.php?pageid=".$objData->od."\">Edit</a></p>";
}
Your edit page would then have some code that would load the content into a
text area or wywsiwig editor or something .... You would then also have to
add functionality where a user could add a paragraph and what order you
would want those paragraphs to show up in, delete paragraphs.
Hope that helps.
Mark
-----Original Message-----
From: Shaun [mailto:shaunthornburgh@hotmail.com]
Sent: Saturday, November 26, 2005 4:24 AM
To: php-general@lists.php.net
Subject: [PHP] Adding links to HTML for a CMS
Hi,
I am trying to create my own CMS. To being with I want to let users edit
anything within a <p> tag.
I want to have a menu to the left and display the webpage in the rest of the
page, and for each set of <p> tags I want the user to be able to click on
the link to edit that paragraph.
My problem is how can I include a webpage in my CMS and for each <p> tag
wrap an <a href""> tag araound it?
Thanks for your advice.
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
[Back to original message]
|