ahh nice one, eddy; something new to mention when i talk again about
rife on the 17th at the oracle city office :)

cheers,
emmanuel

On 3/6/06, Eddy Young <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I recently started experimenting with using embedded elements to create
> components. Today, after just 5 minutes messing about, I produced my
> first component, a simple label.
>
> Here is how I did it.
>
> In sites/main.xml:
>
>      <subsite id="Components">
>          <element id="Label" implementation="web.components.Label">
>          </element>
>      </subsite>
>
> In templates/test.html:
>
>      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>         "http://www.w3.org/TR/html4/loose.dtd";>
>      <html>
>          <head>
>              <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8">
>              <title>View profile</title>
>        </head>
>        <body>
>        <!--V 'content' /-->
>        <!--BV 'content'-->
>        <p>This is your profile.</p>
>        <p>Username: <!--V 'ELEMENT:^Components.Label'-->
>                      id = username
>                      value = uname
>                     <!--/V-->
>        <!--/BV-->
>        </body>
>      </html>
>
>
> In web.components.Label:
>
>      /*
>       * Label.java
>       *
>       * $Id$
>       */
>
>      package web.components;
>
>      import com.uwyn.rife.engine.Element;
>      import java.util.Properties;
>
>      /**
>       *
>       * @author Eddy.Young
>       * @version $Revision$
>       */
>      public class Label extends Element {
>          private String id;
>          private String value;
>
>          public void processElement() {
>              Properties properties = getEmbedProperties();
>              id = properties.getProperty("id");
>              value = properties.getProperty("value");
>              print("<label id=" + id + ">" + getInput(value) + "</label>");
>          }
>      }
>
> The interesting thing here is that the ELEMENT:<name> tag can embed more
> than one value. This can be used to specify parameters. For example, for
> a "list" component, the parameter could be the name of a bean that
> contains the entries. Another parameter could be the name of a template.
>
> The possibilities are virtually limitless. It would be great if those
> who have used embedded elements to create components could share their
> experience here.
>
> --
> http://coding.mu
> http://priscimon.com/blog
> _______________________________________________
> Rife-users mailing list
> Rife-users@uwyn.com
> http://lists.uwyn.com/mailman/listinfo/rife-users
>


--
Mohandas Gandhi - "You must be the change you wish to see in the world."
_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to