I would like to setup a cck viewfield that points to a view. I would like to pass parameters to the view to create the moble code.

After I enable it, how do I create the mobile code for the node?

Comments

ice5nake’s picture

Issue tags: +cck views

I created a custom views template file for a path field I created in a view.

The template looks like this.

  print theme('qr_codes', $output);

However I am trying to figure out how to control the size of the image. I hope there is a parameter for the theming function above that will allow for this.

IncrediblyKenzi’s picture

theme('qr_codes', $output, 150, 150) should work for controlling the size.

windm’s picture

Just a quick question regarding this "qr-code in Views", hopefully not "off-topic"...:

When I got that right, you put that piece of code into a special view...tpl.php to get the QR-code for the path-field.

Seems to become difficult for my case, because I need to refer to create the QRcode for a path/node that is specified by it´s nid as the arg(2) of the view-URL.
For this reason I thought about "rewriting" the output of a (path) field with that kind of PHP Code, but the "rewrite the output of this field" seems to only accept some text or HTML.
Another solution for me would be to set up an "empty field" (in a way like using a GLOBAL:NULL Argument) and use that piece of code:

$node = node_load(arg(2));
print theme('qr_codes', 'http://www.domain.com/' . $node->path, 150, 150);

(arg(2) is the nid taken from the views arguments...)

Do you have any ideas or experience, how to get that QR Code - element into views as a "field"?

Edit: OK... the field-issue was quite easy... I use view_customfield right now with the "content"

$node = node_load($data->nid);
print theme('qr_codes', 'http://www.domain.com/' . $node->path, 150, 150);

Works fine for all Views (page, preview...) except for the "PDF Page" (created by view_pdf module) - the PDF should contain all fields incl. the customfield with the QR Code but does not display it.
Any idea from the QR-Code side of the "problem"?

SocialNicheGuru’s picture

why not use views_customfield?
it will return $data with items specified in the view. So if you need path just add it to the view

set up the view to return the node:path that you need.
you could use your print statement from above

if (module_exists('qr_codes')){
print theme('qr_codes', 'http://www.domain.com/' . $data->field_path, 150, 150);
}
windm’s picture

thanks SocialNicheGuru - the views_customfield was one part of the solution and the other part was in the views_pdf display settings... (still not satisfying, but I got the 1st QR on the pdf right now...).

So nothing more to investigate on the QR-Code side...

for me - solved and closed...

amirtaiar’s picture

Thank you windm for the sulution in #3 which works fine for me. [#4 didnt worked for me well].
I am also need to to print this in using the views_pdf and I was wonder whether you have found the sulution.

amirtaiar’s picture

I just see that the QrCode lead to the homepage.... Not good for me.

I was trying to understand where and how should I use the code in #4?

amirtaiar’s picture

I am sorry - It was a pathauto issue - Even though it is strange...
Some node which url was node/[nid] (Before setting pathauto). so barcode wasn't lead to the node...