So im just starting off with OOP, and im making a CMS with OOP Modules, and it installs all data from the OOP Module to a MySQL Database, but im not sure if this is right. (would it require $this->varname, or $obj = new Module(); )
<?php
// This File is only used as a template for Module Installers
// CMS Version supported - 1.2+ (1.1 is Manual Install)
//
class Module {
public $name; // Module Name
public $author; // Module author
public $version; // Module Version
public $adminOnly; // Defines if Admin only or User enabled (1 = admin only, 0 = users & admins)
public $siteURL; // HTTP 1.0 Form (http://www.url.com)
public $authorEmail; // Usually used in BETA Testing Modules &
// define methods
public function install() {
include("settings.php");
connect();
$query = mysql_query("INSERT INTO modules (name, author, version, adminOnly, siteURL, authorEmail) VALUES('$this-
>name', '$this->author', '$this->version', '$this->adminOnly', '$this->siteURL', '$authorEmail')");
}
}
?>
Question
Jakehh
Hey Guys,
So im just starting off with OOP, and im making a CMS with OOP Modules, and it installs all data from the OOP Module to a MySQL Database, but im not sure if this is right. (would it require $this->varname, or $obj = new Module(); )
<?php // This File is only used as a template for Module Installers // CMS Version supported - 1.2+ (1.1 is Manual Install) // class Module { public $name; // Module Name public $author; // Module author public $version; // Module Version public $adminOnly; // Defines if Admin only or User enabled (1 = admin only, 0 = users & admins) public $siteURL; // HTTP 1.0 Form (http://www.url.com) public $authorEmail; // Usually used in BETA Testing Modules & // define methods public function install() { include("settings.php"); connect(); $query = mysql_query("INSERT INTO modules (name, author, version, adminOnly, siteURL, authorEmail) VALUES('$this- >name', '$this->author', '$this->version', '$this->adminOnly', '$this->siteURL', '$authorEmail')"); } } ?>Link to comment
Share on other sites
1 answer to this question
Recommended Posts