Thanks a lot Geert,

processTemplate() did it all right !

Best regards

Laki


Geert Bevin wrote:
Hi Laki,

your problem lies in the fact that as soon as you set one template as the content of the value of another template, it is evaluated and turned into a string. So when you generate the form against the template, it has no effect at all for the final output since the string representation has already been filled into your skeleton.

So what you would have to do is do this instruction after building the form:
main.setValue("page_content", template);

Also, if you want to have the same effect as print(template) without actually outputting content (ie. have all the web-engine value names being replaced and such, you'll have to make a call to processTemplate(template) before first.

Hope that helps,

Geert

On 19 May 2006, at 15:34, Laki roganovic wrote:

Hello,

I would like to have a page skeleton (with left-side menu and banner) which will be used by all my pages. So i made a template like this :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd";>

<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">

<head>
<title><!--V 'page_title'/--></title>
<link rel="stylesheet" type="text/css"
href="/css/test.css" />
</head>

<body>

<table>
<tr>
<td width="15%"><!-- V 'left_nav'-->left_nav<!--/V--></td>
<td width="85%"><!-- V 'page_content'-->content<!--/V--></td>
</tr>
</table>

</body>

</html>

The problem is when i have a form included in 'page_content':
I created a template (inscription_vip.html) which has a form. This form works perfectly when alone, but messes up (input fields are not visible...) when i call it from within main_frame.html.
Here is how i mix them in my implementation :

public void processElement() {
Template main = getHtmlTemplate("lc.layouts.main_frame");
Template left = getHtmlTemplate("lc.layouts.left_menu");
Template template = getHtmlTemplate("lc.inscription_vip");
main.setValue("left_nav", left);
main.setValue("page_content", template);
main.setValue("page_title", "Inscription");

ResourceBundle bundle = Localization.getResourceBundle("text", "fr");
main.addResourceBundle(bundle);
template.addResourceBundle(bundle);
VIP vip = (VIP) getNamedSubmissionBean("vip_data", "vip");
if (vip != null) {
Validated v = (Validated) vip;
if (!v.validate()) {
logger.debug("not validated");
generateForm(template, vip);

} else {
logger.debug("validated");
exit("InscriptionVIPOk");
}
v.resetValidation();
}
main.setValue("page_content", template);

print(main);
}


Thanks for your help


Laki
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users


--
Geert Bevin
Uwyn bvba "Use what you need"
http://www.uwyn.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to