Register for your free account! | Forgot your password?

You last visited: Today at 11:59

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Private Server CMS

Discussion on Private Server CMS within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2010
Posts: 183
Received Thanks: 74
Private Server CMS

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
.Light is offline  
Old 11/29/2013, 04:03   #2
 
turk55's Avatar
 
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 705
Model View Controller
turk55 is offline  
Thanks
1 User
Old 11/29/2013, 04:08   #3
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
Well that was some messy and ugly code.
Super Aids is offline  
Old 11/29/2013, 04:09   #4
 
elite*gold: 0
Join Date: Mar 2010
Posts: 183
Received Thanks: 74
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
.Light is offline  
Old 11/29/2013, 05:59   #5
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
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.
Spirited is offline  
Old 11/29/2013, 07:37   #6
 
elite*gold: 0
Join Date: Mar 2010
Posts: 183
Received Thanks: 74
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.
.Light is offline  
Old 11/29/2013, 11:27   #7
 
turk55's Avatar
 
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 705
You don't really need a api to write a mvc model in php.

turk55 is offline  
Old 11/30/2013, 10:30   #8
 
elite*gold: 0
Join Date: Mar 2010
Posts: 183
Received Thanks: 74
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>";


?>
.Light is offline  
Old 11/30/2013, 14:41   #9
 
turk55's Avatar
 
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 705
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.
Attached Files
File Type: zip sedenko.zip (5.3 KB, 1 views)
turk55 is offline  
Reply




All times are GMT +1. The time now is 11:59.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.