Go Back  HTML Forums - Free Webmaster Forums and Help Forums > COMMUNITY NETWORKING > Web 2.0 Websites & Technology Discussion
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 07-28-2008, 04:21 AM
  #16
¥åßßå
Blonde Bimbo
 
¥åßßå's Avatar
 
Join Date: Jul 2004
Posts: 1,448
iTrader: (0)
¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about
Quote:
Originally Posted by Horus_Kol View Post
Still fuzzy on the mechanics here...

could you post a simple example (probably in a new thread?)
If you can wait a tad I'll do a write up on our blogs with a working example and I'll create a new thread here with pretty much the same content just without the example ( pretty sure they won't let me include a 3rd party javascript file on the forums ). I'll close the comments on the blog post to restrict all feedback/questions etc to the forum thread so it's all in one place and not scattered all over the web.

¥
__________________
I may have opened the door, but you entered of your own free will
Blogrums
¥åßßå is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-28-2008, 06:46 AM
  #17
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 15,824
iTrader: (0)
Horus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the rough
sounds good...

speaking of your blog - i don't seem to get RSS from innervisions anymore - what's going on?
__________________


So sue me for being pedantic... I can give you a bullet-list of reasons why you can't
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-28-2008, 05:03 PM
  #18
¥åßßå
Blonde Bimbo
 
¥åßßå's Avatar
 
Join Date: Jul 2004
Posts: 1,448
iTrader: (0)
¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about
Quote:
Originally Posted by Horus_Kol View Post
speaking of your blog - i don't seem to get RSS from innervisions anymore - what's going on?

Apart from being concerned about the sanity of anyone who actually follows my feeds .... what feed url are you using and when did it stop working?

¥
__________________
I may have opened the door, but you entered of your own free will
Blogrums
¥åßßå is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-28-2008, 06:26 PM
  #19
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 15,824
iTrader: (0)
Horus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the rough
i'll have a look for the URL when I get home... but I do remember resetting it at least once, and it's been about 4-6 weeks...
oddly enough, I got a feed error from my reader just last night after I'd posted on here
__________________


So sue me for being pedantic... I can give you a bullet-list of reasons why you can't
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-28-2008, 06:31 PM
  #20
¥åßßå
Blonde Bimbo
 
¥åßßå's Avatar
 
Join Date: Jul 2004
Posts: 1,448
iTrader: (0)
¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about
I quite often break everything on my blog as I have a bad habit of using it as a live testbed, so it wouldn't surprise me if I've broken them ..... ahhh well, it's my corner of the web and I can break it if I want to

I'm still worried about your mental health :|

¥
__________________
I may have opened the door, but you entered of your own free will
Blogrums
¥åßßå is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-28-2008, 06:51 PM
  #21
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 15,824
iTrader: (0)
Horus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the rough
hehe - I do the same with my own site... its the prototype for a lot of my work

what's to worry about my mental state - being unbalanced isn't really a problem, these days...
__________________


So sue me for being pedantic... I can give you a bullet-list of reasons why you can't
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-28-2008, 07:00 PM
  #22
¥åßßå
Blonde Bimbo
 
¥åßßå's Avatar
 
Join Date: Jul 2004
Posts: 1,448
iTrader: (0)
¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about
"what's that skippy? there's a madman lose on the internet? ......... what's the internet skippy?"

Yer in the right country at least

¥
__________________
I may have opened the door, but you entered of your own free will
Blogrums
¥åßßå is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-29-2008, 10:28 PM
  #23
JoeyDaly
Paladin (Level 15)
 
JoeyDaly's Avatar
 
Join Date: Aug 2007
Location: Melbourne, Australia
Posts: 402
iTrader: (0)
JoeyDaly is an unknown quantity at this point
Quote:
Originally Posted by ¥åßßå View Post
Apart from being concerned about the sanity of anyone who actually follows my feeds .... what feed url are you using and when did it stop working?

¥
Lmao!

Looking forward to reading the post Yabba, let me know when it's up.
__________________
-- Joey Daly,
Web Developer & Programmer
JoeyDaly is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-30-2008, 04:40 AM
  #24
¥åßßå
Blonde Bimbo
 
¥åßßå's Avatar
 
Join Date: Jul 2004
Posts: 1,448
iTrader: (0)
¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about
It's the post below this one in the forums ( AJAX without the AX )

¥
__________________
I may have opened the door, but you entered of your own free will
Blogrums
¥åßßå is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-30-2008, 10:56 PM
  #25
JoeyDaly
Paladin (Level 15)
 
JoeyDaly's Avatar
 
Join Date: Aug 2007
Location: Melbourne, Australia
Posts: 402
iTrader: (0)
JoeyDaly is an unknown quantity at this point
Quote:
Originally Posted by ¥åßßå View Post
The plugin I coded works off previously used tags, it doesn't analyse your content in any way. If you want to have a play with it you can download it here ( AM Auto Tags V 1.0 ).

It uses javascript to ask the server for all tags beginning with whatever letter you've just typed ( it doesn't use ajax though, so it can make cross-domain requests ) and then "suggests" tags based on what you're typing in the tags field and what's been used in the past. Double/multi word tags are no problem.

Obviously the majority of the code/input elements and server side stuff etc are specific to our blog software, but it should be a doddle to convert to any other platform.

¥
Great article!

But now back on topic, we want to automate or auto suggest tagging to just make life easier...

I don't get what you mean it asks the server for all the tags. I don't think I read too far into your code to understand all that, which btw is brilliant - If only could be re-used as a standalone script.
__________________
-- Joey Daly,
Web Developer & Programmer
JoeyDaly is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-31-2008, 04:21 AM
  #26
¥åßßå
Blonde Bimbo
 
¥åßßå's Avatar
 
Join Date: Jul 2004
Posts: 1,448
iTrader: (0)
¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about¥åßßå has a spectacular aura about
Huge reply alert ... probably several "whore a blog" alerts as well

Ok, lets start at the beginning with a typical post work flow ( for our blog software ) :

First you hit the write screen ... kinda an obvious first step .... and slap in a really cool title ( laden with keywords if you play the seo game ) for your post, choose a couple of categories and then you type your expertly crafted article that's going to blow the minds of the millions of adoring fans that follow your every word with bated breath and a star-struck look in their glazing eyes.... or, if it's my blog ... for the psychotic few that can't tell genius from blonde

And then you stare at the tags field for a while, wondering 2 things
1) How can I sum up such genius into tags?
2) What tags have a I used previously ( kinda important, because we also have a related posts plugin that uses tags to function [ Playing with relations ] )

That's where this plugin comes in. As you start typing tags it scurries off to the server and prods it to come up with a list of tags that have been used in previous posts that start with the same letter. Once the server stops sulking at having to do some work it spits back a list of each tag and wanders off muttering nasty things under it's breath .... it's never really forgiven me for the time I accidentally replaced the PHP process with a BASH script and promptly fried it's brains with load levels in excess of 600

When the script gets the reply it adds all the answers ( if any ) to the tags array. We chose to use a huge memory intensive array to make it quicker for the code to "predict" tags as you typed, rather than a smaller array which would be kinder to your pcs memory but would take slightly longer to search .... it's probably easier to show you by example ... free-typed, so don't complain if they fry your cpu when testing

Small array :
Code:
var tags = new Array('a_tag', 'another_tag', 'another_tag_2', 'tag_4', 'tag_5');
var current_tag = 'ta';// this is the tag that's being "typed"

var suggest_tags = new Array();
for( tag in tags )
{
  if( tags[tag].susbtr( 0, current_tags.length ) == current_tag )
  {  // starts with same letters as current tag
      suggest_tags[ suggest_tags.length ] = tags[ tag ];
  }
}
suggest_tags is now an array of potential tags. Now lets look at the memory intensive version :

Code:
var tags['a'] = new Array('a_tag', 'another_tag', 'another_tag_2' );
tags['t'] = new Array( 'tag_4', 'tag_5' );

tags['a_'] = new Array( 'a_tag' );
tags['a_t' ] = new Array( 'a_tag' );
tags['a_ta' ] = new Array( 'a_tag' );

tags['an' ] = new Array( 'another_tag', 'another_tag_2' );
tags['ano' ] = new Array( 'another_tag', 'another_tag_2' );
tags['anot' ] = new Array( 'another_tag', 'another_tag_2' );
tags['anoth' ] = new Array( 'another_tag', 'another_tag_2' );
// etc etc etc, until all tags are indexed like the above

var current_tag = 'ta';// this is the tag that's being "typed"

var suggest_tags = ( typeof( tags[current_tag] ) == 'undefined' ? Array( current_tag ) : tags[current_tag] );
As you can see, the second example is a lot more memory intensive, but getting suggested tags is a one liner

Your code can now take the suggested tags ( whichever way you decide to code the arrays ) and display a list to the user, our plugin also "auto-completes" the first suggested tags so the user can just press the right-arrow and move on with their tags.

Once you've picked all your tags, and ticked a few other boxes, you hit submit ... and the server, begrudgingly, slaps your new post into the database, creates entries for any unknown tags and then links all post tags to the new post in the "item_tags" table, ready for when the droves flock to read your latest masterpiece.

Quote:
Originally Posted by JoeyDaly View Post
If only could be re-used as a standalone script.
It's actually quite easy to convert this into a standalone script with very few changes, although you will need to recode the database bit to match your own tables/methods as the plugin, obviously, uses the DB class that's already available and tag insertion etc are handled by the core.

First off lets meander through the javascript file because that's where most of the changes are required

Code:
/* line 6 : change item_tags to the name of your input box for tags*/
var amTagsField = document.getElementById( "item_tags" );
/* add the following line and change separator to suit */
var  amTagsSeparator = ',';

/* line 22 : itemform_tags needs to be the id of the parent container for your item_tags <input>*/
document.getElementById( 'itemform_tags' ).appendChild( ourBox );


/* line 64 : htsrv_url needs to be the url to your php page that will return the tags */
var script = amTagsCreateElement( 'script', 'type="text/javascript" src="' + htsrv_url +'&am_tags_start='+amTagsLetter + '"' );
You can actually take most of the code in the php file and throw it out the window, it's merely there to inform our blog software that it's a plugin and can do some stuff with events. The only bit you'll want is this section, and even that's going to need a re-write to suit your setup :

PHP Code:
            if( $startLetter param'am_tags_start''string' ) )
            {    
// we have a start letter
                
if( $startLetter substrpreg_replace'~[^a-z]~i'''$startLetter ), 0) )
                { 
// single letter only ;)
                    
global $DB;
                    
$sql 'SELECT tag_name from T_items__tag WHERE tag_name LIKE "'.$DB->escape$startLetter ).'%" ORDER BY tag_name ASC';
                    if( 
$tagList $DB->get_results$sqlARRAY_A ) )
                    {    
// we have matching tags
                        
foreach( $tagList as $aTag )
                        {
                            echo 
'amTagsAddTag( "'.$aTag['tag_name'].'" );'."\n";
                        }
                    }
                    echo 
'amTagsFetchTags(0);'."\n";
                    exit;
                }
            } 
All this does is find out which start letter you're interested in and then it hits the database and ask for all currently known tags that begin with that letter. Then it simply wanders through the list and adds a javascript call for each item ( note to self : forgot the javascript headers :p ). It wouldn't be hard to recode that to use your own database.

As you can see from the code it doesn't do any analysis of your post to find/suggest tags, it just works off ones used in previous posts to make life easier when trying to tag up your pearls of wisdom

¥
__________________
I may have opened the door, but you entered of your own free will
Blogrums

Last edited by ¥åßßå : 07-31-2008 at 04:49 AM.
¥åßßå is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Reply


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 
 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump