eZpublish Manual Keywords
Author: Stuart Millington Publishing date: 26.11.2002 02:10
While implementing this new site, I found a bug in the CMS that I'm using, in that it ignored the keywords specified when creating the article and created a massive list of its own.
I know that keywords are, arguably, less important than they were a few years ago, but I wanted to get this working before I considered the site live. Hence, the new content (and the migration of the balance of the old content) has been delayed while this was fixed.
Anyway, when you add manual keywords to an article in eZarticle, they are added to the table "eZArticle_ArticleKeyword". But, when the get() function in /ezarticle/classes/ezarticle.php retrieves the article data for display, it ignores these and uses a *long* list that the edit/create function generated.
I've changed /ezarticle/classes/ezarticle.php to include the manual keywords, if specified:
In the function get(), after the line "$ret = true;" (about line 339) I added:
$db->array_query( $article_array, "SELECT * FROM eZArticle_ArticleKeyword WHERE ArticleID='$id'" );
if ( count( $article_array ) > 0 )
{
$this->Keywords = "";
$limit = count( $article_array );
for ($i = 0; $i < $limit; $i++) {
if ($i != 0) {
$this->Keywords .= ", " . $article_array[$i][$db->fieldName("Keyword")];
} else {
$this->Keywords .= $article_array[$i][$db->fieldName("Keyword")];
}
}
}
It's not the best code in the world, but it's 2AM and I want to get this thing working.
FWIW: This was coded in Version 2.2.7. The changes may be different in other versions. Plus, there is always the possibility that I have missed an obvious configuration option and this is unnecessary :(
Back to the content...
The copyright of some of the images that are used on this site is held by 3rd parties. The images are used for review purposes under the Fair Use / Fair Dealing provisions of copyright law. If any copyright holder objects to such use, please use the contact address below.

