[Edited] Using QR Codes in phpMyFAQ articles pages –a simple

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
pt20100201
Posts: 134
Joined: Mon Feb 01, 2010 2:11 pm
Location: Porto . Portugal
Contact:

[Edited] Using QR Codes in phpMyFAQ articles pages –a simple

Post by pt20100201 »

.
Using QR Codes in phpMyFAQ articles pages – a simple raw example

Dear All

The use of QR Codes in web pages and advertises is growing: in the first case because the webmaster consider them useful or because he/she must follow the site user’s trend.

In this post we describe some steps to integrate a open source QR Code generator in a phpMyFAQ-driven site.

Please notice that the described strategy is not the best way to integrate QR Codes (or other barcode symbology) in phpMyFAQ pages - we are just showing a working example -, namely
  • the QR Codes should be
    • created just once - at record creation and record ID modification;
    • stored in the FAQ database – preferably b64 encoded [1].
    • The generator program should be placed in the phpMyFAQ directory tree – perhaps under the “/phpmyfaq/inc” folder.
    • etc
Please also notice that we aren’t suggesting or endorsing the use of this practice, symbology, software, or other components (except phpMyFAQ use...)

Following these steps you may end up with a layout similar to

[attachment=1]pt20100201-20110811-02+03-w-qrcode-1+2.png[/attachment]
(see the attached file for a full screen version).

Components and locations
  • phpqrcode (open source) – http://phpqrcode.sourceforge.net/ 
    A simple PHP-based program – you may use others [2]
  • generator’s folder: at the web server root – /phpqrcode 
  • phpMyFAQ folder ; URL – /phpmyfaq ; http://faq.example.com/phpmyfaq/ 
  • temporary file folder: at the web server root – /temp 
  • specially crafted phpqrcode file for phpMyFAQ – /phpqrcode/faq-qrcode.php 
  • FAQ’s URL format used – http://faq.example.com/phpmyfaq/?solution_id=1234 
  • ([size=85]the most stable format among those that phpMyFAQ is currently able to generate[/size])[/*]
Steps (you must have the right privileges to perform them)
  1. Download the phpqrcode program from http://phpqrcode.sourceforge.net/ 
  2. Uncompress the downloaded file into the web server root (or to other place you have chosen).
  3. Apply the correct access rights to the resulting folder tree.
  4. If you don’t have a folder for temporary files create one (see above) and make sure it has the correct access rights.
  5. Place yourself at the program’s folder.
  6. Make a copy of the “index.php” file with the name “faq-qrcode.php” (or other you have chosen).
  7. Edit the “faq-qrcode.php” file in order to generate the QR Code image only by direct URL instructions.
  8. Edit the “artikel.tpl” phpMyFAQ template file and insert the URL instruction to generate the QR Code (see the example in the attached file)

[/size]
At this point your pages should contain a QR Code image bellow the FAQ ID.

If you use rewrite instructions and prefer to encode the resulting long URL, make sure that it’s maximum size and character charset is within the QR Code symbology requirements.[3]

Footnotes

[1] You may use the data URI scheme “ data:image/png ” directly in the HTML page with this b64 encoded string.
  • Example (at https://secure.wikimedia.org/wikipedia/en/wiki/Data_URI_scheme )

    Code: Select all

    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
    AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
    9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot">
[2] Examples:
  • Barcode Writer in Pure PostScript (free - MIT/X-Consortium license)
    https://www.terryburton.co.uk/barcodewriter/generator/ ;
    https://code.google.com/p/postscriptbarcode/
  • Zint (GUI and command line) The license type seems to have been changed
    http://sourceforge.net/projects/zint/ ;
  • etc...
[3] Otherwise use the phpMyFAQ’s short URL format or use another barcode symbology (with a different program) – some may encode a record’s full content.

[4] Some pages that may be of your interest:
  • QR code - Wikipedia, the free encyclopedia
    http://en.wikipedia.org/wiki/QR_code ;
  • Data Matrix - Wikipedia, the free encyclopedia
    http://en.wikipedia.org/wiki/Data_Matrix [an ISO standard];
  • [i]PDF417 - Wikipedia, the free encyclopedia[/i] [size=85]http://en.wikipedia.org/wiki/PDF417 [a stacked linear barcode – ISO 15438][/size];[/*]
  • ...
The attached file contains:
  • full layout screenshots;
  • the crafted “faq-qrcode.php” file for the generic example;
  • “artikel.tpl” template edited lines.
Attached file: pt20100201-20110811-qrcode-in-phpmyfaq-article.7z


Regards

2011-08-1
pt20100201
.


[attachment=0]pt20100201-20110811-qrcode-in-phpmyfaq-article.7z[/attachment]

Edited (2011-08-11): missing compressed attached file inserted. Our apologies.
.
You do not have the required permissions to view the files attached to this post.
Thorsten
Posts: 15815
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: [Edited] Using QR Codes in phpMyFAQ articles pages –a si

Post by Thorsten »

Hi,

this is pretty cool... I think about adding this into the main package.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply