views:

274

answers:

3

i have created a content type named history when ever users want to opens specific page the content history should be inserted with new row.

i m using rules but stucked with query can any one help me please very urgent guys.

i have written a simple query to insert the data it even works but the problem wheni fetch the data in view it doesn't show up...

pls guys urgent

A: 

Can't the Statistics module help you? "It counts how many times, and from where each of your posts is viewed".

Kniganapolke
no it doesn't help me
rakeshakurathi
A: 

Hmm, seems a bit strange to use a content type for your viewing history, but I'll go with it. So you want history to have a new node created whenever a certain page is viewed, right? You're going to have to use a custom module for this.

You could write a module that implements hook_init() to do something like:

<?php
    MODULENAME_init() {
        if (drupal_get_path_alias($_GET['q']) == 'the_path_alias_of_your_page') {
            // create your node here, see http://api.drupal.org/api/function/node_submit/6 for example
            // then save it using node_save($node)
        }
    }

Obviously that's really rough, but it'll get you started.

Are you sure you can't just use Google Analytics or the like?

Mike Crittenden
A: 
Nikit
i have done this but when i create a node it doesn't show in the view may be i have to use node_save cck filds which is bit tricky...
rakeshakurathi
You should add in your module "views.api" support. Please read about it in http://views-help.doc.logrus.com/help/views/api-tables
Nikit

related questions