This topic is locked

Integrate PHPRunner data into Wordpress

11/9/2019 2:19:01 PM
PHPRunner Tips and Tricks
fhumanes author


When I finished the previous exercise that simulated a list of forms in an organization, I had the “problem” of how to publish this list of forms in a CMS content portal and although on other occasions I have done this with the Joomla CMS, in this case I set out to do it with WordPress which is the most widespread and the one I like the most for my blog.
I have reviewed articles on the PHPRunner forum and I see that this topic has been treated, but a long time ago, with very earlier versions of PHPRunner, so it seemed good to do the exercise.
Objectives I am looking for in the exercise:

  • Integrate the data and if possible the presentation of the same we do with PHPRunner.
  • Use, if possible, a product that does not carry an additional cost
  • Make it functional, but at the same time simple for PHPRunner developers.
  • That the presentation can be made in Spanish, so that the solution is open to more languages than English.
  • I am interested in the publication part and not the maintenance management of the contents because I want to have that functionality always in PHPRunner.


Following the previously published articles, I started by testing the integration by IFRAME and thus perform the following tests.
I have used the “IFRAME” plugin that we would have this type of presentation.


And this other plugin “POPUP WITH FANCYBOX”, which opens a window and shows the application .


I don't like any of the 2 solutions and they seem impractical.
I remembered that we can program that through a parameter in the execution URL we can tell PHPRunner to delete menus, headers and that is what I include in this article in case you need to use it.
In the event "after application initialized" include the code:



if(isset($_GET['iframe']) AND $_GET['iframe'] !== '' )

{ $_SESSION['iframe'] = $_GET['iframe']; }


With this, if we run the application with http: // localhost / forms? Iframe = y, a session variable "iframe" will be created that will have a value of "y".
I have created a file “use_iframe.php” in the “ICM” directory with the code to deactivate the information blocks we want.



if($_SESSION['iframe']=='y') {

$xt->assign("left_block", false); // Turn off Menú left

$xt->assign("supertop_block", false); // Turn off Menú top

}


In all the tables and presentations where we want to remove these blocks we will have to include this code in the “Before display” event:



include "ICM/use_iframe.php";


How to know which block to deactivate or not generate code?
In the "Editor" option, press the "HTML Mode" button and we will have an image of this type:


There we can see the blocks that have the design that we have chosen.
Even with these possibilities, the solution was not to my liking.
In integrations of this type with Joomla I really liked a “JOODATABASE” product that allows us to integrate external tables and excellent data presentations can be made.
To see if there was a similar product in WordPress I started consulting this publication https://wpleaders.com/best-wordpress-table-plugins/ and between one navigation and another, I found WP DATA ACCESS, which more or less does what I was searching and publishing data from external tables in WP tables through SHORTCODE.
In most of these products, the FREE versions are only in English. What I was looking for was that the part of publication on the portal could be put in the language that is needed and that is why I have translated that part into Spanish and in the same way it can be done for any language.
This image shows the result of publishing some of the Forms sample data.


Thus, this solution would allow to integrate the "list" of the forms and from there to access the PHPRunner development for the input of the form data and other part of the process.
In this way you can do, with what we take advantage of the data but not the presentation of them, of the development made in PHPRunner.
To make the links in the presentation you have to encode a field as if it were an html in the MySQL database view. An example of this is this view:





SELECT

`idform_steps`,

`Name`,

`Order`,

concat(' <a href="http://localhost/forms/',Url,'" target="_blank">',URL,'</a>') Url,

`Instructions`

FROM forms.form_steps;


I believe that the best solution for the integration of PHPRunner projects in WordPress is to produce the list with the WP DATA ACCESS plugin and from there, open a new window with the PHPRunner application.
That new window can take the whole context of the application (Menus, headers, etc.) or we can “clean” the presentation to leave it exclusively in the context of the WordPress portal connection.
[size="4"][/size]
In my blog https://fhumanes.com/blog/otros-ejemples/integrar-en-wordpress/ I leave in attached files the WordPress plugin (modified). The literals to be translated (for the presentation of the data) are in the javascript, specifically in “dataTables.responsive.min.js” and “jquery.dataTables.min.js”. The method is to find the chain to replace and change it.
I hope you find it useful and if you have any questions or problems, please tell me through my email [email="fernandohumanes@gmail.com"]fernandohumanes@gmail.com[/email].

fhumanes author 11/28/2019

Hello:
I have updated the plugin (Spanish translation) to version 2.7.1, which is the latest and I have tried it, working perfectly.
Regards,

fhumanes author 12/26/2019

Hi:

Version 2.7.3 has been published, which already supports languages, so you can use the plugin for any language.
I have only had a small problem. This is that it did not "wrap" in some field content. I have solved it by adding this CSS modification in my portal theme:



table.dataTable.nowrap th, table.dataTable.nowrap td {

white-space: normal !important;

}


Regards,

fernando

fhumanes author 2/1/2020

Hi:
Version 3.0 of "WP DATA ACCESS" has been released https://wpdataaccess.com/docs/documentation/getting-started/whats-new/.

It has very interesting new features.
Regards,
fernando

A
alang 7/20/2020

Hi Fernando
Thanks for your input on this topic - very interesting as I would love to integrate PHPRunner with WordPress but have problems allowing users to edit data. I have had a quick look at that plugin and it seems very capable. It seems to me however that the plugin really attempts to replace what you would normally use PHPRunner for (and PHPMyAdmin BTW). So are you using it to provide a VIEW of your database contents from your WordPress site? Do you allow your WordPress users to add/edit any data? This seems to be provided by the plugin "Data Projects".
Regards

Alan

fhumanes author 7/22/2020

Hello Alan
When I used this type of integration, in the CMS it showed the data of some of the systems and that query integration, the product offers you.
It also offers the maintenance of the information of the "tables" but that seems to me that for those of us who use PHPRunner it is not the best solution, since the control of updates is better done in PHPRunner.
In summary, in CMS portals, where users do not identify themselves and want to display information from some system, this solution seemed to me the best.
Greetings,
Fernando

A
alang 7/22/2020

Thanks Fernando - I agree - use the plugin for read-only view (more integrated with WordPress theme etc) and PHPRunner where user needs to add/edit data with different user roles etc. I ran into a clash trying to use the "Data Projects" part of it anyway. I have now resolved my issue of WordPress users being authenticated automatically in the PHPRunner application so will continue down that path for a staff portal accessed via WordPress website. Thanks again <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=92059&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />