51
Peekay
Setting manual trust path = blank module install page
  • 2013/2/13 19:47

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


In 2.5.5, if I set the Xoops Trust Path manually in mainfile.php, e.g.

define("XOOPS_TRUST_PATH"'C:/apachefriends/xampp/htdocs/myxoops-trust-path');


instead of the default:

define("XOOPS_TRUST_PATH"XOOPS_PATH);


I get a blank page on loading the module install page. Debug says:

Fatal error: Class 'ProtectorRegistry' not found in C:apachefriendsxampphtdocsmyxoopsmodulesprotectormytrustdirname.php on line 8


Protector is not installed, but it looks like the hard-coded $mytrustdirname variable in that file is causing the problem. If I remove the protector folder it works. Not sure if there is a way to resolve that? (to avoid others having the same issue). Quite a few modules use the trust path and not everyone will install Protector.

On a side note, it appears that the Xoops DHTML editor strips out back-slashes inside 'code' tags, which is why the above path is all one word. It is properly formed in the debug report.




52
Peekay
Re: QR Code Generator
  • 2013/2/9 14:16

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


It seems easy enough to pull variables from a module and feed them to a QR code using the Geekwright module. Slightly different method, but much faster because the QR code is generated on your server, not somebody else's.

As said previously, I can't test Xoops 2.5 or Publisher at present, but the code below worked fine for me using an old version of the 'Content' module (index.php). You obviously need to locate the PHP file + template file combination for the module you want to use and customise the script to suit, or I suppose you could create a module-specific block. Don't send the script any variables that don't actually exist, or it will choke.

// Peekays QR Code Hack **************

$data $xoopsTpl->get_template_vars('xoops_sitename'); // Add the site name

$data .= ' - '//Add a separator

$data .= $xoopsTpl->get_template_vars('xoops_pagetitle'); // Add the page title or module name

$data .= "%0A"// Add a line break.

$query_string $_SERVER['QUERY_STRING'] ? '?' $_SERVER['QUERY_STRING'] : '';
$url 'http://' $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . $query_string;
$oururl urlencode($url); // Add the link. N.B. this needs to be urlencoded.

$data .= $oururl;

$myqrcode '<img src="'.XOOPS_URL.'/modules/qr/getqrcode.php?qrdata='.$data.'" />';

$xoopsTpl->assign('myqrcode'$myqrcode);


// end QR Code hack ****************


I'm sure someone could tidy that up and make it more 'elegant'



53
Peekay
Re: QR Code Generator
  • 2013/2/7 21:12

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Just installed the Geekwright module on Xoops 2.3 (cannot do 2.5 at present due to localhost setup) and it works very well. It comes with 3 BLOCKS - a 'Manual QR code' block (you enter some static text) a 'This page' block (a URL link to the current page) and a 'Me-Card' which allows you to put your contact details into a QR code, although this may not be in a Vcard compatible format.

Although you can set the 'This page' block to appear on 'All Pages', to get it to work for all modules you need to load a page from each module and check the query-string in the address bar. For example, the query string in the 'Content' module is at the end of the item address:

Quote:
http://www.example.com/modules/content/index.php?id=1


To display a QR code linking to each item in a block on every Content module page, you would need to add id to the default list provided with the module in blocks admin.

You will need a small script to pull the variables together to generate a mixed text/URL QR code like Chefry wants, but looks promising. Plus, the QR codes are constructed on your server, not someone else's.



54
Peekay
Re: QR Code Generator
  • 2013/2/7 14:41

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


This module appears to have a QR library which is stored in Xoops Trust Path. There's a function call which looks like it may be customisable with variables:

modules/qr/getqrcode.php?qrdata=DATA_TO_ENCODE

I'll have a play with it over the weekend.

The other module worked, but I don't like function calls and back-links connected to 3rd party sites, so it's not for me.



55
Peekay
Re: QR Code Generator
  • 2013/2/7 14:21

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


I got this to work with News too, but I have un-installed the module now. It turns out that all the codes are sourced from designburo.nl, not generated by the module code.

Users should be aware of this if they are unhappy with dependency on external sites for module functionality.



56
Peekay
Re: QR Code Generator
  • 2013/2/6 18:39

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


It will work, but you cannot create a text link. As far as I know, phone QR code scanners cannot read HTML code in the QR, except links. The output would look like this (link would be push-clickable)

Quote:


Cucumber Ranch Dressing
http://www.example.com/modules/publisher/item.php?itemid=22293



You should be able to put other stuff in the text part, e.g. site name etc.



57
Peekay
Re: QR Code Generator
  • 2013/2/6 17:23

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


OK. I'll try and take a closer look at it tonight, unless Trabis can tweak his code first. This will work...



58
Peekay
Re: QR Code Generator
  • 2013/2/6 14:06

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Try changing:

$item['qrcode'] = qrcode('url'$data$size);


to:

$item['qrcode'] = qrcode('txt'$data$size);


Basically, if you want both text and a URL in the QR, the QR 'type' needs to be text (txt). You may also need to add a non-breaking space between the title and the URL values stored the array, but I am not sure how to do that in an array. I would just concatenate the two variables, but I'm old school!

In essence you're aiming for:

$data = array();
$type "txt";
$data['txt']= (The title variable a space the article url) ;
echo 
qrcode($type,$data);



59
Peekay
Re: QR Code Generator
  • 2013/2/5 21:21

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


I am on a laptop with no Xoops install, but trawling code from a module download of the 'News' module I would say you need to do something like this. In 'article.php' you would add:

$data=array();
$type="url";
$data['url'] = '.XOOPS_URL.'/modules/news/article.php?storyid='.$this->storyid().'';
$showmetheQRcode= qrcode($type,$data);


Then, where the template assignments are made, normally lower down the page:

$xoopsTpl->assign('showmetheQRcode'$showmetheQRcode);


Then, in the template file (news_article.html)

<div><{$showmetheQRcode}></div>


I cannot test this and I'm sure there will be a missing quote mark somewhere that will stop it working, but that's the general idea, I think

This is obviously not an 'out-of-the-box' solution, but perhaps the developer will publish some specific code examples for the more popular Xoops modules to help get people started.



60
Peekay
Re: QR Code Generator
  • 2013/2/5 18:42

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


As far as I can see, to use the QR Code module you would just need to adapt the PHP file of Publisher that sent the article to the Smarty template. First, you would include the qrcode file:

include_once XOOPS_ROOT_PATH."/modules/qrcode/qrcode.php";


Then add this code:

//Visit website
$data = array();
$type "url";
$data['url']="http://www.example.com";
$size="250"// image will be 250x250px
echo qrcode($type,$data,$size);


However, in place of "http://www.example.com" you would grab the article URL, pop it into a variable and use the variable instead of the URL. Each article the user views will have a different URL which should be automatically embedded in the QR code.

Instead of the echo statement, you would send the output to the Smarty template, or add the echo statement to the template and pull the variables from the PHP file.

I don't use Publisher, but I'm sure someone who knows it could post some real-world code to show how that might work.




TopTop
« 1 ... 3 4 5 (6) 7 8 9 ... 187 »



Login

Who's Online

185 user(s) are online (110 user(s) are browsing Support Forums)


Members: 0


Guests: 185


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits