hi

i have content types Owner and Products both have cck fields. Product have a node reference cck field which refer to a particular Owner content type, it also has a cck field "no of employees" which is of type int.

Now what i need to implement is whenever i visit a particular Owner contents, there should be a tab or a link on clicking it i should get a chart showing distribution of "no of employees" of products which have node reference field set to be this particular Owner.

Right now am using google chart, am retrieving the contents from the database directly. Am using sql query to match the Owners name or nid and using the values of "no of employees " field. But here am giving the argument manually for eg ..{ SELECT .............................. WHERE field_ownername_value = "Steve" } where Steve is one of the owner.

But i need to get that information ie " owner's name " dynamically. I mean if am at a particular owner's page and i click the CHART link, how can I transfer the current information " current nid or owner name or title " to the next page where I can use these values to build the chart.

Help needed urgently.

thanks
regards
Pankaj

Comments

Blueeeeie’s picture

You can use this php code to retrieve the current node id.

if(arg(0) == 'node' && is_numeric(arg(1))) {
 //your code here. 
}

If the above condition is true, arg(1) would contain the current node's ID.

Hope this helps.

---
www.drupaldiy.com

pankajchand’s picture

true .. i can get the current node id ( say node X ) .. but i need that nid to be used in another page ( say node 15 )where i have the actual code for charts ... the link for chart in the current node ( node X ) points to a page (node 15) where I want to display the chart using the information ie nid or title of node X.

What i want to implement is that every Content page of different owners will have a link to the chart node " node 15 " where i calculate the chart using the information of the owner from whose page the link was clicked. For eg if the node 15 is called from owner " John's page " then chart will be created using john's information, if its been called from "Mark's page" , then chart should be created using Mark's information.

One way is to create different chart nodes for each of the owners page which will have links to their respective chart nodes. But i want to have a single node and some how pass the information of the particular owner node from where the chart node has been called, and use that information to build the chart.

is there any way to do that

thanks
regards
Pankaj

Blueeeeie’s picture

You can make use of query strings.

eg. http://www.yoursite.com/your-page?nid=X

Then just use the $_GET['nid'] function to retrieve it.

Hope this helps.

---
www.drupaldiy.com

pankajchand’s picture

http://www.mysite.com/mypage?nid = X this will be node X isn't it. Or will it be a page redirected from node X to the chart page ie http://www.mysite.com/chart?nid = X .

1) If this url represents the node X only then my problem still remains :

$nid = $_GET['nid']; nid will contain X but how to use this nid in another node that i mentioned as node 15

2) if the url represents another node ie in my case ( node 15 ) then please guide me how to specify such query strings for node 15

thanks
regards

WorldFallz’s picture

Another option might be the http://drupal.org/project/prepopulate module.

Also, I've deleted your other duplicate posts-- pls don't cross post the same question over and over again.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz