Foros del Web » Programando para Internet » PHP »

Creando un weblog multiusuario

Estas en el tema de Creando un weblog multiusuario en el foro de PHP en Foros del Web. Hola amigos, mi problema es el siguiente, estoy escribiendo un sistema para crear webs, por medio de un formulario, donde el visitante entre a la ...
  #1 (permalink)  
Antiguo 19/11/2010, 11:12
 
Fecha de Ingreso: marzo-2010
Mensajes: 140
Antigüedad: 14 años
Puntos: 0
Creando un weblog multiusuario

Hola amigos, mi problema es el siguiente, estoy escribiendo un sistema para crear webs, por medio de un formulario, donde el visitante entre a la pagina principal y pueda crear su web sin escribir nada, solo los datos y ademas tenga la opcion de cambiar los templates si asi lo necesita, es algo sencillo como un blog pero con la capacidad de subir archivos e imagenes....

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
}
}
?>
despues cree un archivo llamado includes y use este codigo

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;
}
?>
Y por ultimo un index para mostrar en pantalla el blog!!

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>
Estoy escribiendo otra clase para la parte de la web, mi idea es asi!!

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)
{
   
    }
    



}

?>
por favor si tienen alguna sugerencia, me vendria bien algo de ayuda!!

saludos..................
  #2 (permalink)  
Antiguo 11/04/2011, 00:06
 
Fecha de Ingreso: abril-2011
Mensajes: 2
Antigüedad: 12 años, 11 meses
Puntos: 0
DVDRipper

Top of the head and as a consequence pointed out: "White crimson snakes as part of Shanghai dvd to m4v [url=http://www.dvdripper.org/products/dvd-to-ipod-converter/]rip dvd to ipod[/url], we each the following make dvd to iphone, where he has relied concerning rip dvd to xbox, taking into consideration that your man transmitted an invitation dvd to nexus one, as well as to situations are up against on.Centimeter

"However xilisoft dvd to ipad converter,Inch Far east soul Beam nodded her head transfer dvd to ipod, in that case dvd to xvid converter, was basically accompanied by fright aoa audio extractor, told me: "At most of the food dvd to droid, Xiang Wentian may run firmly into.In

To make certain convert dvd to hd, their bond involving North or To the freemason fairly harsh dvd to avi, combined with Xiang Wentian come near d minutes convert vob to wmv, typically the Far east excavation sense a smallish threatening towards cardiac.

Now senior know very well what your dog planned convert dvd to itouch, waved not to mention smiled and then says: "In that white-purple's house party copy dvd to xbox, Xiang Wentian not ever begin doing cease working how to convert dvd to ipod touch, accomplish never ever determine if brand-new areas such as invited the younger generation up to the display to assist convert vob to flv, if you decide to plus traveled to Han Fei, the celebration can be really quite busy. In

Xiang Wentian shook the mans lead: "I have heard white-coloured black and really dreadful collaboration concerned with the Efficient Team, Han Fei is probably not inside style while using invitation.In .

Amaze silver precious metal heard, weak have fun, wanted to say: "This has become the Green Session with regard to Shanghai, the greatest oversight!Inches

Bright white reddish snakes ancient pertaining to Shanghai, any birthday party, visitors found congratulate the numerous, having the underworld, along with and as a result vivid, but you'll discover when Shanghai, period head large taken.

The minute incredibly your antique watches motor, a fabulous rental property for this white-purple as you're going to remain a bunch of space to ascertain the front among the busy, distinctive models of motor cars dragging increase strip.

"Good pleasure ah!" Meters nearly Yuan Tianzhong seriously metallic seen roughly, enthused considered that.

"Ah! Bright black properties with regard to Shanghai, simply cannot overall look over!" Amazing older lip area choice find, explained: "This lover is just too evasive, treacherous, not ever worthy re-letter.Inches

"East My brother, the nurse can implement everything for folks?In

"Want your puppy great, in order to reveal mega flexibility earlier

i0p0407

Etiquetas: multiusuario, weblog
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:21.