QRC in admin

By Toledoh - January 20, 2016

Hey guys.

How would I go about creating a QR Code in the admin.  ie.  I want to be able to create a record in a multi record section, and have a QR Code created for that record and displayed in the admin for the administrator to print out and use.

It can be random or based on the num of the record etc - but has to be unique.

Cheers,

Tim (toledoh.com.au)

By Toledoh - January 22, 2016

Thanks Greg.

I've implemented the following:

<tr><td>
<?php
if(@$_REQUEST['num']){
echo qrCode(array(
'type' => 'text',
'text' => @$_REQUEST['examplecode'],
));
}
?>
</td></tr>

And this in the front-end page

<div class="col-xs-3 qrc">
<?php
echo qrCode(array(
'type' => 'text',
'text' => $record['items.examplecode']
));
?>
</div>

However, they create different QRC's as attached.  The one from the front-end can be read, but the one from the admin can't.  Any ideas?

Cheers,

Tim (toledoh.com.au)
Attachments:

cmsb.png 1K

front.png 1K

Hi Tim,

I thought I'd post the solution we used to resolve the issue to this forum thread:

<?php
if(@$_REQUEST['num']){
$record = mysql_get('blog', $_REQUEST['num']);    
echo qrCode(array(
      'type' => 'text',
      'text' => 'Hello world! ' . @$record ['title'],
    ));
   }
?>

So the code above was added to the separator HTML field. It will retrieve the current record if it exists, and allow you to access any variables from the record. You'll need to update the variable blog with the section you're currently editing. 

Just a note, this will load the data from the previous save of the record. So in this example if you made any changes to the title, they won't appear in the QR code until you reload the record.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com