Page 1 of 1

Need PHP in Template File, Shortcodes? Demo inside.

Posted: 2016-06-21 12:03
by neodude112320
Hi All,

I Need some assistance or suggestions.

Essentially this is what I need to accomplish:

Predefined items to be inserted into a text box, the predefined options are created in a seperate table.

Here is a demo:

http://screencast.com/t/uJfiz4TjV

The problem is, the dropdown box does not currently get the items from the database. This is because I cannot put PHP Code into the Template file (Everything upto this point has been HTML and JS) - to query the DB and generate the list options (It is all hard coded for testing at this stage).

When I look at the Template file however I do see the Dropdown boxes that Appgini generate, are called using shortcodes?

Code: Select all

<div class="row form-control-static"><div class="col-xs-11"><%%COMBO(delivery_address)%%><%%PLINK(delivery_address)%%><%%ADDNEW(addressbook)%%></div></div>
I Have several ideas on how I can get around this but I need some help.

1. Is there a way I can define custom shortcodes, So I can put the PHP Code elsewhere, and just call the shortcode when I want to display my custom dropdown box in the template?


2. Could I create a Lookup fields in AppGini and then somehow call that using my JS Code (See below)?

Code: Select all

<script>
function insertText() {
    document.getElementById("loaddetails").value += document.getElementById("item").value+"\n";
}
</script>
3. Has anyone, got a better idea on how I can get Multiple predefined items into this text box?

Re: Need PHP in Template File, Shortcodes? Demo inside.

Posted: 2016-08-09 19:59
by grimblefritz
Did you get this worked out?

Re: Need PHP in Template File, Shortcodes? Demo inside.

Posted: 2016-08-11 07:36
by neodude112320
Yes I did - Rather crudely though.

In my Template's file I was able to code in a button that opened a popup - the popup was my PHP Script that simply populated the text field on the parent page. It works - Not as elegant as I wanted it but it works none the less.