Custom Template Add Page

Hi all. I’m playing around the custom templates and so far so good. But upon trying to use the lookup “Allow Add” option on a table that I’ve previously created a “Add/Copy” template for it doesn’t seem to apply. So do custom templates not apply to “opt” pages as of currently?Thanks.P.S. Is there currently any way to copy views? I have a view with several “Custom Fields” and I need to make similar views. Any way to do this? I would have used “linked tables” but apparently you can’t add “Custom Fields” to “Linked Tables”. It throws up an error. Thanks again.

  1. Custom Template does not support Add Option page (which is different from Add page).
  2. There is no “copy view” feature, you need to create view in your linked database first.

Let’s say you have 2 dbs; dbA and dbB.
You can create view across dbs, for example you can do this:
select * from dbB.tableX; // viewname: v_something
inside dbA.Then, in phpmaker, you’ll have v_something within [Tables], not [Linked Tables].
Then, you can add “Custom Fields” into v_something.Be aware that If you need to add/update into v_something you have to write the complete dbName.tableName within UpdateTable object,
$this->UpdateTable = “dbB.tableX”;

Here is a thought.Custom Template is client-side script.
It works like this:

  • php-output set to hidden.
  • re-draw page using JsRender using hidden elements from the hidden php-output.

Meaning: php-output element does actually exist in the page, hidden. The problem is: Phpmaker/JsRender has no syntax to draw so you can’t write codes against addopt.Possible workaround:
You can use jQuery to .clone() the hidden addopt or draw your own element then set,
$(‘yourElement’).click(function(){
// click the hidden addopt using .click()
});
Basically when you click it clicks the hidden .Check:

  • php-output .
  • modal container.

If they both exist then the above workaround should work.

Thanks for the advice guysI’m gonna try something. Gonna open the project file source code and copy and past the code for my view with custom fields lol. Should work once I do it correctly lol@sagnandar. I understand exactly what you mean :slight_smile: I’ll check it out.

gigakun wrote:

I’m gonna try something. Gonna open the project file source code and copy
and past the code for my view with custom fields lol. Should work once I do
it correctly lol

Hi gigakun, did that work out? Having the same question here (so how to copy views).Thanks, Peter

  1. If it is a database view, you can change the SQL to add a custom field, there is no need to use Custom Field to a database view.
  2. There is no “copy view” feature in PHPMaker, it is recommended that you copy the SQL and create a new view in your database.