trate de usar wordpress multiusuario y nucleus pero no me satisfacen en lo que necesito, por lo tanto en lo que encuentro una solucion empece a escribir el sistema de blogs, consegui codigo ya echo solo para ahorrar tiempo!! pero es solo para crear uno, asi que necesito hacerlo para crear los que necesite.
para crear el sistema estoy usando clases, la 1era es para crear el blog.
Código PHP:
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of BlogPost
*
* @author aikimobile
*/
class BlogPost {
var $id;
var $title;
var $post;
var $author;
var $tags;
var $datePosted;
function __construct($inId=null, $inTitle=null, $inPost=null, $inPostFull=null, $inAuthorId=null, $inDatePosted=null)
{
if (!empty($inId))
{
$this->id = $inId;
}
if (!empty($inTitle))
{
$this->title = $inTitle;
}
if (!empty($inPost))
{
$this->post = $inPost;
}
if (!empty($inDatePosted))
{
$splitDate = explode("-", $inDatePosted);
$this->datePosted = $splitDate[1] . "/" . $splitDate[2] . "/" . $splitDate[0];
}
if (!empty($inAuthorId))
{
$query = mysql_query("SELECT first_name, last_name FROM people WHERE id = " . $inAuthorId);
$row = mysql_fetch_assoc($query);
$this->author = $row["first_name"] . " " . $row["last_name"];
}
$postTags = "No Tags";
if (!empty($inId))
{
$query = mysql_query("SELECT tags.* FROM blog_post_tags LEFT JOIN (tags) ON (blog_post_tags.tag_id = tags.id) WHERE blog_post_tags.blog_post_id = " . $inId);
$tagArray = array();
$tagIDArray = array();
while($row = mysql_fetch_assoc($query))
{
array_push($tagArray, $row["name"]);
array_push($tagIDArray, $row["id"]);
}
if (sizeof($tagArray) > 0)
{
foreach ($tagArray as $tag)
{
if ($postTags == "No Tags")
{
$postTags = $tag;
}
else
{
$postTags = $postTags . ", " . $tag;
}
}
}
}
$this->tags = $postTags;
}
}
?>
Código PHP:
<?php
include 'blogpost.php';
$connection = mysql_connect('localhost', 'username', 'password') or die ("<p class='error'>Sorry, we were unable to connect to the database server.</p>");
$database = "nettuts_blog";
mysql_select_db($database, $connection) or die ("<p class='error'>Sorry, we were unable to connect to the database.</p>");
function GetBlogPosts($inId=null, $inTagId =null)
{
if (!empty($inId))
{
$query = mysql_query("SELECT * FROM blog_posts WHERE id = " . $inId . " ORDER BY id DESC");
}
else if (!empty($inTagId))
{
$query = mysql_query("SELECT blog_posts.* FROM blog_post_tags LEFT JOIN (blog_posts) ON (blog_post_tags.postID = blog_posts.id) WHERE blog_post_tags.tagID =" . $tagID . " ORDER BY blog_posts.id DESC");
}
else
{
$query = mysql_query("SELECT * FROM blog_posts ORDER BY id DESC");
}
$postArray = array();
while ($row = mysql_fetch_assoc($query))
{
$myPost = new BlogPost($row["id"], $row['title'], $row['post'], $row['postfull'], $row["author_id"], $row['dateposted']);
array_push($postArray, $myPost);
}
return $postArray;
}
?>
Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<div id="main">
<h1>simple blog</h1>
<div id="blogPosts">
</div>
</div>
<?php
include 'includes/includes.php';
$blogPosts = GetBlogPosts();
foreach ($blogPosts as $post)
{
echo "<div class='post'>";
echo "<h1>" . $post->title . "</h1>";
echo "<p>" . $post->post . "</h1>";
echo "<span class='footer'>Posted By: " . $post->author . " Posted On: " . $post->datePosted . " Tags: " . $post->tags . "</span>";
echo "</div>";
}
// put your code here
?>
</body>
</html>
la base es la parte del blog asi el usuario podra ver sus entradas para eso uso la clase blogpost y estoy haciendo otra clase para crear la web, asi los usuarios podran crear su web y usar la parte de blogpost para crear la plantilla y asi publicar..
a continuacion mi clase para la web
Código PHP:
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of Webblog
*
* @author aikimobile
*/
class Webblog {
var $idweb;
var $Webname;
var $post;
var $Owner;
var $dateCreated;
var $URL;
function __construct($inIdweb=null, $inWebname=null, $inPost=null, $inPostFull=null, $inOwnerId=null, $inDateCreated=null, $inURL=null)
{
}
}
?>
saludos..................