Hello, sorry for my English
I install Views Gallery and all required modules in Drupal Commons
I want to create the same referenceable node link "Add photo" in header section of the view attatched to node.
In my case the original link from links section goes to:
http://commons:8082/node/add/gallery-image/23?destination=node/23&gids[]=1 OR
http://example.com/node/add/{content-type}/{nid}?destination=node/{nid}&gids[]={og-id}
I'm not a coder and I don't know what code(php or html) must to put in the views header to prepopulate node id and group node id.
I try with PHP input format this:
print url('node/add/story/' . $node->nid); ">Add a story
from(http://drupalcode.org/viewvc/drupal/contributions/modules/nodereference_...) but don't prepopulate node id in views and there is no group node id.
Thank you in advance for your help.
Comments
Comment #1
jippie1948 commentedHi,
I used the following code to get the same strings in the Header as in the 'Add photo' link on the bottom of the attached views:
The problem is not to get the Views Header link properly populated.
The problem is that the Views Header link is not read by Node Reference URL so that when clicked the URL widget on the create form shows "Referenced content not found."
The bottom link "Add photo" with the same string in the status bar does work properly. I do not know if this is a Views or Node Reference URL or both problem.
It would be great if the link in the header would work!
Comment #2
quicksketchIt's because your URL isn't properly formed. You have to pass the query string into the l() function separately, right now Node Reference URL Widget is trying to take "10?destination=view/path" as the NID, because the question mark is getting encoded in your link.
Additionally your missing brackets around the IF statement look like they'd cause trouble when you're not on a node page.
See the documentation for l() and url().
Comment #3
jippie1948 commentedthanks quicksketch,
your solution works perfectly!
After having added a ) :-)
JanPieter.
Comment #4
Anonymous (not verified) commentedHi there. I'm troubleshooting here, trying different things to get what I want/need. I tried adding the code from #2 to the footer of my Node Reference URL View (that shows on my node), but I get a parse error:
Parse error: syntax error, unexpected ';' in /mywebsite/includes/common.inc(1696) : eval()'d code on line 5
Can someone help? Please and thanks!
Sonia
Comment #5
tmax commented@Sonia like jipple commented... add one more ) on the above code
so on your header the full php code will look like this
also on path concerns...
you can customize as per how you have set your paths... eg
$path = 'node/add/gallery-image/' . $nid;
or
$path = 'node/add/photo/' . $nid;