fatinfo.com




Automatic Keyword Generator

Tired of writing meta keywords for every submission? The solution is to auto generate the keywords based on the descriptions supplied by the submitted site. Unless you are a very good PHP programmer, is it probably best to work with a script that had already been created for the same purpose.

It took a good amount a time to find the auto keyword generator script. The zip file consist of 5 files, 2 of which are critical for implementing into your eSyndiCat script. The concept works for static inputted text, thus all you have to do is pass the database string value for parsing.

  • Commonwords.php – list of common words to exclude during the description parsing process
  • Keywordgen.php – the bulk of the script code that creates a keyword string out of the description text

Open up the view-link.php file and add the code from keywordgen.php (starting with the bracket after the ELSE statement)

  • Replace $sitecontents with $link[‘description’]
  • Comment out line $pagecontents .= “$key => $val<br>”;
  • Echo out the values to see if anything is generated
  • Assign a new variable to pass back to the TPL file: $gDirSmarty->assign(’auto_keywords’, $pagecontents);

Switch over to header.tpl and replace {$keyword} with {$auto_keywords}. This is assuming your view-link.tpl is using a unique header.tpl (make a copy of header.tpl to header-view-link.tpl only to be used for view-link.tpl) OR indicate to the header.tpl to apply {$auto_keywords} when view-link.php is called.

If you are not happy with the keywords being generated because it includes words that you don’t want, you can add those words to commonwords.php and it will be excluded. That’s about as easy as it gets for implementing an automatic keyword generator into your directory script. And thanks to Chris Green of Webcreationz.co.uk for the free script, and Vincent Wright for showing how to pass variable values from a PHP file to a TPL file.

View link to see a live example of the script mod in action, then view source to see the auto generated keywords.


No Responses to “Automatic Keyword Generator”  

  1. No Comments

Leave a Reply


*
To prove you're a person, type the security word shown in the picture.
Anti-Spam Image