1
przemeks
News module +keywords
  • 2005/5/20 18:19

  • przemeks

  • Just popping in

  • Posts: 57

  • Since: 2005/1/29


Hello guys, i search a hack for news module which make a one additional place in news table where will be saved a keywords best describing a current news (for example: google, search, gMail).

The keywords will be adding in admin panel when news i makeing. I serach this hack because i wont create a block in which will be displayed a related links - this calculations will be based on this keywords from table.

Has anyone know anything about this ?

2
hervet
Re: News module +keywords
  • 2005/5/22 12:02

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


Have you test News 1.3.1 ?

3
exbanious
Re: News module +keywords
  • 2005/6/8 1:33

  • exbanious

  • Not too shy to talk

  • Posts: 113

  • Since: 2004/5/30


i was looking into a way to show related articles. i just made this, and so far it seems to work correctly.

first i added a fulltext index to the "keywords" key
and put the following code in article.php



if($article->keywords() !='') {

$id intval($_GET['storyid']);
        
    
$db =& Database::getInstance();
    
$myts =& MyTextSanitizer::getInstance();
    
$query "SELECT * FROM ".$db->prefix("stories")." WHERE MATCH (keywords) AGAINST ('$article->keywords') AND storyid != '$id' ";
    
$result mysql_query($query);
    
$number mysql_numrows($result);

    if (
intval($number) != 0){
        
$xoopsTpl->assign('related_articles'"Related Articles");

        while (
$myrow $db->fetchArray($result)){

            
$ret[$myrow['storyid']] = array( 'title'=>'.XOOPS_URL.'/modules/news/article.php?storyid='.$myrow['storyid']. '>'.$myts->htmlSpecialChars($myrow['title'] ).'''date'=>formatTimestamp($myrow['published'], "s"));
            }

    }
}

$xoopsTpl->assign('ret'$ret);


then i placed the following code into "news_article.html"


<table width='50%' cellspacing='0' cellpadding='1'>
<
tr>
<
th><{$related_articles}>th>
tr>
<{foreach 
from=$ret item=storyid}>
<
tr class="<{cycle values="even,odd"}>">
<
td>
               
<{
$storyid.title}> (<{$storyid.date}>)<br/>
td>tr><{/foreach}>
div><br/>
td>            
tr>
table>


i haven't tested it on a large site as of yet, so i'm not sure how practical this solution is. If anyone has a better idea of how to accomplish this, i am interested in any input.

4
sikey
Re: News module +keywords
  • 2005/6/14 12:43

  • sikey

  • Not too shy to talk

  • Posts: 151

  • Since: 2003/4/29


I contacted "exbanious" about this hack after not being able to get it to work.
And thought i should share the extra information you need to get this to work.
This hack for one only works with News 1.3 and up.

The first step is explained here:
adding a fulltext index to keywords

if you are using phpmyadmin to administer your MySQL database,
find your XOOPS database and click on xoops_stories table.
this will show you the list of fields for that table, find the "keywords" field and on the far right
under "Action" there is an icon with the letter "T" click that and it will make
a fulltext index for the keywords field. This needs to be set
for the "WHERE MATCH (keywords) AGAINST ('$article->keywords') " argument to work.

5
przemeks
Re: News module +keywords
  • 2005/7/13 19:20

  • przemeks

  • Just popping in

  • Posts: 57

  • Since: 2005/1/29


Hi, I have installed News 1.3.1 but there isn't anything what i wont. I can't see anything like a input for keywords for describe the news.

6
przemeks
Re: News module +keywords
  • 2005/7/13 19:54

  • przemeks

  • Just popping in

  • Posts: 57

  • Since: 2005/1/29


OK, i found it, I done all but links aren't displayed :|

Maybe i put this code in wrong place in article.php

Where i musy put this ?

7
przemeks
Re: News module +keywords
  • 2005/7/13 19:58

  • przemeks

  • Just popping in

  • Posts: 57

  • Since: 2005/1/29


OK, all works correctly, sorry for stupid posts ;)

8
indream
Re: News module +keywords
  • 2005/7/13 20:42

  • indream

  • Not too shy to talk

  • Posts: 170

  • Since: 2004/9/21


how can i use this hack in news 1.1 ?

i need this keywords hack and
previus article - next article function hack for news 1.1

9
Marco
Re: News module +keywords
  • 2005/7/13 20:59

  • Marco

  • Home away from home

  • Posts: 1256

  • Since: 2004/3/15


do you know news 1.3.1 has these features embeeded ?
marco
Do synergy or die.

10
przemeks
Re: News module +keywords
  • 2005/7/14 9:56

  • przemeks

  • Just popping in

  • Posts: 57

  • Since: 2005/1/29


I'm also thinking about "related articles" in News 1.1 (in this version i add much modygications). I create a "keywords" row in table xoops_stories, with "full text" and other values from News 1.3.1 but when i put any code in article.php to read a keyowrds (for example $story['keywords'] = $article->keywords();) the article.php is displaying blank page.

What i made wrong, why i can't connect to keywords row ?

Something blocks this :/

Login

Who's Online

433 user(s) are online (275 user(s) are browsing Support Forums)


Members: 0


Guests: 433


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits