So I own a computer repair store. We have a point of sale software that we really like. There is a “check repair status” folder you can install this app on another website, I love the way this works, but want to incorporate it (deps.php, index.php, headerstatus.php, footerstatus.php, common.php) all into one file so I can execute that php in the post section of a WordPress page remove the
<? php {php _code here} ?>
tags and replace them with [insert_php] {php code here} [/insert_php]
with the use of a wordpress plugin “insert php” only the code between those two tags will be executed inside that WordPress page (inphp) it has been posted on.
The problem is it cannot reach out to another file from there it all has to be contained. Since wordpress pages aren’t physical locations rather information from a DB. It would be nice to run that php from the page so I could easily just create a couple small custom class sizes for boxes and divs then delete all previous custom classes and styles in the php and allow the default class/styles from our theme take their place and custom styles/classes (likely inline)by me for those that aren’t defined by the default css of our theme.
So is there command we could use to tell the index where to reference those functions, parameters, or commands from within the same file, as opposed to referencing separate files?
require("deps.php"); require("headerstatus.php"); require("common.php");
require_once("footerstatus.php");
function showstatus() { require("deps.php"); require("headerstatus.php"); require("common.php");
So if it’s not possible to remove require, or use the require or another command to point at a localized function, line, or path in its place. either a (note I said possible, this code doesn’t need to be perfect it needs to run from a single script and work. I understand people hate to recommend non standard answers to programming.)
How much work would it be to rewrite each individual item needed from the common, deps and php files to reflect the type of data its looking for?
Or would it make more sense to rewrite the code in the index to work better with localized functions?
The problem is that I need this to work, and can find no examples online which is not usually a good sign. I’m open to any and all suggestions!
Just throwing out ideas here, also if you make a suggestion please give an example.
The best way to do this is to preserve the folder structure of the application you want to insert. This way paths should still work, they are relative to the file so should still work.
so
1. create a new folder in your theme called “repairstatus”
upload all the files into that — index.php etc
Place the following code in your themes functions.php (or create a child theme
Now navigate to settings on the admin dashboard and click on permalinks. Just hit the save button. test at this stage, http://accuratepctech.com/repairstatus/ should open index.php (it will look funny for the moment)..
now mod the index.php file…all we need to do is comment out the headerstatus and footerstatus requires, they will break the html output…
We can use
get_header()
to load the header of the wp site which will load css, navigation etc. andget_footer()
for the footer element.now you should have a wp looking page just the index.php code will be unstyled. You can add the css in by using
(note this is html, close php tags to use it) but id recommend you open this file and copy into your style.css in your theme, you can then change the css to suit.
Note this will probably work as is, but there may be errors so check the operation throughly. I’m going to recommend you google wpdb and update to use WP database functions (you can create seperate tables if you want) otherwise you have 2 db connections on the go. This will not be good for the performance of the website, it will load ok with 1 user but 3/4 concurrent users will start to slow everything down…