advice about contaent managment for one hole page only

This is a discussion on "advice about contaent managment for one hole page only" within the Scripts and Online Services section. This forum, and the thread "advice about contaent managment for one hole page only are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Scripts and Online Services

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 14th, 2007, 10:34
Junior Member
Join Date: Aug 2006
Location: south australia
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
advice about contaent managment for one hole page only

I know there are allot of content management system for hole sites,
Drupal Geeklog Joomla Mambo Open Source PHP-Nuke phpWCMS phpWebSite Post-Nuke Siteframe TYPO3 Xoops, etc

but I was wandering what would be the best way to let someone edit a hole page, e.g. if all the had on their website was one page.

Or there was just one page a html illiterate person wanted to edit them self (e.g. www.domain.com/mypage/index.php with www.domain.com/mypage/admin/ with a WYSIWYG editor)- any cms out of the box installations for this or what would be the easiest to modify for one page editing. Sorry I am new to this and have no idea.
Reply With Quote

  #2 (permalink)  
Old Jul 14th, 2007, 18:45
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,619
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: advice about contaent managment for one hole page only

The best way would be to code it yourself...
I work with CMS myself and I'd never consider making a CMS for one page because I wouldn't see the point in it... For that reason I think you'll find it difficult to download an 'off-the-shelf' solution for what you need.

Vahing said that, it would be very simple to create something like that...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #3 (permalink)  
Old Jul 14th, 2007, 20:26
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 21
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: advice about contaent managment for one hole page only

I suppose if you do a really simple site for a client and they just want it as a portal with contact info and a single updatable what's happening now page it would be quite handy especially if you don't want to go to the expense of a product like contribute (if it still exists).

This would take no time though. Even I could do it and I'm a bit rubbish with all this php malarkey (though I'm getting better).

Pete.
Reply With Quote
  #4 (permalink)  
Old Jul 14th, 2007, 22:17
Up'n'Coming Member
Join Date: Sep 2006
Location: UK
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Re: advice about contaent managment for one hole page only

This didn't take very long to make, but it doesn't have any WYSIWYG features.
Make sure there is some type of authentication method before allowing use of edit.php and editpage.php

A table called "website" with a column "page" would be needed before this code would work.

edit.php:
PHP: Select all

<?php


/* Often this info is in a config file, but if it is only a couple of pages, it could stay here */

$db_username="username";
// database username
$db_password="password";
// database password
$database="mydatabase_db";
// name of database

/* connect to db */
mysql_connect("localhost",$db_username,$db_password);
// connect to database using login info specified above

@mysql_select_db($database) or die( "Unable to select database");

$query "SELECT * FROM website";
// select all from website table SQL query
$result mysql_query($query);
// run SQL query

$page mysql_result($result,0,"page");
// plop everything from page column, row 0 (the first row - we have only one), into $page variable

?>

<form action="editpage.php" method="post" >
Page: <br/>
<textarea cols="70" rows="15" name="editpage">
<? echo "$page"?>
</textarea>
<input type="submit" value="Edit Page" name="submit"><br />
</form>
editpage.php:
PHP: Select all

<?php


$db_username
="username";
$db_password="password";
$database="mydatabase_db";


/* connect to db */
mysql_connect("localhost",$db_username,$db_password);

@
mysql_select_db($database) or die( "Unable to select database");

$editpage $_POST['editpage'];
// put all the textarea text into $editpage variable

if (get_magic_quotes_gpc()) {
   
// if magic quotes is on, strip slashes from $editpage
   
stripslashes($editpage);
}
$editpage mysql_real_escape_string($editpage);
// prevent anything messing with the update query

$updatequery "UPDATE website SET page='$editpage'";
$runupdate mysql_query($updatequery);
// update the page data

echo("
Page has been updated!
"
);

?>
And finally the page that will display the page:
page.php
PHP: Select all

<html>

<head>
<!-- All your head stuff here -->
</head>
<body>
Lorum ipsum etc.
<div id ="content">
<?php
$db_username
="username";
$db_password="password";
$database="mydatabase_db";

/* connect to db */
mysql_connect("localhost",$db_username,$db_password);

@
mysql_select_db($database) or die( "Unable to select database");

$query "SELECT * FROM website";
$result mysql_query($query);

$page mysql_result($result,0,"page");
$page nl2br("$page");
// adds a <br> before \n so that newlines the editor specifies are mirrored on the page

echo("$page");
// outputs the page
?>
</div>
</body>
</html>
P.S. It's untested. Let me know if it doesn't work.

Last edited by balaclave; Jul 14th, 2007 at 22:32.
Reply With Quote
  #5 (permalink)  
Old Jul 15th, 2007, 13:43
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,619
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: advice about contaent managment for one hole page only

Well done balaclave. It's members like you that make these forums the best around... I'd add to your reputation points if it was working!
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #6 (permalink)  
Old Jul 15th, 2007, 13:49
Up'n'Coming Member
Join Date: Sep 2006
Location: UK
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Re: advice about contaent managment for one hole page only

Quote:
Originally Posted by spinal007 View Post
Well done balaclave. It's members like you that make these forums the best around... I'd add to your reputation points if it was working!
Thanks.
You can just buy me some e-pizza instead.
This box is getting empty: izza:
Reply With Quote
  #7 (permalink)  
Old Jul 17th, 2007, 07:13
Junior Member
Join Date: Aug 2006
Location: south australia
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Re: advice about contaent managment for one hole page only

That is a very nice code and I thank you greatly for trying to help me, but I am having problems connecting to row 0 on MySQL table. This is the error meaage:

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 2 in /home/seehereo/public_html/onepagecms_test/edit.php on line 23

This is my test site: http://www.seehereonline.com/onepagecms_test/edit.php

THis is how I made my table and column:

setup2.php
Code: Select all
<?php
// Make a MySQL Connection
mysql_connect("localhost", "seehereo_onepage", "password") or die(mysql_error());
mysql_select_db("seehereo_onepage") or die(mysql_error());
// Create a MySQL table in the selected database
mysql_query("CREATE TABLE content(
page longtext NOT NULL)")
 or die(mysql_error());  
echo "Table Created!";
?>
I accidentally used "content" for the table instead of "webpage" so I changed this in your code to match

If we get this working I think I will create a setup.php and config.php and password protect the edit.php ...and may dedicate a site to this script and list my and your paypal account(if you have one) for donations

Last edited by vandiermen; Jul 17th, 2007 at 08:30.
Reply With Quote
  #8 (permalink)  
Old Jul 17th, 2007, 13:27
Up'n'Coming Member
Join Date: Sep 2006
Location: UK
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Re: advice about contaent managment for one hole page only

Quote:
I accidentally used "content" for the table instead of "webpage" so I changed this in your code to match
So is the code now working?
Reply With Quote
Reply

Tags
contaent managment

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
XSS Hole in PHP_SELF prydie Other Programming Languages 2 Mar 24th, 2008 17:47
Advice on creating a members only page Oak PHP Forum 3 Feb 13th, 2008 22:13
Advice on page widths etc sing2trees Web Page Design 7 Nov 21st, 2007 19:34
email managment software jas4 Webforumz Cafe 4 Jul 20th, 2007 10:09
Help, hole in layout kokuszka Web Page Design 4 Apr 26th, 2006 11:37


All times are GMT. The time now is 19:51.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43