Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

51 users online



Neverside community Tutorial Engine class

Neverside community Tutorial Engine class

Currently viewing this thread: 1 (0 members and 1 guests)


Page 2 out of 4
riah

riah

now with more lambda
Status: Offline!

I really like this idea erod! How about a "tags" field for the tutorials to provide extra sorting functionality.

___________________

http://codetch.com/skin/sig.png

erod

erod

uh yea
Status: Offline!

Tags, for like searching? Show the code/changes that would need to be made

___________________

I code alot.

riah

riah

now with more lambda
Status: Offline!

Yeah, tags could be used to filter results and also as another category system of sorts.

Add a field to the `neviTA_Tutorials` table with

PHP:

<?php

  
`tut_tagsvarchar(255) default NULL,

?>

I haven't prepared any specific code but we can come up with something when we decide on uses. you can do neat stuff with them, like on flikr and del.icio.us.

___________________

http://codetch.com/skin/sig.png

Rad

Rad

thinking of something witty to put here
Status: Offline!

It's hard enough to get two people to agree on something, imagine getting the whole community to do so. Smile

dibby

dibby

Neverside Newbie
Status: Offline!

The genres/tags should be normalised rather than in a large field.

You could have pre-defined genres and user generated tags so that while there is a default way to index the tutorials you can sort/search by other user created tags or.... how about something where users choose a genre for the tutorial and its genre is denoted by mass vote/ranking?

___________________

Glasgow SEO

James

James

Development Forum Leader
Status: Offline!
Originally posted by Rad:

It's hard enough to get two people to agree on something, imagine getting the whole community to do so. Smile

Always the pessimist aren't we? Whistle

___________________

irc.efnet.net #neverside
Neverside merchandise!

PrObLeM

PrObLeM

Neverside Newbie
Status: Offline!
Originally posted by dibby:

The genres/tags should be normalised rather than in a large field.

You could have pre-defined genres and user generated tags so that while there is a default way to index the tutorials you can sort/search by other user created tags or.... how about something where users choose a genre for the tutorial and its genre is denoted by mass vote/ranking?

PHP:

<?php

//tag database with normailized tags
CREATE TABLE `neviTA_tags` (
  `
idint(12unsigned NOT NULL auto_increment,
  `
tagvarchar(255) default NULL,
  
PRIMARY KEY  (`id`),
TYPE=MyISAM AUTO_INCREMENT=;

CREATE TABLE `neviTA_tags_meta` (
  `
idint(12unsigned NOT NULL auto_increment,
  `
tag_idint(12unsigned NOT NULL,
  `
meta_idint(12unsigned NOT NULL,    //tutorial id
  
`meta_typeenum('tutorial'),               //for scaleabliity
  
`owner_idint(12unsigned NOT NULL,   //User who tagged id
  
`dtdatetime,                                   //When was it tagged?
  
PRIMARY KEY  (`id`),
TYPE=MyISAM AUTO_INCREMENT=;

?>

a little better tag database

___________________

www.sp0rk.com

Last edited by PrObLeM, May 19th, 2006 08:51 AM (Edited 1 times)

erod

erod

uh yea
Status: Offline!

Part of what makes the past community scripts so great.. is a community building a script, in a adult manor is awesome! everyone has their coding expertise, share of thoughts is great

long as no one is condescending it will be all good!

I myself, am working on the SQL class, and am definately up for some tough critique, as I have been coding perl and bash alot more lately, maybe my abilities in SQL have deteriorated ;p

___________________

I code alot.

erod

erod

uh yea
Status: Offline!
PHP:

<?php

class sql
{

    var 
$connect  0;
    var 
$result   = Array();
    var 
$record   = Array();
    var 
$row      0;

    function 
sql($host$database$user$password$prefix)
    {
          
$this->host $host;
            
$this->database $database;
            
$this->user $user;
            
$this->password $password;
                
$this->Connect();
    }

    function 
error($title$type$error$explained$suggestion)
    {
        echo 
"<b><font size=\"+5\">$title</font></b><br>_________________________<br>$type<br>$error<br>$explained<br>$suggestion<br>";
    }

    function 
Connect()
    {
            if(
$this->connect == 0)
            {
            
$this->connect mysql_connect($this->host$this->user$this->password);
            if(!
$this->connect)
                  {
                    
$this->error
                
(
                    
"MySQL Error",
                    
"Unable to connect",
                    
mysql_error(),
                    
"Unauthorized access.",
                    
"Check to make sure you have the correct mysql information entered into this file. Such as password and username. The host is usually localhost."
                
);
            }
                   else
                  {
                @
mysql_select_db($this->database$this->connect);
                  if(!
$this->connect)
                      {
                        
$this->error
                    
(
                        
"MySQL Error",
                        
"Unable to connect",
                        
mysql_error(),
                        
"Able to connect, but unable to select a database.",
                        
"Check to make sure you have the correct mysql database entered into this file."
                    
);
                }                
            }
        }
    }

    function 
Query($query$name ""$fetch "false" )
    {
        if(
$name == "")
        {
            
mysql_query($query);
        }
         else
        {
                        if(
$this->result[$name])
                        {
                            @
mysql_free_result($this->result[$name]);
                        }

                        
$this->result[$name] = mysql_query($query);

            if(!
$this->result[$name])
            {
                
$this->error
                
(
                    
"MySQL Error",
                    
"Could not run the query",
                    
mysql_error(),
                    
"You have a error in your query string.<br>Query: ".$query,
                    
"Check to make sure you dont have any common errors, if all else fails post at the forums."
                
);
            }
             else
            {
                if(
$fetch == "true")
                {
                    
$this->fetch($name);
                }
                                return 
$this->result[$name];
                        }
        }
    }

    function 
Close$method "0" )
    {
        return (
$this->connect) ? (($method !== "0") ? @mysql_free_result($this->result) : @mysql_close($this->connect)) : false
    }

    function 
next($name ""$method "0")
    {
        return 
is_array($this->record[$name] = @mysql_fetch_array($this->result[$name]));
    }

    function 
fetch($name "")
    {
        return @
mysql_fetch_array($this->result[$name]);
    }

    function 
num_rows($name "")
      {
        return @
mysql_num_rows($this->result[$name]);
      }

      function 
fields_num($name "")
      {
            return @
mysql_num_fields($this->result[$name]);
      }

      function 
fields_name($name ""$collumn)
      {
          return @
mysql_field_name($this->result[$name], $collumn);
      }

      function 
affected($name "")
      {
            return @
mysql_affected_rows($this->result[$name]);
        }
}

$sql = new sql("localhost""db""user""user pass");

$sql->Query("SELECT * from sql""sql");

/*
for($x=0;$x<10;$x++)
{

    $sql->Query("insert into sql (test_field, test_field_two) values ('test_field_data".$x."', 'test_field_two_data".$x."') ", "");

}
*/

// fetch test
print_r$sql->fetch("sql") );
echo 
"<br><br>";

// fields name
echo $sql->fields_name("sql"1);
echo 
"<br><br>";

// fields name
echo $sql->affected("sql");
echo 
"<br><br>";

// Loop through
echo "While Loop:<br>";
while(
$sql->next("sql"))
{
    echo 
$sql->record['sql']['id']."|".$sql->record['sql']['test_field'] . "|"$sql->record['sql']['test_field_two'] . "<br>";
}
echo 
"<br>";

?>

___________________

I code alot.

Last edited by erod, May 19th, 2006 12:04 PM (Edited 1 times)

erod

erod

uh yea
Status: Offline!

Okay, improve that! It's very very old, but it's always worked well for what I have used it for =)

___________________

I code alot.

Page 2 out of 4
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0148 seconds.