You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alin Simionoiu <al...@zivva.com> on 2006/02/01 02:18:40 UTC

Page structure best practices

Hi folks,

I'm trying to build a small website that will exercise some business  
logic. I looked around for some framework that will help me build the  
pages fast.
I choose Tapestry mainly because I can use the existing HTML pages as  
templates, really cool thing.

The first thing that I did was buying "Enjoy Web Development with  
Tapestry" read the thing and start cranking the code.
After two days of cranking I end up having the first problem,  
although I will have to say is more like a "what's the best practices  
for this".

My pages will have a header, a left side navigation panel and the  
main page. The left navigation panel controls what page i'm  
displaying, I say standard stuff.
My question is: how to I build the page Tapestry way?. I try at first  
to use frames. The navigation panel has a logout link and boom first  
problem. When I click on Logout I could not figure out how to go to  
main page and not just refresh the frame. Seems that only the left  
frame is loaded with the main page.
Checking the mailing list archive I read that people are recommending  
to move away from frames. Ok let's move away from frames. And do what?
I was thinking about some sort of include, I will put the left panel  
in a separate template and include it on all the other templates that  
needs it (like php smarty include). Again check the mailing list, and  
nope there's no include. There's RenderBlock but  I'm not sure it is  
what i need and really don't want to repeat the same html block in  
all the pages, yak

How do people solve this kind of problem?. what's the recommended  
way?. It seems to me that I would need to put the navigation panel in  
a component. Is this the right way, component?.
Do I inject the panel html page into the main page using Block/ 
RenderBlock?



Cheers,
Alin


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Page structure best practices

Posted by Robert Zeigler <ro...@scazdl.org>.
People usually solve this by creating a "Border" component.
Search searching the mailing list for the Border component. :)
Incidentally, "including" something is normally done by making a 
component in tapestry. :)

Robert

Alin Simionoiu wrote:

> Hi folks,
>
> I'm trying to build a small website that will exercise some business  
> logic. I looked around for some framework that will help me build the  
> pages fast.
> I choose Tapestry mainly because I can use the existing HTML pages as  
> templates, really cool thing.
>
> The first thing that I did was buying "Enjoy Web Development with  
> Tapestry" read the thing and start cranking the code.
> After two days of cranking I end up having the first problem,  
> although I will have to say is more like a "what's the best practices  
> for this".
>
> My pages will have a header, a left side navigation panel and the  
> main page. The left navigation panel controls what page i'm  
> displaying, I say standard stuff.
> My question is: how to I build the page Tapestry way?. I try at first  
> to use frames. The navigation panel has a logout link and boom first  
> problem. When I click on Logout I could not figure out how to go to  
> main page and not just refresh the frame. Seems that only the left  
> frame is loaded with the main page.
> Checking the mailing list archive I read that people are recommending  
> to move away from frames. Ok let's move away from frames. And do what?
> I was thinking about some sort of include, I will put the left panel  
> in a separate template and include it on all the other templates that  
> needs it (like php smarty include). Again check the mailing list, and  
> nope there's no include. There's RenderBlock but  I'm not sure it is  
> what i need and really don't want to repeat the same html block in  
> all the pages, yak
>
> How do people solve this kind of problem?. what's the recommended  
> way?. It seems to me that I would need to put the navigation panel in  
> a component. Is this the right way, component?.
> Do I inject the panel html page into the main page using Block/ 
> RenderBlock?
>
>
>
> Cheers,
> Alin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Page structure best practices

Posted by Martin Strand <ma...@entcap.se>.
I assume you've started creating your own components?
If so, you can just create a "Border" component with a template like this:

[Border.html]

<html>
<body>
   <ul>
     <li>Menu item</li>
     <li>Menu item</li>
     <li>Menu item</li>
   </ul>
   <div jwcid="@RenderBody">
     Page content will be inserted here
   </div>
</body>
</html>


and then use that Border component in all your pages like this:

[Page.html]

<html jwcid="@Border">
   <p>This will be inserted in the middle of your Border template, by that  
RenderBody component.</p>
</html>


It's not quite the same as an include but it does the same job.

I think Kent mentioned this in his book.

--Martin

On Wed, 01 Feb 2006 02:18:40 +0100, Alin Simionoiu <al...@zivva.com> wrote:

> Hi folks,
>
> I'm trying to build a small website that will exercise some business  
> logic. I looked around for some framework that will help me build the  
> pages fast.
> I choose Tapestry mainly because I can use the existing HTML pages as  
> templates, really cool thing.
>
> The first thing that I did was buying "Enjoy Web Development with  
> Tapestry" read the thing and start cranking the code.
> After two days of cranking I end up having the first problem, although I  
> will have to say is more like a "what's the best practices for this".
>
> My pages will have a header, a left side navigation panel and the main  
> page. The left navigation panel controls what page i'm displaying, I say  
> standard stuff.
> My question is: how to I build the page Tapestry way?. I try at first to  
> use frames. The navigation panel has a logout link and boom first  
> problem. When I click on Logout I could not figure out how to go to main  
> page and not just refresh the frame. Seems that only the left frame is  
> loaded with the main page.
> Checking the mailing list archive I read that people are recommending to  
> move away from frames. Ok let's move away from frames. And do what?
> I was thinking about some sort of include, I will put the left panel in  
> a separate template and include it on all the other templates that needs  
> it (like php smarty include). Again check the mailing list, and nope  
> there's no include. There's RenderBlock but  I'm not sure it is what i  
> need and really don't want to repeat the same html block in all the  
> pages, yak
>
> How do people solve this kind of problem?. what's the recommended way?.  
> It seems to me that I would need to put the navigation panel in a  
> component. Is this the right way, component?.
> Do I inject the panel html page into the main page using Block/ 
> RenderBlock?
>
>
>
> Cheers,
> Alin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Page structure best practices

Posted by Alin Simionoiu <al...@zivva.com>.
Thank you for the quick response Chris (and Robert for another reply  
to my email), I'll check the Border component stuff.
Really appreciate the code offer but let's see if I can figure it out  
myself, if not I may impose again.

Alin


On Jan 31, 2006, at 8:27 PM, Chris Chiappone wrote:

> Yeah I would definatly go away from using frames these days.  The page
> you describe is basically what I use for my applications.  It consists
> of a Border component that has a header footer and then place holders
> for components such as a left nav bar or left login area depending on
> the sessions state.  In the border you would also have a section with
> a @RenderBody that contains your "Pages".  If you need more detail I
> can send some code.
>
> ~chris
>
> On 1/31/06, Alin Simionoiu <al...@zivva.com> wrote:
>> Hi folks,
>>
>> I'm trying to build a small website that will exercise some business
>> logic. I looked around for some framework that will help me build the
>> pages fast.
>> I choose Tapestry mainly because I can use the existing HTML pages as
>> templates, really cool thing.
>>
>> The first thing that I did was buying "Enjoy Web Development with
>> Tapestry" read the thing and start cranking the code.
>> After two days of cranking I end up having the first problem,
>> although I will have to say is more like a "what's the best practices
>> for this".
>>
>> My pages will have a header, a left side navigation panel and the
>> main page. The left navigation panel controls what page i'm
>> displaying, I say standard stuff.
>> My question is: how to I build the page Tapestry way?. I try at first
>> to use frames. The navigation panel has a logout link and boom first
>> problem. When I click on Logout I could not figure out how to go to
>> main page and not just refresh the frame. Seems that only the left
>> frame is loaded with the main page.
>> Checking the mailing list archive I read that people are recommending
>> to move away from frames. Ok let's move away from frames. And do  
>> what?
>> I was thinking about some sort of include, I will put the left panel
>> in a separate template and include it on all the other templates that
>> needs it (like php smarty include). Again check the mailing list, and
>> nope there's no include. There's RenderBlock but  I'm not sure it is
>> what i need and really don't want to repeat the same html block in
>> all the pages, yak
>>
>> How do people solve this kind of problem?. what's the recommended
>> way?. It seems to me that I would need to put the navigation panel in
>> a component. Is this the right way, component?.
>> Do I inject the panel html page into the main page using Block/
>> RenderBlock?
>>
>>
>>
>> Cheers,
>> Alin
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user- 
>> help@jakarta.apache.org
>>
>>
>
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>

Alin Simionoiu
alin.simionoiu@zivva.com




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Page structure best practices

Posted by Chris Chiappone <ch...@gmail.com>.
Yeah I would definatly go away from using frames these days.  The page
you describe is basically what I use for my applications.  It consists
of a Border component that has a header footer and then place holders
for components such as a left nav bar or left login area depending on
the sessions state.  In the border you would also have a section with
a @RenderBody that contains your "Pages".  If you need more detail I
can send some code.

~chris

On 1/31/06, Alin Simionoiu <al...@zivva.com> wrote:
> Hi folks,
>
> I'm trying to build a small website that will exercise some business
> logic. I looked around for some framework that will help me build the
> pages fast.
> I choose Tapestry mainly because I can use the existing HTML pages as
> templates, really cool thing.
>
> The first thing that I did was buying "Enjoy Web Development with
> Tapestry" read the thing and start cranking the code.
> After two days of cranking I end up having the first problem,
> although I will have to say is more like a "what's the best practices
> for this".
>
> My pages will have a header, a left side navigation panel and the
> main page. The left navigation panel controls what page i'm
> displaying, I say standard stuff.
> My question is: how to I build the page Tapestry way?. I try at first
> to use frames. The navigation panel has a logout link and boom first
> problem. When I click on Logout I could not figure out how to go to
> main page and not just refresh the frame. Seems that only the left
> frame is loaded with the main page.
> Checking the mailing list archive I read that people are recommending
> to move away from frames. Ok let's move away from frames. And do what?
> I was thinking about some sort of include, I will put the left panel
> in a separate template and include it on all the other templates that
> needs it (like php smarty include). Again check the mailing list, and
> nope there's no include. There's RenderBlock but  I'm not sure it is
> what i need and really don't want to repeat the same html block in
> all the pages, yak
>
> How do people solve this kind of problem?. what's the recommended
> way?. It seems to me that I would need to put the navigation panel in
> a component. Is this the right way, component?.
> Do I inject the panel html page into the main page using Block/
> RenderBlock?
>
>
>
> Cheers,
> Alin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
~chris

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Page structure best practices

Posted by Steve Shucker <ss...@vmsinfo.com>.
I know a lot of people here hate frames, but sometimes they're useful so
I'll give you another option.

I'll sometimes create a Submit component with style="display:none;" so the
user can't see it.  Then you can use javascript to get a handle to the
button and call it's click() function.  I've got a webapp with the
navigation in an iframe.  When a user does something that requires changes
in the navigation, I make a javascript call to postback from there.

Alternatively, here's some javascript I have lying around to force a page to
the top window:

function CheckNesting() {
	var prevParent = window
	var parentWin = parent
	while (parentWin != null && parentWin != prevParent) {
		// use host for comparison because homepage is accessible
from multiple hrefs
		if (parentWin.location.host == window.location.host) {
			parentWin.location.href = window.location.href //
refresh parent
			return
		}
		prevParent = parentWin
		parentWin = parentWin.parent
	}
}

It'll still let your page be nested in some other site's frames, but not in
any frames on your own site (remove location.host comparison to change this
behavior).

-Steve

-----Original Message-----
From: Alin Simionoiu [mailto:alin@zivva.com] 
Sent: Tuesday, January 31, 2006 6:19 PM
To: Tapestry users
Subject: Page structure best practices

Hi folks,

I'm trying to build a small website that will exercise some business  
logic. I looked around for some framework that will help me build the  
pages fast.
I choose Tapestry mainly because I can use the existing HTML pages as  
templates, really cool thing.

The first thing that I did was buying "Enjoy Web Development with  
Tapestry" read the thing and start cranking the code.
After two days of cranking I end up having the first problem,  
although I will have to say is more like a "what's the best practices  
for this".

My pages will have a header, a left side navigation panel and the  
main page. The left navigation panel controls what page i'm  
displaying, I say standard stuff.
My question is: how to I build the page Tapestry way?. I try at first  
to use frames. The navigation panel has a logout link and boom first  
problem. When I click on Logout I could not figure out how to go to  
main page and not just refresh the frame. Seems that only the left  
frame is loaded with the main page.
Checking the mailing list archive I read that people are recommending  
to move away from frames. Ok let's move away from frames. And do what?
I was thinking about some sort of include, I will put the left panel  
in a separate template and include it on all the other templates that  
needs it (like php smarty include). Again check the mailing list, and  
nope there's no include. There's RenderBlock but  I'm not sure it is  
what i need and really don't want to repeat the same html block in  
all the pages, yak

How do people solve this kind of problem?. what's the recommended  
way?. It seems to me that I would need to put the navigation panel in  
a component. Is this the right way, component?.
Do I inject the panel html page into the main page using Block/ 
RenderBlock?



Cheers,
Alin


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org