Need PHP in Template File, Shortcodes? Demo inside.

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
neodude112320
Posts: 5
Joined: 2016-06-21 11:52

Need PHP in Template File, Shortcodes? Demo inside.

Post by neodude112320 » 2016-06-21 12:03

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?

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

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

Post by grimblefritz » 2016-08-09 19:59

Did you get this worked out?

neodude112320
Posts: 5
Joined: 2016-06-21 11:52

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

Post by neodude112320 » 2016-08-11 07:36

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.

Post Reply