Modx qr-code generator

У меня есть переменная $A, и я хотел сгенерировать qr-код с теми же данными.
Например, если $A=12345, чтобы сгенерировать qr-код, после его сканирования мы получим 12345.
Я пытаюсь использовать ludwigqrcode, но он не работает, или я не знаю, как передать переменные данные во фрагменте:

$QR = ‘[[ludwigqrcode? &txt= ‘$A’]]’; echo $QR; он возвращает «$A»

Есть ли у вас какие-либо советы или предложения?

I never used LudwigQRCode. The extra hasn’t been updated in a while and I also couldn’t find its Github repository.

Maybe give this extra a try:

Not sure if it works, as I have never used it as well.

The problem could be that you use single quotes for the string, so $A isn’t replaced with the value of the variable.

I tested this snippet code (with double quotes) and that seems to work:

$A = 12345;
$QR = "[[ludwigqrcode? &txt=`$A`]]";
return $QR;

Or use string concatenation:

$QR = '[[ludwigqrcode? &txt=`' . $A . '`]]';

Thank you very much exactly this was the issue :slight_smile:

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.