Private Server CMS

11/29/2013 03:28 .Light#1
Alright so I've been working on a CMS [Content Management System] for a Conquer Online Private Server. So far, this is what I have:



This is the point where I am stuck...What I need it to do, for every different id in the 'articles' database it needs to have a new box. A new box meaning the css coding around it so that it looks good. Kind of like this:

PHP Code:
<div class="main main_title"TITLE PHP CODE </div>
<
div class="main main_content">CONTENT PHP CODE</div>
<
div class="main main_bottom">BOTTOM BORDER CSS</div
So for the title it needs to have the "main main_title" div tags around it.
The contect needs "main main_content" div tags around it.
The bottom border can just be put in at the end.

Not sure if this is the right spot for this, it is an idea that I am planning on releasing for the private server community, just need a little help (;

Any help is appreciated and please, if you're not going to help, please don't comment! xD
11/29/2013 04:03 turk55#2
Model View Controller
11/29/2013 04:08 Super Aids#3
Well that was some messy and ugly code.
11/29/2013 04:09 .Light#4
Quote:
Originally Posted by turk55 View Post
Model View Controller
Okay, so I have looked into it, I understand the concept. I just don't understand how I would implement it into my coding. Any examples you can show me? Or start on my coding so I can see it in use.

Quote:
Originally Posted by Super Aids View Post
Well that was some messy and ugly code.
Hey, at least I'm trying? Thanks for stating the obvious lol
11/29/2013 05:59 Spirited#5
Quote:
Originally Posted by turk55 View Post
Model View Controller
^ This is absolutely correct. I'm glad someone is on board with web servers.
@Light, if you're not a programmer, I'd recommend just a very simple PHP website. Nothing too complicated. If you're a programmer and you're comfortable with a programming language, I'd use a web server API such as ASP.NET (C#) or JSP (Java). You can continue using PHP as well, I'm sure there are many APIs out there with templates if you need a helping hand.
11/29/2013 07:37 .Light#6
Quote:
Originally Posted by Fang View Post
^ This is absolutely correct. I'm glad someone is on board with web servers.
@Light, if you're not a programmer, I'd recommend just a very simple PHP website. Nothing too complicated. If you're a programmer and you're comfortable with a programming language, I'd use a web server API such as ASP.NET (C#) or JSP (Java). You can continue using PHP as well, I'm sure there are many APIs out there with templates if you need a helping hand.
Thanks for the reply, I'll see if I can get it figured out.
11/29/2013 11:27 turk55#7
You don't really need a api to write a mvc model in php.

[Only registered and activated users can see links. Click Here To Register...]
11/30/2013 10:30 .Light#8
I got it working xD Thanks to someone on HackForums lol

PHP Code:
<?php $database = array(
    
"host" => "xx.xxx.xx.xxx",
    
"dbname" => "co",
    
"user" => "user",
    
"pass" => "pass"
);

$dbh = new PDO("mysql:host={$database['host']};dbname={$database['dbname']}"$database['user'],$database['pass']);
$articles $dbh->query("SELECT * FROM `articles` ORDER BY id DESC");
foreach(
$articles as $article){
    echo 
"<div class='main main_title'> {$article['title']}</align></div>";
    echo 
"<div class='main main_content'>{$article['content']}</br><div align='right'>-{$article['author']}</div></div>";
    echo 
"<div class='main main_bottom'></div>";


?>
11/30/2013 14:41 turk55#9
Quote:
Originally Posted by .Light View Post
I got it working xD Thanks to someone on HackForums lol

PHP Code:
<?php $database = array(
    
"host" => "xx.xxx.xx.xxx",
    
"dbname" => "co",
    
"user" => "user",
    
"pass" => "pass"
);

$dbh = new PDO("mysql:host={$database['host']};dbname={$database['dbname']}"$database['user'],$database['pass']);
$articles $dbh->query("SELECT * FROM `articles` ORDER BY id DESC");
foreach(
$articles as $article){
    echo 
"<div class='main main_title'> {$article['title']}</align></div>";
    echo 
"<div class='main main_content'>{$article['content']}</br><div align='right'>-{$article['author']}</div></div>";
    echo 
"<div class='main main_bottom'></div>";


?>
That has nothing to do with MVC (Model View Controller), click the link I posted in my previous post for more info about Model View Controller and how to set one up.

Note: Sooner or later you can't write your code like that anymore, PHP is OOP as of PHP 5.5

Edit: Added a small example.