11
Methis
Re: SEO URLs for News Module
  • 2006/12/9 16:30

  • Methis

  • Just popping in

  • Posts: 52

  • Since: 2005/6/25


Quote:

FaYsSaL wrote:
im waiting for the code release
thx ewonline


Me too...I think it's a wonderful hack and it's just what I'm looking for.

Please ewonline share your code with Xoops'community so there will be lots of people could help you!

12
ewonline
Re: SEO URLs for News Module
  • 2006/12/10 1:18

  • ewonline

  • Not too shy to talk

  • Posts: 198

  • Since: 2004/11/17


The code is all there, I use a very heavily hacked copy of the News module, so I can't post that News Module code here since it wouldn't work for anyone.

But look at the previous posts, its all there.
Resized Image

13
Methis
Re: SEO URLs for News Module
  • 2006/12/10 9:34

  • Methis

  • Just popping in

  • Posts: 52

  • Since: 2005/6/25


Tnx...the question is that unfortunately I'm not good enough in PHP and I can't immagine where to insert that code and what code to replace.

However you write. "I can't post that News Module code here since it wouldn't work for anyone." but if you don't permit us to try your code you can't know if it works with all possible configurations! It's a milestone of debugging: more people can try a code and more easily bugs are discovered....and obviously, even if there are some bugs, nobody will reproach you with it!

14
Cuidiu
Re: SEO URLs for News Module
  • 2006/12/10 15:09

  • Cuidiu

  • Quite a regular

  • Posts: 358

  • Since: 2006/4/23


Methis,
Unless I'm misunderstanding, seems pretty obvious ewonline doesn't want to post the full code.

Quote:

Methis wrote:
but if you don't permit us to try your code you can't know if it works with all possible configurations!
[size=x-small]Working sites:
XOOPS 2.0.16 PHP 5.2.2, MySQL 5.0.24a-standard-log, Apache/2.0.54 (Unix)
XOOPS 2.2.4, PHP 4.3.10, MySQL 3.23.58, Apache/1.3.33 (Unix)[/size]

15
ewonline
Re: SEO URLs for News Module
  • 2006/12/10 18:05

  • ewonline

  • Not too shy to talk

  • Posts: 198

  • Since: 2004/11/17


Double Post
Resized Image

16
ewonline
Re: SEO URLs for News Module
  • 2006/12/10 18:05

  • ewonline

  • Not too shy to talk

  • Posts: 198

  • Since: 2004/11/17


DO NOT USE THE CODE STRAIGHT OUT, YOU WILL BREAK YOUR NEWS MODULE!

My Hacked News Module is streamlined and features I don't use were removed, so it will NOT work for you.
But since you guys want some code to look at, here it is.


include '../../mainfile.php';
$xoopsOption['template_main'] = 'news_index.html';
include 
XOOPS_ROOT_PATH.'/header.php';
include_once 
XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php';
if (isset(
$_GET['storytopic'])) {
$xoopsOption['storytopic'] = intval($_GET['storytopic']);
} else {
$xoopsOption['storytopic'] = 0;
}
if (isset(
$_GET_['storynum']) ) {
$xoopsOption['storynum'] = intval($_GET['storynum']);
if (
$xoopsOption['storynum'] > 30) {
$xoopsOption['storynum'] = $xoopsModuleConfig['storyhome'];
}
} else {
$xoopsOption['storynum'] = $xoopsModuleConfig['storyhome'];

}
if ( isset(
$_GET['start']) ) {
$start intval($_GET['start']);
} else {
$start 0;
}
if ( 
$xoopsModuleConfig['displaynav'] == ) {
$xoopsTpl->assign('displaynav'true);
$xt = new XoopsTopic($xoopsDB->prefix('topics'));
ob_start();
$xt->makeTopicSelBox(1$xoopsOption['storytopic'], 'storytopic');
$topic_select ob_get_contents();
ob_end_clean();
$xoopsTpl->assign('topic_select'$topic_select);
$storynum_options '';
for ( 
$i 5$i <= 30$i $i ) {
$sel '';
if (
$i == $xoopsOption['storynum']) {
$sel ' selected="selected"';
}
$storynum_options .= '.$i.'"'.$sel.'>'.$i.'';
}
$xoopsTpl->assign('storynum_options'$storynum_options);
} else {
$xoopsTpl->assign('displaynav'false);
}
$sarray NewsStory::getAllPublished($xoopsOption['storynum'], $start$xoopsOption['storytopic']);
$scount count($sarray);
for ( 
$i 0$i $scount$i++ ) {
$story = array();
$story['id'] = $sarray[$i]->storyid();
$story['poster'] = $sarray[$i]->uname();
if ( 
$story['poster'] != false ) {
$story['poster'] = $story['poster'];
} else {
$story['poster'] = $xoopsConfig['anonymous'];
}
$story['posttime'] = date('m/d/Y',$sarray[$i]->published());
$story['text'] = $sarray[$i]->hometext();
$introcount strlen($story['text']);
$fullcount strlen($sarray[$i]->bodytext());
$totalcount $introcount $fullcount;
$morelink '';
$storytitle strtolower($sarray[$i]->title());
$replacethese = array('update: ','update 2: ','update 3: ','rumor: ',''');
$storytitle = html_entity_decode(str_replace($replacethese, "", $storytitle));
$storytitle = str_replace(" ", "-", $storytitle);
$storytitle = ereg_replace("[^[:alnum:]-]", "", $storytitle);
$storytitle = str_replace("--", "-", $storytitle);
if ( $fullcount > 1 ) {
$morelink .= '
<b><a href="'.XOOPS_URL.'/news/'.$sarray[$i]->storyid().'-'.$storytitle.'/';
$morelink .= '">'._NW_READMORE.'a>b>';
}
$story['
morelink'] = $morelink;
$story['
adminlink'] = '';
$story['
mail_link'] = 'mailto:?subject='.sprintf(_NW_INTARTICLE,$xoopsConfig['sitename']).'&amp;body='.sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']).':  '.XOOPS_URL.'/news/'.$sarray[$i]->storyid().'-'.$storytitle.'/';
$story['
imglink'] = '';
$story['
align'] = '';
if ( $sarray[$i]->topicdisplay() ) {
$story['
imglink'] = $sarray[$i]->imglink();
$story['
align'] = $sarray[$i]->topicalign();
}
$story['
title'] = "storyid()."-".$storytitle."/">".$sarray[$i]->title()."";
$xoopsTpl->append('
stories', $story);
unset($story);
}
$totalcount = NewsStory::countPublishedByTopic($xoopsOption['
storytopic']);
if ( $totalcount > $scount ) {
include_once XOOPS_ROOT_PATH.'
/class/pagenav.php';
$pagenav = new XoopsPageNav($totalcount, $xoopsOption['
storynum'], $start, 'start');
$pagenav2 = $pagenav->renderNav();
$pagenav2 = str_replace("/modules/news/index.php?start=", "http://www.ewonline.net/news/", $pagenav2);
$pagenav2 = str_replace('">', '/"
>', $pagenav2);
$pagenav2 = str_replace('
http://www.ewonline.net/news/0/', 'http://www.ewonline.net/news.html', $pagenav2);
$xoopsTpl->assign('pagenav'$pagenav2);
} else {
$xoopsTpl->assign('pagenav''');
}
$xoopsTpl->assign('lang_go'_GO);
$xoopsTpl->assign('lang_on'_ON);
$xoopsTpl->assign('lang_printerpage'_NW_PRINTERFRIENDLY);
$xoopsTpl->assign('lang_sendstory'_NW_SENDSTORY);
include_once 
XOOPS_ROOT_PATH.'/footer.php';
?>
Resized Image

17
ewonline
Re: SEO URLs for News Module
  • 2007/4/30 0:44

  • ewonline

  • Not too shy to talk

  • Posts: 198

  • Since: 2004/11/17


An update on this, I've decided to make the hack into a "module" due to the demand. Basically I'll put all the code needed into the news module (you'll need mod_rewrite enabled on your server) and I plan on releasing it sometime during June.
Resized Image

Login

Who's Online

487 user(s) are online (363 user(s) are browsing Support Forums)


Members: 1


Guests: 486


heyula,

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