On Tue, Sep 27, 2016 at 11:48 PM, Tarekskayv <beguin.y...@gmail.com> wrote:

> Hello all,
>
> I just started with xwiki and i've some trouble to access to object from
> another page.
> I don't know if what i'm doing is the best way to do it or not.
>
> First i'll explain what i would like to do, and after explain which way
> i've
> choose to do it.
>
> So, i would like to create a "reference" page.
> I mean in this page create a table with all the datas i need for ex :
>
> *PAGE CONFIG :*
>
> |IP|HOSTNAME|ROLE
> 192.168.0.1|ROUTER|WAN
> 192.168.0.2|FIREWALL|FIREWALL
> 192.168.0.3|SERVER1|AD/DC
> 192.168.0.4|SERVER2|DNS1
> 192.168.0.5|SERVER3|DNS2
> ....
>
> Then i create differents FAQ pages where i would like to insert info as
> "connect on DNS1 (ip : 192.168.0.4)"....
>
> But if one day, the ip adress or hostname change (for some reason..) i just
> have to change the data in the page CONFIG and automatically will be
> changed
> on all other pages. Like that no need to edit all pages ...
>
>
>
>
> So, what i've done...
> Probably not the best way to do it.
>
> I've create a page with class and object + template.
> It create for each server a new page with all info i need.
> so i've for example :
>
> *PAGE IP : *
> IP : 192.168.0.1
> HOSTNAME : ROUTER
> ROLE : WAN
>
> *PAGE FIREWALL : *
> IP : 192.168.0.2
> HOSTNAME : FIREWALL
> ROLE : FIREWALL
>
> ... for all other page
>
>
> Now, what i'm looking for is on an other page :
>
> *PAGE FAQ 1 *
>
> access to the object of the page FIREWALL and display the content of the
> object.
>
> I can display the object of the own page but not from another page.
>
>
> Could you help me in this task plz
>
>
> my code : i don't know how refer the object of the specific page
>
>

> #set($object = $doc.getObject('test.XWikiTestClass'))
>

$doc is the current document ("PAGE FAQ 1" in your case) and not "FIREWALL"
and so getObject won't find the object you're looking for. You need to
retrieve the document that has the object. See
http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HAccessobjectsfromanypageandloopoverallobjectsofsameClass
.

Hope this helps,
Marius


> $object.display('IP', 'view')
> $object.display('HOSTNAME', 'view')
> $object.display('ROLE', 'view')
>
>
> Regards
>
>
>
>
>
>
>
>
>
> --
> View this message in context: http://xwiki.475771.n2.nabble.
> com/Access-object-from-other-page-tp7601415.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to