0

Include many times the same page

asked 2006-02-16 09:12:46 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579322

By: matteo_barbieri

Hi,
don't know if it's already possible to do something like this...
I have a page where I include two times another page (with its page id).
But if I try to access one of the two included pages I don't know how to call it, because I have 2 pages with the same id.

I wonder if exists something like
<include src='/mypage.zul' pageid='first' /> <include src='/mypage.zul' pageid='second' />

Then I can access the 2 pages with:
Path.getComponent('//first/asdf/');
Path.getComponent('//second/asdf/');

Maybe a feature request?

Thanx

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2006-02-16 09:36:37 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579333

By: tomyeh

You could access them. But, as we discussed in another thread, components are created by include in the rendering phase. In other words, they are accessible by the includer only after the whole is rendered and sent back to browser. It implies that you could access them only in event listeners, not in the script of the includer.

Of course, the page being included is like any other ZUML page. You could do whatever you want.

We plan to solve this with the macro mechanism. Kill two birds in one stone.
Take a look at the comment in Request 1428252

https://sourceforge.net/tracker/?func=detail&atid=785194&aid=1428252&group_id=15
2762

link publish delete flag offensive edit

answered 2006-02-16 09:49:30 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579341

By: matteo_barbieri

In fact I want to access them in event listeners.
But how can I select one of the two pages if they have the same id?
I included 2 times but I use them in 2 different ways.
On the logs I have also a warning that tells me that there are 2 pages with the same id.

link publish delete flag offensive edit

answered 2006-02-16 10:09:18 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579362

By: tomyeh

To include the same page twice, you cannot assign page ID to it (so ZK will generate one for you). Then, the question is how to access the component inside the included page without knowing its ID?

One of solutions is to use inter-page communication to exchange data (see also User Guide). The attributes of Desktop is good place.

For example, the includer could set an attribute to prepare the included page to register.

desktop.setAttribute("included", new LinkedList());

Then, the included page could do

((Collection)desktop.getAttribute("included")).add(page);

If you want to use Path, you could add page.getId().

Hope this solves your requirement.

link publish delete flag offensive edit

answered 2006-02-16 10:13:05 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579370

By: tomyeh

After second though, there is another alternative similar to what you suggested:
pass page ID to the included page.

<include src="/mypage.zul?pageid=first"/>

Then, in the included page, you do

<?page id="${param.pageId}"...

This looks much better :)

link publish delete flag offensive edit

answered 2006-02-16 10:21:54 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579376

By: matteo_barbieri

Sure, much better! :)
Thank you again.


link publish delete flag offensive edit

answered 2006-02-16 10:33:52 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579394

By: tomyeh

Oops, the id attribute of the page doesn't support EL. I'll fix this.

link publish delete flag offensive edit

answered 2006-02-16 10:39:18 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3579402

By: matteo_barbieri

I just notice this.
You anticipate me :)

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2006-02-16 09:12:46 +0800

Seen: 679 times

Last updated: Feb 16 '06

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More