This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

News titles on one page

Hello, comrades.

I want to output news titles on the page (without teasers and other stuff). Picture demonstrate this:

http://www.comics.com.ua/images/news.gif

I wrote such code:

<?php

function title_list($result, $title = NULL) {
  $dt = "";
  $cond = 0;
  $out = "";
  while ($node = db_fetch_object($result)) {
    $a = getdate($node->created);
    if ($cond == 0)
    {
      $y = $a['year'];
      $m = $a['mon'];
      $d = $a['mday'];
      $dt = "<p><b>".$d.".".$m.".".$y."</b></p>";
      $out = $out.$dt;
      $cond = 1;
    }
    else
      if (($y != $a['year']) || ($m != $a['mon']) || ($d != $a['mday']))
      {
        $out = $out.theme('node_list', $items, $title);
        UnSet($items);
        $a = getdate($node->created);
        $y = $a['year'];
        $m = $a['mon'];
        $d = $a['mday'];
        $dt = "<p><b>".$d.".".$m.".".$y."</b></p>";
        $out = $out.$dt;
      }
      else
        $dt = "";
    $number = module_invoke('comment', 'num_all', $node->nid);
    $items[] = l($node->title, 'node/'. $node->nid, $number ? array('title' => format_plural($number, '1 comment', '%count comments')) : '');
  }

  return $out.theme('node_list', $items, $title);
}


global $user;
if (user_access("access content"))
{
  $stories = "";
  $queryResult = db_query_range("SELECT n.uid, u.name, max(n.nid) FROM {node} n INNER JOIN {users} u ON u.uid = n.uid WHERE n.type = 'story' AND n.status = 1 GROUP BY n.uid, u.name ORDER BY 3 DESC", 0, 10);
  while ($node = db_fetch_object($queryResult))
  {
    $stories .= title_list(db_query_range("SELECT n.title, n.nid, n.created FROM {node} n WHERE n.type = 'story' AND n.status = 1 AND n.uid = " . $node->uid . " ORDER BY n.nid DESC", 0, 10));
  }
  print $stories
. "
". l(t("more"), "story", array("title" => t("Просмотреть остальные новости."))) ."
";
}
?>

It works fine, but it output titles of ALL materials from ALL vocabularies. How to modify SQL-query for outputting titles of only ONE vocabulary (f.e. "News")?

cannot redeclare function

Upon enabling a new module, I am getting this error message:

Fatal error: Cannot redeclare _hilite_get_query_terms() (previously declared in /home/choirgee/public_html/modules/hilite/hilite.module:65) in /home/choirgee/public_html/modules/hilite/hilite.module on line 65

The only place this function appears in my drupal installation is in this module (obviously) at:

line 65

Finding what user is accessing a page?

Hi everyone,

I need to query the DB for a field in the profile_values table - but im off to a very bad start :)

How do i find the users uid (or any other identifying factor) - I mean the user how is looking at the page,...

I can see a session id, and i can even see a user->uid but this does not work:

print_r($user)

So, how do i access the currnet users details?

Many thanks

attachments to comments

I badly want attachments to be added to comments can anybody help me out with that...
Regards,
A.K.Karthikeyan

Is the album/folksonomy/image suppose to work with cvs?

I'm trying to use the walkah's new image module alongside the album module. I installed folksonomy and the rest in a clean install of drupal CVS. However, I get the error

DOC Type and xml info does not appear on first line of page

My website at http://www.my-kart.org/web/ seems to parse the page templates and adds a few blank lines which renders an error in the xml feed.

I know I am not providing much info because I do not know what really is the info to provide.

I am running a standard Drupal 4.5 with a number of the distributed modules installed. I do not what is causing the additional blank lines inserted in the page source.

Any general thoughts as to what typically would cause these additional lines to be inserted?

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions