Attaching the comment form programmatically How do I add the comments form (of the comments module) programmatically in a custom-made module?
In other words, what proper code should be added to your module code to add a complete "Post New Comment" form (of the Comments core module)?

That said, how do I force the installation of the Comment module with the installation of your own module?



I'm re-asking my question in an edited version with some new results i've reached :). 
I've created a custom menu in a custom module of mine, with items of course.
I wanted to add the comment form (of the Comment module) to the page that my item takes me to.
The problem is that the page i'm redirected to is not a node, but it is a render-able page that displays the data according to it's 'page_arguments'.
It is as follows:


$items['car/%'] = array(
        'title' => 'Cars',
        'page callback' => 'car_page',
        'page arguments' => array(1),
        'access callback' => TRUE,
        'type' => MENU_CALLBACK,
);


I want to attach the comment form (of the Comment Module) to that page.
I used the following code:


module_load_include('module', 'contact');

$build = array(
    'header_text' => array(
        '#type' => 'markup',
        '#markup' => 'Building comments in page.',
    ),
    'the_form' => drupal_get_form('comment_form', ''),
);

return $build;


All is correct code.

But the problem is that the comment form and the posted comments are loaded depending on the node Id (nid), and in my case there is no node Id (nid)!

How could i assign a specific identifier of that custom page so that the comment form functions correctly and comments related to that page are correctly loaded?!

And in the code above, i managed to call the form using drupal_get_form(), and assigned an empty second argument! I don't think that's right, right?

Any ideas!?
comment_form() is expecting the parameter to be an object rather than an array so you should be doing something like this:

$comment = new stdClass;
$comment-&gt;nid = $row-&gt;nid;
$form = drupal_get_form('comment_form', $comment);


Note the lack of a 3rd parameter passed to drupal_get_form(), comment_form() only accepts the comment as a parameter, if you want to add a title you'll have to print that separately.

Finally drupal_get_form() returns a render array rather than a string so you need to pass it through the render() function:

print render($form);


The extra errors you're getting are just side-effects of passing an array rather than an object to the comment_form() function