CMS - First Time
#1
Posted 02 May 2006 - 02:43 PM
I have learnt quite a bit of PHP but have never created an actual script 100% by myself, I have modified scripts but how would I go about creating a Content Management System? I know how to connect to a MySQL Database and how to add a table but where do I go from there? Do I query the Database and if so for what and then to display it do I just use something like mysql_grab I am really confuddled.
I want the basic feautres for the CMS as I need to be more and more proficient in PHP so I would love to have a bit of input and direction to a few baselines of the following:
Displaying News
Admin Pane
- Add News
- Delete News
- Edit News
Thanks for your help,
Danl
#2
Posted 02 May 2006 - 03:21 PM
That is my website, it is NOT done, however it is a CMS in devellopment. With whats there you should be able to get the hang of how its made.
In my CMS what i've done is attached each page I have to a number. Then when a user types in or is linked to that specific number the CMS loads the corresponding page. So I have a function that looks at the number then goes into the database and looks at what page it is. Then loads it in. For instance say 1 was News so my script would then say include('News.php');
Its quite simple. Then all you need are CMS functions, perhaps a forum or a Private Messaging system.
Hope this helps!
#3
Posted 02 May 2006 - 03:23 PM
If your quite new with php i would try and make parts of it bit by bit, so a news script firs lets say.
Try looking over some tutorials in the db at news scripts then go about making your own and getting used to how it all works.
#4
Posted 02 May 2006 - 04:05 PM
deadly, on May 2 2006, 09:23 PM, said:
If your quite new with php i would try and make parts of it bit by bit, so a news script firs lets say.
Try looking over some tutorials in the db at news scripts then go about making your own and getting used to how it all works.
Thats what I have done so far, I heavily edited Project Rages but never seemed to get it how I wanted it.
#5
Posted 02 May 2006 - 06:20 PM
$query1 = "SELECT * FROM news WHERE ID'$id'; $result = mysql_query($query) or die(mysql_error());
Or am I just chasing a whole different thing?
#6
Posted 02 May 2006 - 07:52 PM
$result = mysql_query("SELECT * FROM news WHERE ID'$id');
while($row = mysql_fetch_array($result)){
echo "
<textarea name='tutorial' cols='96' rows='20' id='tutorial'>".$row['content']."</textarea>
";
So lets look at the above code
$result = mysql_query("SELECT * FROM news WHERE ID='$id');
Thats our result! Its what we tell it to get from the sql table called News!
now while $row=$result! it should mean anything under .$row['XXXX'].
will be getting out of the news table!
So if you have author row under the news table, you can do this
<input name="author" size="20" value=".$row['author']."> And that will echo anything under the author row!
I dont know if that helped at all, but just keep looking at tutorials!
#7
Posted 02 May 2006 - 07:59 PM
Change: $query1 = "SELECT * FROM news WHERE ID'$id'; To: $query1 = "SELECT * FROM news WHERE (ID='$id')";
On my site http://www.mtbzu.com
I used ColdFusion but PHP will do the samething. I have it so my index calls my news from my news table.
All my pages at the top all the info is pulled out of a database and sent into a table area for it all. The comments area uses a database too and does the samething. Although the complecated area of the site was the link "Mountain Biking" That page is made via a script. In my admin panel i can type info in and type a url for a image and other things, then it is all stored in a table with a page name. Then my menu script pulls all the activated pages out of the database and creates a link to those pages.
This could all be done with PHP although i used ColdFusion because my host had it and Dreamweaver makes it so easy.
#8
Posted 03 May 2006 - 01:55 AM
When I make stuff it really helps me making things my own way, not the way all the other CMS (as you see in tutorials are build), but these do really help in the beginning process.
Please try a tutorial-search, there should be enough tutorials on how to build both basic CMS and news-administration systems.
#12
Posted 04 May 2006 - 03:45 AM
Wybe, on May 4 2006, 09:30 AM, said:
Yes, You have to correct one line otherwise you grt an error here is the correct code it's just a mispelling of the IF statement.
<? include('dbconnect.php'); ?>
<form action="addnews.php" method="post">
<br>Title:
<br><input name="title" type="text" value="Title">
<br>Author:
<br><input name="user" type="text" value="Name">
<br>Date:
<br><input name="date" type="text" value="<?php print date("F j Y"); ?>">
<br>Icon:
<br><input name="icon" type="text" value="Icon URL">
<br>Message:
<br><textarea name="message" cols="40" rows="6" value="Message"> </textarea>
<br>Password:
<br><input name="password" type="password">
<br><input name="submit" type="submit" value="Submit">
<?php $password="yourpassword"; //change this to the password you want if ($_POST['password']==$password){ //DO NOT CHANGE THIS LINE
if (isset($_POST['submit'])) {
include("dbconnect.php");
$title = addslashes(strip_tags($_POST['title']));
$user = addslashes(strip_tags($_POST['user']));
$icon = addslashes(strip_tags($_POST['icon']));
$message = $_POST['message'];
$date = addslashes(strip_tags($_POST['date']));
$sql = "INSERT INTO newscms SET title='$title', user='$user', icon='$icon', message='$message', date='$date'";
if (mysql_query($sql)) {
// this is the statement fixes
echo("Your news has been added.");
} else {
echo("Error adding entry: " . mysql_error() . "");
}
}
?>
Edited by DanWilliamson, 04 May 2006 - 03:46 AM.
#13
Posted 04 May 2006 - 04:20 AM
#14
Posted 04 May 2006 - 07:45 AM
f (mysql_query($sql)) {
While it should be:
if (mysql_query($sql)) {
// this is the statement fixes
#15
Posted 05 May 2006 - 06:19 AM
http://www.jemjabella.co.uk/post.php?title...ng_your_own_cms
#16
Posted 07 May 2006 - 11:58 AM
#17
Posted 07 May 2006 - 01:49 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
