Hello Tiago,

Thanks for your reply.

I should have said it's a Global Constant, rather then variable. It meant to
be a fixed value.

Got it worked out in the end, as per your suggestion
#set($document = $xwiki.getDocument("Space.DocName"))
#set($object = $document.getObject("Classname"))
#set($var = $doc.get("propertyName"))

then split the string into array.
$var.split(",")

Thanks again.
Art



Tiago Rinck Caveden wrote:
> 
> Hello!
> 
> On Tue, Sep 2, 2008 at 5:12 PM, Art Yeung <[EMAIL PROTECTED]>
> wrote:
> 
>>
>> Managed to create the class and add the property, myvar. However, how can
>> I
>> set the default value?
> 
> 
> Well, as it's "global", I don't understand what you mean by default
> value...
> The value that you set by last will be the value to be used.
> 
> You may use the Object editor (when you hover "Edit", there are many
> editors, "Object" is one) to add objects onto a page and set their
> property
> values.
> 
> 
>> Also, how can I reference the myvar my other page after adding the object
>> into the page?
> 
> 
> You don't need to add the object to every page that will use it, only to
> the
> page that will "contain it", otherwise it's not global. All you need is to
> reference it, and to do it there are API methods that can help.
> To display the value, for example, I believe you may do the following:
> 
> #set($document = $xwiki.getDocument("Space.DocName"))
> #set($object = $document.getObject("Classname"))
> $document.display("propertyName", $object, $xwiki)
> 
> I haven't tested that, I'm not sure it will work. By the way, I'm a newbie
> too, so there maybe there are easier ways of doing global variables, but I
> don't know.
> 
> 
>> If I change this default value, am I right of thinking all the references
>> in
>> all pages will change? Its not like pages have an instance of the class
>> so
>> they are different copies.
> 
> 
> If you change the property - don't forget to save the document if you're
> editing by script, $document.save() - every other page that uses the same
> property of the same object of the same page will be affected. So, it is a
> reference, not a copy.
> I don't know how XWiki would handle concurrent edition...
> 
> Regards,
> -- 
> Tiago Rinck Caveden
> http://caveden.multiply.com
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Global-Variable--tp789520p835976.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to