1
azuna
how to insert user interest in every article in modules news?
  • 2006/12/19 8:49

  • azuna

  • Just popping in

  • Posts: 15

  • Since: 2004/9/12


hi..i'm want to create in every article in news modules, their profile user interest can be shown at the bottom of their page. this user interest is owner of the posters.

i know how to edit template news_item.html but how to edit file article.php

i used modules news 1.1

help me pls..sorry for my bad english

Quote:


include "../../mainfile.php";
include_once "class/class.newsstory.php";
foreach ($HTTP_POST_VARS as $k => $v) {
${$k} = $v;
}

$storyid = (isset($HTTP_GET_VARS['storyid'])) ? $HTTP_GET_VARS['storyid'] : 0;
$storyid = intval($storyid);
if (empty($storyid)) {
redirect_header("index.php",2,_NW_NOSTORY);
exit();
}

$xoopsOption['template_main'] = 'news_article.html';

include_once XOOPS_ROOT_PATH.'/header.php';
$myts =& MyTextSanitizer::getInstance();
// set comment mode if not set


$article = new NewsStory($storyid);
if ( $article->published() == 0 || $article->published() > time() ) {
redirect_header('index.php', 2, _NW_NOSTORY);
exit();
}
$storypage = isset($HTTP_GET_VARS['page']) ? intval($HTTP_GET_VARS['page']) : 0;
// update counter only when viewing top page
if (empty($HTTP_GET_VARS['com_id']) && $storypage == 0) {
$article->updateCounter();
}
$story['id'] = $storyid;
$story['posttime'] = formatTimestamp($article->published());
$story['title'] = $article->textlink()." : ".$article->title();
$story['text'] = $article->hometext();
$bodytext = $article->bodytext();

if ( trim($bodytext) != '' ) {
$articletext = explode("[pagebreak]", $bodytext);
$story_pages = count($articletext);

if ($story_pages > 1) {
include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
$pagenav = new XoopsPageNav($story_pages, 1, $storypage, 'page', 'storyid='.$storyid);
$xoopsTpl->assign('pagenav', $pagenav->renderNav());
//$xoopsTpl->assign('pagenav', $pagenav->renderImageNav());

if ($storypage == 0) {
$story['text'] = $story['text'].'

'.$articletext[$storypage];
} else {
$story['text'] = $articletext[$storypage];
}
} else {
$story['text'] = $story['text'].'

'.$bodytext;
}
}

$story['poster'] = $article->uname();
if ( $story['poster'] ) {
$story['posterid'] = $article->uid();
$story['poster'] = ''.$story['poster'].'';
} else {
$story['poster'] = '';
$story['posterid'] = 0;
$story['poster'] = $xoopsConfig['anonymous'];
}
$story['morelink'] = '';
$story['adminlink'] = '';
unset($isadmin);
if ( $xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid')) ) {
$isadmin = true;
$story['adminlink'] = $article->adminlink();
}
$story['topicid'] = $article->topicid();
$story['imglink'] = '';
$story['align'] = '';
if ( $article->topicdisplay() ) {
$story['imglink'] = $article->imglink();
$story['align'] = $article->topicalign();
}
$story['hits'] = $article->counter();
$story['mail_link'] = 'mailto:?subject='.sprintf(_NW_INTARTICLE,$xoopsConfig['sitename']).'&body='.sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/news/article.php?storyid='.$article->storyid();
$xoopsTpl->assign('story', $story);
$xoopsTpl->assign('lang_printerpage', _NW_PRINTERFRIENDLY);
$xoopsTpl->assign('lang_sendstory', _NW_SENDSTORY);
$xoopsTpl->assign('lang_on', _ON);
$xoopsTpl->assign('lang_postedby', _POSTEDBY);
$xoopsTpl->assign('lang_reads', _READS);
$xoopsTpl->assign('mail_link', 'mailto:?subject='.sprintf(_NW_INTARTICLE,$xoopsConfig['sitename']).'&body='.sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/news/article.php?storyid='.$article->storyid());

$xoopsTpl->assign('xoops_pagetitle', $article->topic_title() . ' - ' . $article->title());

//$ptitle=$myts->makeTboxData4Show($article->title());
//$xoopsTpl->assign('xoops_pagetitle', $ptitle);

/**
* Show a link to go to the previous article and to the next article
*
* According to a module's option "showprevnextlink" ("Show Previous and Next link ?")
* you can display, at the bottom of each article, two links used to navigate thru stories.
* This feature uses the module's option "restrictindex" so that we can, or can't see
* restricted stories
*/
$makan=1;
if ($makan=1) {
$previous=-1;
$next=-1;
$lastread=-1;
$warning=false;
$previoustitle='';
$nexttitle='';
$lasttitle='';
$xoopsTpl->assign('nav_links', true);
$tmparticle = new NewsStory();
$sarray = $tmparticle->getAllPublished(0, 0, $xoopsModuleConfig['restrictindex'],0,0,false);
if(is_array($sarray)) {
while(list($storyid, $storytitle) = each($sarray)) {
if($warning) {
$next=$storyid;
$nexttitle=$storytitle;
$warning=false;
}

if($storyid==$article->storyid()) {
if($previous==-1) {
$previous=$lastread;
$previoustitle=$lasttitle;
}
$warning=true;
}
$lastread=$storyid;
$lasttitle=$storytitle;
}
}

$xoopsTpl->assign('previous_story_id',$previous);
$xoopsTpl->assign('next_story_id',$next);
if($previous!=-1) {
$xoopsTpl->assign('previous_story_title',$previoustitle);
$hcontent.=sprintf("\n",$previoustitle,XOOPS_URL.'/modules/news/article.php?storyid='.$previous);
}

if($next!=-1) {
$xoopsTpl->assign('next_story_title',$nexttitle);
$hcontent.=sprintf("\n",$nexttitle,XOOPS_URL.'/modules/news/article.php?storyid='.$next);
}
$xoopsTpl->assign('lang_previous_story',_NW_PREVIOUS_ARTICLE);
$xoopsTpl->assign('lang_next_story',_NW_NEXT_ARTICLE);
unset($tmparticle);
} else {
$xoopsTpl->assign('nav_links', false);
}


include XOOPS_ROOT_PATH.'/include/comment_view.php';

include XOOPS_ROOT_PATH.'/footer.php';
?>


2
kaotik
Re: how to insert user interest in every article in modules news?
  • 2006/12/19 11:09

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


Ups, I just reread your post and see that you want the user interest of the poster. Let me check $xoopsUser and I'll post corrected code.

2 steps:
replace in article.php
include XOOPS_ROOT_PATH.'/include/comment_view.php';

include 
XOOPS_ROOT_PATH.'/footer.php';


with:
$userInt=$xoopsUser->getVar('user_intrest');
$xoopsTpl->assign('user_interst'$userInt);

include 
XOOPS_ROOT_PATH.'/include/comment_view.php';
include 
XOOPS_ROOT_PATH.'/footer.php';


Now go into news_item.html and add this where you want the user interest to show:
<{$user_interst}>

3
azuna
Re: how to insert user interest in every article in modules news?
  • 2006/12/19 15:42

  • azuna

  • Just popping in

  • Posts: 15

  • Since: 2004/9/12


cannot function. article page blank.

why?

4
kaotik
Re: how to insert user interest in every article in modules news?
  • 2006/12/19 17:03

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


$xoopsUser has to load $story['posterid'], that's what I was tring to figure out, how to load $xoopsUser info from difrent id

5
iHackCode
Re: how to insert user interest in every article in modules news?

hers is what i did..

$postUser. a XoopsUser object for that user $story['posterid'] . but.. i think there will be a problem with those that are anonymous ( $story['posterid'] that is 0 )

$postUser = new XoopsUser($story['posterid']);
$userInt=$postUser->getVar('user_intrest');
$xoopsTpl->assign('user_intrest'$userInt);

...etc..

smarty template variable
<{$user_intrest}>
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

6
azuna
Re: how to insert user interest in every article in modules news?
  • 2006/12/20 4:39

  • azuna

  • Just popping in

  • Posts: 15

  • Since: 2004/9/12


page article can view..but text of user interest not view.

this function also i want to create user signature. so every posters have their own interest and signature for their article

how about newbb? every post have their own signature...

7
azuna
Re: how to insert user interest in every article in modules news?
  • 2006/12/22 15:22

  • azuna

  • Just popping in

  • Posts: 15

  • Since: 2004/9/12


anyone? can help me

8
iHackCode
Re: how to insert user interest in every article in modules news?

$postUser = new XoopsUser($story['posterid']);
$userInt=$postUser->getVar('user_intrest');
$xoopsTpl->assign('user_intrest'$userInt);
$userInt=$postUser->getVar('user_sig');
$xoopsTpl->assign('user_sig'$userInt);

...etc..

smarty template variable
<{$user_intrest}>
<{
$user_sig}>


*note the spelling on 'intrest'
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

Login

Who's Online

431 user(s) are online (383 user(s) are browsing Support Forums)


Members: 0


Guests: 431


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