|
From: Raymond I. <xw...@ya...> - 2003-06-25 00:05:09
|
Hi,
The Template object is basically a DynLayer with an
html template as it's content. Fields are basically
placeholders and/or containers. Only one DynLayer can
be added to a field at any one time.
The TemplateManager (TM) allows you to replace a
field's object or content at any time:
example:
var tp = new Template('Some text {@field1}')
tp.addChild(new DynLayer('Here'),'field1');
//..... display tp .....
//.... some code here ....
// to replace the DynLayer in field1
// with a new DynLayer to this
tp.addChild(new DynLayer('Hello World'),'field1');
tp.generate(); // recreate and display template;
I understand what your trying to do. This is what I
would recommend:
1) Inside your template add sufficient fields for the
estimated objects.
Or
2) Use the above example or something like this:
tp.setField('field1','{@field1}{@field2}{@field3}');
This should dynamically add field2 and field3
Or
3) Wait for the new addField() and cloneField()
functions. I'll be adding a cloneField() and a
addField() function that should help to extend
functionality of the TM.
example:
// adds field2 tp the template
tp.addField('field2','field1','text/html content');
// where field1 is the adjacent field for field2.
// if no adjacent field specified then field2
// will be added to bottom of template
// clone field1 to create field2 and field3, etc
tp.cloneField('field1','field2','field3',...'fieldN');
Note: cloneField() will only clone the field and it's
text/html content. It will not clone the DynLayer
So Daniel, in your case you could use cloneField in
this way:
tp.cloneField('field1', 'field1.1','field1.2');
tp.addChild(new DynLayer(),'field1.1');
tp.addChild(new DynLayer(),'field1.2');
// and to add more fields you could
tp.addField('field3','field1');
tp.addChild(new DynLayer(),'field3');
Is that flexible enough?
Hope this helps and I hope many more users will start
liking the TM :)
Hint: I've completed 14 HC so far. See an example
here:
http://www24.brinkster.com/dyntools/next/examples/dynapi.gui.htmllistbox.html
--
Raymond Irving
--- Dev <de...@ti...> wrote:
> Hi Raymond, and the rest of you all.
>
> What i was trying to explain (althought very fuzzy)
> was that it would be great to be able to add more
> than one layer to one field.
>
> Example:
>
> 1. I create a template with 2 fields, call them
> field1 and field2
> 2. I add one dynlayer, lyr1 to field1
> 3. I add another dynlayer, lyr2 to field2
>
> When i come this far, there is not mutch i can do
> with the templates, as i first understood the
> fields, was that it was like placeholders or
> containers. However at this point i am stuck (in my
> point of view) if that is i dont replace the
> template and add more parts, or replace the
> containers with ie: lyr3.
>
> For what i develop for work and myself, i often dont
> know what can and will happen to the page and for
> this i am feeling a bit stuck. What i seek is a way
> to be able to add lyr3 and lyr4 to field1, and lyr5
> to field2.
>
> Maybee this is already solved :) But outside my mind
> or my lack of intelligence :) But is there anyway
> for me to accomplish to add more than one part to
> one field?
>
> Maybee something like this:
> tp.addChild(new DynLayer(null,0,0,200,20),'field1');
> tp.addChild(new
> DynLayer(null,0,0,200,20),'field1(1)');
> tp.addChild(new
> DynLayer(null,0,0,200,20),'field1(2)');
> field1 should then be default and you should not be
> forced to use the field1(0) just if you want to add
> more than one layer to field1 you should.
>
> Do you get my thoughts? :)
> This is in no way intended to sound critic, it's
> just what i feel was missing, for a fully flexible
> template manager.
>
> Best regards
> Daniel Tiru
>
>
> >
> > Sorry Daniel, I don't think I understand the
> question.
> > Could you please give examples and a little more
> > explanation?
> >
> > --
> > Raymond Irving
> >
> > --- Dev <de...@ti...> wrote:
> > > Hi!
> > >
> > > I was wondering if there is any way to add more
> than
> > > one part to a field? Or atleast get the same
> result
> > > as adding 2 parts to the same field. Now the
> part
> > > will be overwritten.
> > >
> > > Regards
> > > Daniel
> > >
> > >
> > >
> >
>
-------------------------------------------------------
> > > This SF.Net email is sponsored by: INetU
> > > Attention Web Developers & Consultants: Become
> An
> > > INetU Hosting Partner.
> > > Refer Dedicated Servers. We Manage Them. You Get
> 10%
> > > Monthly Commission!
> > > INetU Dedicated Managed Hosting
> > > http://www.inetu.net/partner/index.php
> > > _______________________________________________
> > > Dynapi-Help mailing list
> > > Dyn...@li...
> > >
> >
>
https://lists.sourceforge.net/lists/listinfo/dynapi-help
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> >
> >
> >
>
-------------------------------------------------------
> > This SF.Net email is sponsored by: INetU
> > Attention Web Developers & Consultants: Become An
> INetU Hosting Partner.
> > Refer Dedicated Servers. We Manage Them. You Get
> 10% Monthly Commission!
> > INetU Dedicated Managed Hosting
> http://www.inetu.net/partner/index.php
> > _______________________________________________
> > Dynapi-Dev mailing list
> > Dyn...@li...
> >
>
http://www.mail-archive.com/dyn...@li.../
>
>
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
|