Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Using Master Template without template for each form.


This question is answered.


Permlink Replies: 6 - Last Post: Jan 23, 2017 2:18 PM Last Post By: Andy Butler
Andy Butler

Posts: 4
Registered: 12/29/06
Using Master Template without template for each form.  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 22, 2017 10:02 AM
I now have my application up and running.
(thankyou Intraweb XIV + XE4, a breeze compared to PHP)

The layout of the components on the form looks ok.

What I'd like to do now is add an HTML header and footer.

I'd assumed I could do that by adding a master template to the ServerController.

Problem I have is that I can only get the Master Template to render if I add a template to the form.

So, am I missing a simple setting, or is it simply that what I'd like to do won't happen?
Is it the case that the $Body tag needs a template, and Intraweb won't simply drop the form
in there?

Is there a way to avoid specifying position/appearance for every single visual control in the app via
a page template and still add an html header?

Guest
Re: Using Master Template without template for each form.
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 22, 2017 3:55 PM   in response to: Andy Butler in response to: Andy Butler
Andy Butler wrote:
I now have my application up and running.
(thankyou Intraweb XIV + XE4, a breeze compared to PHP)

The layout of the components on the form looks ok.

What I'd like to do now is add an HTML header and footer.

I'd assumed I could do that by adding a master template to the ServerController.

You are sure. You can also add a mastertemplate to each form. It has a property todo. Better the first option depending on case.

Problem I have is that I can only get the Master Template to render if I add a template to the form.
Yes, It´s how IW works. I also had this doubt but with the help of Dan Barclay, I see that IW needs it.

Is it the case that the $Body tag needs a template, and Intraweb won't simply drop the form
in there?
If you don´t have a template to your form, the master template will not load.

Is there a way to avoid specifying position/appearance for every single visual control in the app via
a page template and still add an html header?
This will depends of your iw control settings to render the control.
You can play with settings of IW control as StyleRenderOptions and Css. You can create your css style as well to apply to the control, as well
Andy Butler

Posts: 4
Registered: 12/29/06
Re: Using Master Template without template for each form.  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 23, 2017 9:00 AM   in response to: Guest in response to: Guest
thanks Luis, much appreciated

If you don´t have a template to your form, the master template will not load.

OK, good to have that confirmed.

I'm used to php, where I would use header and footer html as includes
Don't see why similar wouldn't work with intraweb, for instance header ends with <table style="position: relative;">><tr><td>,
after which the regular non-template is regurgitated,
then footer has </table> at the start (just as an example, but I think that would work to center the Form).

...but as it doesn't work that way :-(

Is there a way to avoid specifying position/appearance for every single visual control in the app via
a page template and still add an html header?
This will depends of your iw control settings to render the control.
You can play with settings of IW control as StyleRenderOptions and Css. You can create your css style as well to apply to the control, as well

Could you explain? I tried messing with StyleRenderOptions and determined that I want them all "true", as I want to keep
all the formatting I did on the Form Designer.

I've set out the controls on the Form Designer, and that in itself is rendering perfectly well, just want to put what amounts to eye
candy around the Form.

Is there a way I can just inject some HTML into the render of the form?
Guest
Re: Using Master Template without template for each form.
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 23, 2017 9:51 AM   in response to: Andy Butler in response to: Andy Butler
I'm used to php, where I would use header and footer html as includes
Don't see why similar wouldn't work with intraweb, for instance header ends with <table style="position: relative;">><tr><td>,
after which the regular non-template is regurgitated,
then footer has </table> at the start (just as an example, but I think that would work to center the Form).
After some time, I see that using IWForm inhertitance, you can do it.
Create a iw base form with a template containg the header/footer common to all forms and create the forms inherited from it.

Could you explain? I tried messing with StyleRenderOptions and determined that I want them all "true", as I want to keep
all the formatting I did on the Form Designer.

I've set out the controls on the Form Designer, and that in itself is rendering perfectly well, just want to put what amounts to eye
candy around the Form.
Is there a way I can just inject some HTML into the render of the form?

You can use rawtext for sample:

TIWLable.caption:='<li id="menu_agenda"><a data-toggle="dropdown" class="dropdown-toggle" href="#" aria-expanded="false">Agenda&nbsp<i class="ace-icon fa fa-angle-down bigger-110"></i></a>';
and set RawText to true.


Or use templates, in this case the control position will be located where you put in the template.

<httml>
<body>
{%IWBUTTON%}
</body>
</httml>


And you can add a style to IWBUTTON, creating it and set your class in CSS property.
You can add style directly to form, but I prefer create a separate file and add it into html or in the stylesheet property of the form.
You can add the stylesheet ref also into HTMLHeaders of servercontroller:
There are others events where you can add file styles as well.
For sample, In formcreate:
   ContentFiles.Add('https://url of style.css');


Edited by: Luiz Oliveira on Jan 23, 2017 9:51 AM
Eitan Arbel

Posts: 508
Registered: 2/24/13
Re: Using Master Template without template for each form.
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 23, 2017 10:40 AM   in response to: Andy Butler in response to: Andy Butler
Is there a way to avoid specifying position/appearance for every single visual control in the app via
a page template and still add an html header?

for that i would use a IWRegion, instead of setting every control you have on the form.

so instead of :
<html>
<body>
{%IWBUTTON1%}
{%IWEDIT1%}
{%IWEDIT2%}
{%IWGRID1%}
{%IWCHECKOBOX1%}
.
.
.
</body>
</html>


i would put them all inside a IWRegion, and then just set the IWRegion in the template :
<html>
<body>
{%IWREGION1%}
</body>
</html>

Guest
Re: Using Master Template without template for each form.
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 23, 2017 11:34 AM   in response to: Eitan Arbel in response to: Eitan Arbel
Eitan Arbel wrote:
Is there a way to avoid specifying position/appearance for every single visual control in the app via
a page template and still add an html header?

for that i would use a IWRegion, instead of setting every control you have on the form.

so instead of :
<html>
<body>
{%IWBUTTON1%}
{%IWEDIT1%}
{%IWEDIT2%}
{%IWGRID1%}
{%IWCHECKOBOX1%}
.
.
.
</body>
</html>


i would put them all inside a IWRegion, and then just set the IWRegion in the template :
<html>
<body>
{%IWREGION1%}
</body>
</html>


I agree, you can do it This works as well.
Andy Butler

Posts: 4
Registered: 12/29/06
Re: Using Master Template without template for each form.  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 23, 2017 2:00 PM   in response to: Guest in response to: Guest
i would put them all inside a IWRegion, and then just set the IWRegion in the template :
<html>
<body>
{%IWREGION1%}
</body>
</html>

Excellent!
Thank you Luiz and Eitan.

Edited by: Andy Butler on Jan 23, 2017 2:01 PM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02