|
Neverside community Tutorial Engine class
Neverside community Tutorial Engine class
Currently viewing this thread: 1 (0 members and 1 guests)
 May 19th, 2006 12:59 AM
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.
___________________

 May 19th, 2006 02:28 AM
Tags, for like searching? Show the code/changes that would need to be made
___________________
I code alot.
 May 19th, 2006 02:45 AM
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
`tut_tags` varchar(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.
___________________

 May 19th, 2006 04:41 AM
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. 
 May 19th, 2006 05:04 AM
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
 May 19th, 2006 08:27 AM
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. 
Always the pessimist aren't we? 
___________________
irc.efnet.net #neverside
Neverside merchandise!
 May 19th, 2006 08:50 AM
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
//tag database with normailized tags
CREATE TABLE `neviTA_tags` (
`id` int(12) unsigned NOT NULL auto_increment,
`tag` varchar(255) default NULL,
PRIMARY KEY (`id`),
) TYPE=MyISAM AUTO_INCREMENT=1 ;
CREATE TABLE `neviTA_tags_meta` (
`id` int(12) unsigned NOT NULL auto_increment,
`tag_id` int(12) unsigned NOT NULL,
`meta_id` int(12) unsigned NOT NULL, //tutorial id
`meta_type` enum('tutorial'), //for scaleabliity
`owner_id` int(12) unsigned NOT NULL, //User who tagged id
`dt` datetime, //When was it tagged?
PRIMARY KEY (`id`),
) TYPE=MyISAM AUTO_INCREMENT=1 ;
?>
a little better tag database
___________________
www.sp0rk.com
Last edited by PrObLeM, May 19th, 2006 08:51 AM (Edited 1 times)
 May 19th, 2006 10:43 AM
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.
 May 19th, 2006 12:03 PM

<?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)
 May 19th, 2006 12:05 PM
Okay, improve that! It's very very old, but it's always worked well for what I have used it for =)
___________________
I code alot.
|