News Module - separate detail page

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
sagarkale

News Module - separate detail page

Post by sagarkale »

Hi,

I am trying to tweak News module so that it can show news in detailed page when "more..." clicked. Please let me know your feedback on this hack. Details are as below.

/modules/News/modulefunctions.php - function news_module_executeuser()

1. Added as 1st line. -
$newsId = get_request_value('newsId');  //  $_GET['newsId']

2. Added following code block just before if (isset($params["sortasc"])) to modify query
if(isset($newsId) && !isset( $params["summary"] )) {
$query .= " AND news_id = ".$newsId. " ";
}


3. Modified "more..." link from
echo "
$moretext";to
echo "
$moretext";

I think thats it. Now I am able to get detailed view by clicking "more..." link. It goes to "summary" page but only record matching to news_id == $_GET['newsId'] is collected.

There are still other small problems like detailed page tries to find bookmark.

Please let me know if anyone has better solution/hack or recommend change in this.

Thanx & regards,
Sagar
pinthenet

Re: News Module - separate detail page

Post by pinthenet »

I'll try it out today - I was just about to post a request for a similar function when I saw your message - thanks.

John
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: News Module - separate detail page

Post by Ted »

I'm in the process of a total News rewrite that should work more like how you would want.  It will create it's own ppage when you click on the more link, and has a field for a summary instead of just grabbing the first few characters.  That's one of the things holding up 0.10beta3.
sagarkale

Re: News Module - separate detail page

Post by sagarkale »

Cheer, good on ya mate.
koehler

Re: News Module - separate detail page

Post by koehler »

wishy wrote:I'm in the process of a total News rewrite
Nice to hear that. I made plenty changes to my copy of 0.9 to get the rest out of it but i rather would like to use an original.

My changes
  • category images
  • title captions for news titles
  • print support
  • word / character count
  • rss output with stylesheets for raw viewing and entity mapping for iso8859-1
  • auto URLing text parts. rewriting for example www.domain.de to a link
  • code sections like in phpbb
  • plenty other changes
Is it possible to get some or all of my changes with the new News module ?

Regards,

    Michael


Update

One thing i forget to say, i'm currently working on an archive-view for the News Module.
Would be nice to have something similar in the new News Module.
Last edited by koehler on Thu May 05, 2005 11:47 am, edited 1 time in total.
gravityman

Re: News Module - separate detail page

Post by gravityman »

I like the archive idea...I've hacked mine a bunch so that news pages have their own individual pages for better search engine visibility(see permalinks on www.newbornscreening.com).  I actually created a plugin that extended the news object, so I wouldn't have upgrade issues, but if it's possible to integrate, that would be swell.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: News Module - separate detail page

Post by Ted »

koehler wrote:
  • title captions for news titles
  • word / character count
Not sure what you mean by either of these.  The rest of the ideas are good.  What are you using the to the auto URL stuff?
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: News Module - separate detail page

Post by Ted »

Anyone have any thoughts on multiple categories?  I implemented it in my News rewrite, but as I'm writing the front end stuff, I'm almost thinking that it's not necessary and just causing more problems than necessary.

Anyone?
gravityman

Re: News Module - separate detail page

Post by gravityman »

wishy wrote: Anyone have any thoughts on multiple categories?  I implemented it in my News rewrite, but as I'm writing the front end stuff, I'm almost thinking that it's not necessary and just causing more problems than necessary.

Anyone?
I like the news categories and use them to break up the page....but I could possibly do the same thing if I could start the news from a specific point.  For example, I'll use categories now to display 2 news items and then my google ads and then 5 more news items from a different category.  I could lump them all together if I could put a "start at item 3" tag in my news module call.  That being said, I'd still prefer both having categories and having this functionality.  my .02
MoonMind
Forum Members
Forum Members
Posts: 26
Joined: Wed Feb 23, 2005 6:49 am

Re: News Module - separate detail page

Post by MoonMind »

I really think I'll need the news categories, so please, stick to it! I'm also testing the Calendar module, but I'd stick to News if it gets a little handier (easier configuration, better display for my needs).
koehler

Re: News Module - separate detail page

Post by koehler »

wishy wrote:
koehler wrote:
  • title captions for news titles
  • word / character count
Not sure what you mean by either of these.  The rest of the ideas are good.  What are you using the to the auto URL stuff?
  • It would be nice to have the title/subject of the news  at the content-title and the html-page title
  • Word and character count of the news body
title
Currently, i'm doing something like this:

Code: Select all

function ContentTitle(&$title)
	{
		if ($this->cms->smarty->params['module'] == $this->modulName) {
			$title = 'News';
		}
	}
To have the content-title when clicking thru my copy of the news system. Would be nicer to have "ContentTitle" called after "doAction", so i could set more comprehensive titles for the content.

And to fit the html title tag for a single message, i'm doing very nasty things:

Code: Select all

	function ContentPostRender (&$content)
	{

		if (isset($this->cms->newsmodule)) {
			$row = $this->cms->newsmodule['row'];
			$content = preg_replace('!<title>[\s\S]+</title>!U','<title>SipSurf News - ' . $row['news_cat'] . ': ' . $row['news_title'] . '</title>', &$content);
		}
	}
I also recommend to call both methods only when then module is visible.

Word/Character count
Because i'm posting my own articles i want to give article details for reuse.
Showing word count and character count of the article is recommended.

Currently doing this by:

Code: Select all

        $cwords		= str_word_count(strip_tags($cstr));
	$cchars		= strlen(strip_tags($cstr));



Regards,

Michael
koehler

Re: News Module - separate detail page

Post by koehler »

wishy wrote: Anyone have any thoughts on multiple categories?  I implemented it in my News rewrite, but as I'm writing the front end stuff, I'm almost thinking that it's not necessary and just causing more problems than necessary.
Anyone?
Do you mean somthing like this ?:

news >> maincategory >> subcategory >> etc.
koehler

Re: News Module - separate detail page

Post by koehler »

koehler wrote: Update

One thing i forget to say, i'm currently working on an archive-view for the News Module.
Would be nice to have something similar in the new News Module.

Thats done and working for almost one week.

Code: Select all

function getArchiveEntries() {
		$db = $this->cms->db;
		
		$sql = "select news_date from ".cms_db_prefix()."module_news order by news_date asc";
		$dbresult = $db->CacheExecute(3600,$sql);

		$dateHash = array();
		if ($dbresult && $dbresult->RowCount() > 0) {
			while (($row = $dbresult->FetchRow())) {
				$date = $row['news_date'];
				$unixTS = $db->UnixTimeStamp($date);
				$truncDate = date("Y-m",$unixTS);
				$dateHash[$truncDate] = 1;
			}
		}
	
		return $dateHash;
	}


then your code (for example like this)

foreach ($list as $key => $value) {
			list($year, $month) = split("-", $key,2);
			$res .= '<div class="boxselector">' . $this->CreateArchiveMonthLink($month, $year, false, $this->getThisMo($month) . ' ' . $year) . '</div>';
			$mo = $match[2];
		}


and after clicking on a month:


$query =  "SELECT news_id, news_cat, news_title, news_data, news_date ";
$query .= "FROM ".cms_db_prefix()."module_news WHERE ";
$query .= 'news_date LIKE \'' . $params['year'] . '-' . $params['month'] .'%\'';

-> CacheExecute - you may use "Execute" instead unless you want to have your sql statements cached to files 
-> CreateArchiveMonthLink  - creates a proper link (mod_rewrite etc., see my website for example)
-> getThisMo - gives back the human readable month name 


have fun,

Michael
Last edited by koehler on Wed May 11, 2005 11:06 am, edited 1 time in total.
pinthenet

Re: News Module - separate detail page

Post by pinthenet »

I imagine multiple categories could start to get complicated from the management point-of-view

But...would it be possible to support multiple Display Templates? I currently have 2 News displays - one in a narrow sidebar (looking forward to the summary support), and one full page. I also have ideas for other uses for the module and these may have other display requirements.

At present I wrap each {cmsmodule='News'} in a tag and define ID-specific classes. This gets a bit tricky (for a CSS beginner like me) within the single template structure, so it would be useful to be able to define extra templates and select via a module option. I assume this would allow free choice of CSS naming too?

What do you think? Or is there already a simpler way?

John
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: News Module - separate detail page

Post by Ted »

koehler: Meaning that there are about 10 different categories, each with parents and children.  But, an article can belong to 2 or more categories at once.

I ended up taking the multiple category stuff out last night, but it's easy enough to put back in.  I think one is fine.  The parent/child thing will remain, as I think it will very important for sites that are primarily News based.

pinthenet: I really like the multiple template idea!  I think I'll put that in...  it's easy enough to do.
Locked

Return to “Modules/Add-Ons”