This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Releated news / forum topic dates


avatar
Rushian 0
From: -
Releated news / forum topic dates

(Version 1.7 free) Is there any way to get the 'releated news' that displays on the story page tacked onto the end of the news items on the main page?

Also, I've figured out how to get the date of the news item to display in the headlines block, but for the latest forum topics, it prints today's date, and not the date of the forum topic. How do I fix that?

Thanks!

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Releated news / forum topic dates
avatar
Administrator
1340
From: Vienna, Austria
Releated news / forum topic dates

Originally posted by Rushian:
Ok, that answers that. Any way to have the search use both subject and news fileds?


Open cadmin/admincore.php in an editor and find:

if ($table == "InnoDB") DBQuery("INSERT INTO esselbach_st_searchindex VALUES (NULL, '$id', '$ws', '$cat', '$author', '$title', '$text', '$time')");

Replace this line with:
if ($table == "InnoDB") DBQuery("INSERT INTO esselbach_st_searchindex VALUES (NULL, '$id', '$ws', '$cat', '$author', '$title', '$title $text', '$time')");


Then open cadmin/mod_admin and find:
DBQuery("INSERT INTO esselbach_st_searchindex VALUES (NULL, '$id', '$ws', '1', '$author', '$title', '$text', '$time')");

and replace with:
DBQuery("INSERT INTO esselbach_st_searchindex VALUES (NULL, '$id', '$ws', '1', '$author', '$title', '$title $text', '$time')");


Originally posted by Rushian:
But does this explain why the releated news isn't finding all the releated articles? I have two news items with "test" in both subject and body text, but only one item gets the related news link.

I will look into it later.
1 Re: Releated news / forum topic dates
avatar
OP 0
From: -
Releated news / forum topic dates

I see. The full text search based on the news text and not on the news title.

Ok, that answers that. Any way to have the search use both subject and news fileds?

But does this explain why the releated news isn't finding all the releated articles? I have two news items with "test" in both subject and body text, but only one item gets the related news link.
1 Re: Releated news / forum topic dates
avatar
Administrator
1340
From: Vienna, Austria
Releated news / forum topic dates

I see. The full text search based on the news text and not on the news title.
1 Re: Releated news / forum topic dates
avatar
OP 0
From: -
Releated news / forum topic dates

Originally posted by Philipp:
Did you rebuild the search index? This option is available under Other/Search Index.

Just did.. didn't help. Slightly Frowning Face
1 Re: Releated news / forum topic dates
avatar
Administrator
1340
From: Vienna, Austria
Releated news / forum topic dates

Did you rebuild the search index? This option is available under Other/Search Index.
1 Re: Releated news / forum topic dates
avatar
OP 0
From: -
Releated news / forum topic dates

You need to add something like this in the PHP part of the template:

$insert[story_time] = date(“l, F d/Y at H:i:s“,strtotime($insert[story_time]));

I had to tweak this a bit. I needed the date from the related news item, so I couldn't use $insert[story_time] since 1) I already customized that in the template, and 2) that's for the current news item.

I changed it to :
$rndate = date("l, F d/Y \a\t H:i:s",strtotime($rdata[story_time]));

Then inserted $rndate where I wanted it.

Also, the 'at' text was being interpreted by the php date() function, so I had to change the 'at' to ' \a\t'.

Here's the entire thing:
$searchstory = addslashes(substr($insert[story_title], 0, 8));

$dquery = DBQuery("SELECT * FROM esselbach_st_stories WHERE (story_title LIKE '%$searchstory%') AND story_hook = '0' ORDER BY story_id DESC LIMIT 8");

if (mysql_num_rows($dquery) > 1)
{
$related = "<br /><br /><font size="2"><font class="rn">»Related News</font><br />";
while ($rdata = mysql_fetch_array($dquery))
{
if ($rdata[story_id] != $insert[story_id])
{
$rndate = date("l, F d/Y \a\t H:i:s",strtotime($rdata[story_time]));
$related .= "<LI><a href='story.php?id=$rdata[story_id]'>$rdata[story_title]</a>, posted on $rndate<br />";
}
}
}
1 Re: Releated news / forum topic dates
avatar
OP 0
From: -
Releated news / forum topic dates

I do notice that not all stories are being returned. I have two test items in a row that both have "Test" in the title, but the first item has no related stories, and the second one does. I can confirm this on another set of items that should be related. Seems the FIRST (ie. newest) news items never gets any releated items, but any furure (older) ones do (but not always?!

It seems to work now.

It works for some items but not others. It worked for both "Chrome SpecForce" items, but not the two "Test" items.


I also notice the search function doesn't find all news items either. Could this be related?

Which MySQL version are you using? Is InnoDB or MyISAM enabled? You find this information in cadmin.

Here's the info from the Admin panel:
Welcome to Esselbach Storyteller CMS System (Free) 1.7.2 (released on Saturday 12th of June 2004 10:40:08 AM)


You are running PHP version 4.3.9 and MySQL 4.1.11-nt with InnoDB tables

I was running MySQL 3.23 with MyISAM tables when I first installed ST. I recently upgraded to MySQL 4.1 to get the better search functions, and updated my tables to InnoDB via the ST admin panel.

Curiously, if I search for "Chrome" I only get one result back. Something is def messed.. x)
1 Re: Releated news / forum topic dates
avatar
OP 0
From: -
Releated news / forum topic dates

Originally posted by timbo:
Like the calender Rushian, where is that from if you don't mind saying?

I found the basic script someplace in netland (probably  http://javascript.internet.com/), and then customized it to my liking. It did some out pretty nice I think. Smiling Face
1 Re: Releated news / forum topic dates
avatar
Administrator
1340
From: Vienna, Austria
Releated news / forum topic dates

I do notice that not all stories are being returned. I have two test items in a row that both have "Test" in the title, but the first item has no related stories, and the second one does. I can confirm this on another set of items that should be related. Seems the FIRST (ie. newest) news items never gets any releated items, but any furure (older) ones do (but not always?!


It seems to work now.

Additionally, I'd like to grab the posted story date on the related item and display it such as "Wednesday, March 30/2005 at 19:16:25"

You need to add something like this in the PHP part of the template:

$insert[story_time] = date(“l, F d/Y at H:i:s“,strtotime($insert[story_time]));


I also notice the search function doesn't find all news items either. Could this be related?

Which MySQL version are you using? Is InnoDB or MyISAM enabled? You find this information in cadmin.
1 Re: Releated news / forum topic dates
avatar
0
From: -
Releated news / forum topic dates

Like the calender Rushian, where is that from if you don't mind saying?
1 Re: Releated news / forum topic dates
avatar
OP 0
From: -
Releated news / forum topic dates

RE: skipping "Related stories" text if none: WORKS!

I do notice that not all stories are being returned. I have two test items in a row that both have "Test" in the title, but the first item has no related stories, and the second one does. I can confirm this on another set of items that should be related. Seems the FIRST (ie. newest) news items never gets any releated items, but any furure (older) ones do (but not always?!.) My test page:  http://www.specforce.net/cgi-bin/storyteller/index.php

Additionally, I'd like to grab the posted story date on the related item and display it such as "Wednesday, March 30/2005 at 19:16:25"

I also notice the search function doesn't find all news items either. Could this be related?

RE: forum topic date: WORKS, but I had to change the var to $insert[story_time] since that's what the template was already using. No biggie.
1 Re: Releated news / forum topic dates
avatar
Administrator
1340
From: Vienna, Austria
Releated news / forum topic dates

I'm also getting the "Related stories" text even if there are none, but I should be able to code around that.


Change:

 if (mysql_num_rows($dquery))

to:

 if (mysql_num_rows($dquery) > 1)


Nope, the standard built-in forums. The var I'm using is insert[story_time]. As mentioned, it works great for the news items, but not the forum topics. Smiling Face


Open core.php in an editor and find:

 $insert[story_url] = "thread.php?id=$insert[thread_id]";

Then add the following line:

 $insert[story_date] = $insert[thread_endtime];


You need to do this two times.
1 Re: Releated news / forum topic dates
avatar
OP 0
From: -
Releated news / forum topic dates

Add the following code on top of template news after global $insert;:

$searchstory = addslashes(substr($insert[story_title], 0, 8));
$dquery = DBQuery("SELECT * FROM esselbach_st_stories WHERE (story_title LIKE '%$searchstory%') AND story_category = '$insert[story_category]' AND story_hook = '0' ORDER BY story_id DESC LIMIT 8");

if (mysql_num_rows($dquery))
{
$related = "<br /><br />Related stories:<br />";
while ($rdata = mysql_fetch_array($dquery))
{
if ($rdata[story_id] != $insert[story_id])
{
$related .= "<a href='story.php?id=$rdata[story_id]'>$rdata[story_title]</a><br />";
}
}
}


and $related in the HTML part of the template, where the related news should appear.

Having trouble with this.. As quoted, nothing printed where I added the $related var. I do have at least 4 stories in the database that would be related. I removed the AND part that checked the category, and now I get releated stores. I dunno if it matters but I renamed my default category. Yes, the releated items were all in the same category too (I only have one..)

I'm also getting the "Related stories" text even if there are none, but I should be able to code around that.

Also, I've figured out how to get the date of the news item to display in the headlines block, but for the latest forum topics, it prints today's date, and not the date of the forum topic. How do I fix that?

Are you using an external forum script?

Nope, the standard built-in forums. The var I'm using is insert[story_time]. As mentioned, it works great for the news items, but not the forum topics. Smiling Face
1 Re: Releated news / forum topic dates
avatar
0
From: -
Releated news / forum topic dates

Hey, wouldnt that be in review.php ? In the root directory?
1 Re: Releated news / forum topic dates
avatar
Administrator
1340
From: Vienna, Austria
Releated news / forum topic dates

Add the following code on top of template news after global $insert;:

 $searchstory = addslashes(substr($insert[story_title], 0, 8));

$dquery = DBQuery("SELECT * FROM esselbach_st_stories WHERE (story_title LIKE '%$searchstory%') AND story_category = '$insert[story_category]' AND story_hook = '0' ORDER BY story_id DESC LIMIT 8");

if (mysql_num_rows($dquery))
{
$related = "<br /><br />Related stories:<br />";
while ($rdata = mysql_fetch_array($dquery))
{
if ($rdata[story_id] != $insert[story_id])
{
$related .= "<a href='story.php?id=$rdata[story_id]'>$rdata[story_title]</a><br />";
}
}
}


and $related in the HTML part of the template, where the related news should appear.

Also, I've figured out how to get the date of the news item to display in the headlines block, but for the latest forum topics, it prints today's date, and not the date of the forum topic. How do I fix that?

Are you using an external forum script?

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.