QRC in admin

Hey Tim, 

The simplest way to implement this feature is to create a separator and add custom HTML and PHP that displays a QR Code. The QR code gets the num of the record from the URL and uses that variable to create a unique ID. This QR code will appear after the first time they save the record.

Here is the code I added to the separator: 

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

I've attached a screenshot that shows how I implemented this code into the separator. 

The user would be able to print this by right clicking on the QR code and clicking 'open in new tab'. From here they could print the code without the other page content. 

Let me know if you have any questions. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com
Attachments:

seperator example.png 118K

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