I want to add a 'like' button to a table. I get as far as the like button appearing on the page, but I can't figure out how to build the link into that spot.

The problem is, the only way to do that (that i've found so far) is to make a full html field on the content item and place the code for the iframe in there. I can't figure out how to make that a link to the node itself.

I tried using the view to add a field Global text, but I can't get an iframe to load from there. If I could do it there then I could use replacement patterns to build the proper link.

If it helps unmuddle it to remove some context: I want to create a table of nodes that pass a filter. I want that to be a table of iframes loading the node the table row represents.


In views you can simply do it with the help of Views PHP module

This module allows administrators to add fields, filters and sorts to views which use PHP code.

  • I added that to an install the other day and it locked my site up so all form submissions WSOD'd me with no errors, but I'll do a backup and give it a test run. – Jake Apr 16 '12 at 5:47
  • Reported installs: 10776 sites currently report using this module. drupal.org/project/views_php. – niksmac Apr 16 '12 at 6:00
  • I backed everything up (<3 drush) and installed the module. It didn't cause the same problem this go around so I configured what I needed and got it rolling after 3 fatal errors and one fundamental misunderstanding. This answer led me to what I needed to get the job done. Both answers would get +1 but my drupal.stack rep is too low. Sorry guys. I'll come back to fix that when I get some rep here. – Jake Apr 16 '12 at 6:03
  • Thumbs up. See you soon. – niksmac Apr 16 '12 at 6:06

Is this table generated from Views?

If so, you should be able to just add a node link, rewrite it to output ONLY the URL, hide it, then use that field as a rewrite pattern in your facebook button's output, so the like button is applying to the URL of the node itself.

  • I think I get the general idea, but I'm a bit cloudy on how to do it in drupal. Yes, the table is generated with views. I made a global custom text field on the view that would do something like <iframe src=node/[nid]></iframe> but I can't get views to not strip the html from that. My original solution was to put the iframe into the content, but that is hard to manage and you can't do replacement patterns there. – Jake Apr 16 '12 at 5:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.