Welcome to Geeklog Tuesday, September 17 2019 @ 11:00 pm EDT

Geeklog Forums

Search results without the time


Status: offline

Imaginate

Forum User
Chatty
Registered: 03/12/03
Posts: 41
This is the code that outputs the DATE & TIME with the search results: does anyone know how to remove the actual time from the date in its place put the year?

or at least just remove the time from the story?


// get rows
$A['title'] = str_replace ('$', '$', $A['title']);
$thetime = COM_getUserDateTimeFormat ($A['day']);
if (empty ($urlQuery)) {
$articleUrl = COM_buildUrl ($_CONF['site_url']
. '/article.php?story=' . $A['sid']);
} else {
$articleUrl = $_CONF['site_url'] . '/article.php?story='
. $A['sid'] . '&query=' . urlencode ($urlQuery);
}
$author = $this->_displayName ($A['username'], $A['fullname']);
if ($A['uid'] == 1) {
$profile = $author;
} else {
$profile = '<a href="' . $_CONF['site_url']
. '/users.php?mode=profile&amp;uid=' . $A['uid']
. '">' . $author . '</a>';
}
$row = array ('<a href="' . $articleUrl . '">'
. stripslashes ($A['title']) . '</a>',
$thetime[0]);

Status: offline

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
if you're keen on modifying the core then to start you can modify (config.php):
PHP Formatted Code

$_CONF['dateonly']        = '%d-%b';
 
Change the previous to the following In order to reflect the year as well as just the day and month (which I think a date should do anyway) like so (config.php):
PHP Formatted Code
$_CONF['dateonly']        = '%d-%b-%Y';
 

Then change the code you quoted above to reflect the following (search.class.php):
PHP Formatted Code
                //$thetime = COM_getUserDateTimeFormat ($A['day']);
                $thetime[0] = strftime( $_CONF['dateonly'], $A['day'] );
 

You can always just define your own custom date format and create a new space for it in the config.php file like $_CONF['mypreferreddateformat'] and then use that in the above snippet.

Or you could add your preferred date format to the database and just select it as default in your site's settings. That would make it a site wide change, but you wouldn't have to modify the core.

I can go on if you like, but that should get you going.

Status: offline

Imaginate

Forum User
Chatty
Registered: 03/12/03
Posts: 41
that worked perfectly. Thanks so much.

this is the output

http://www.khmi.org/gl/public/search.php?query=zzmed&keyType=phrase&datestart=&dateend=&topic=0&type=all&author=0&mode=search&results=1



All times are EDT. The time is now 11:00 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content