[NEWBIES] How to set up a multi-page website

View: New views
10 Messages — Rating Filter:   Alert me  

[NEWBIES] How to set up a multi-page website

by David Zmick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So, I have a website, and I would like it to have multiple pages, eg. an about page, a members page, etc.  I think you know what I mean.  I have currently accomplished this by creating a variable in my session class called content and the root component renders different content depending on what the content variable stores.
This approach appears to have these advantages:
  • I can have a header and footer that remains constant no matter what page the user is on
  • It is very simple
  • not much else
I do not entirely understand the idea of a root task but I have a feeling that that is the way I should go about completing this.
What is the "proper" way to accomplish my goal, preferably, I would like to be able to do the same things I can now, but do it "correctly" :)

--
David Zmick
/dz0004455\
http://dz0004455.googlepages.com
http://dz0004455.blogspot.com

_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: [NEWBIES] How to set up a multi-page website

by Roger Ostrander :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

  The way I've approached this is similar to your idea:  There's a
"menu component" whose job it is to render the header, the footer,
itself, and then whatever the active component is.  I tend to store
the active component in the menu component itself, but that has the
problem that, unless you pass the menu component around, it's the only
thing that can transition between pages (this hasn't been a problem
for me).

  Tasks fill a different niche altogether.  They're used when you want
a sequential list of things to happen.  So say before people see the
menu component at all, they need to log in.  Your task would look
something like:

do
    [self session loggedIn ] whileFalse: [ self call: self loginComponent ].
    self call: self menuComponent.

  Hope this helps!

On Fri, Apr 25, 2008 at 4:45 PM, David Zmick <dz0004455@...> wrote:

> So, I have a website, and I would like it to have multiple pages, eg. an
> about page, a members page, etc.  I think you know what I mean.  I have
> currently accomplished this by creating a variable in my session class
> called content and the root component renders different content depending on
> what the content variable stores.
>  This approach appears to have these advantages:
>
> I can have a header and footer that remains constant no matter what page the
> user is on
> It is very simple
> not much elseI do not entirely understand the idea of a root task but I have
> a feeling that that is the way I should go about completing this.
>  What is the "proper" way to accomplish my goal, preferably, I would like to
> be able to do the same things I can now, but do it "correctly" :)
>
> --
> David Zmick
> /dz0004455\
> http://dz0004455.googlepages.com
>  http://dz0004455.blogspot.com
>
> _______________________________________________
>  seaside mailing list
>  seaside@...
>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Roger
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: [NEWBIES] How to set up a multi-page website

by David Zmick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So, i was doing the right thing essentially, and I only need a task to manage login in and stuff.
Thats good news ;)

yay, thank you!!

On Fri, Apr 25, 2008 at 3:15 PM, Roger Ostrander <atiaxi@...> wrote:
Hello,

 The way I've approached this is similar to your idea:  There's a
"menu component" whose job it is to render the header, the footer,
itself, and then whatever the active component is.  I tend to store
the active component in the menu component itself, but that has the
problem that, unless you pass the menu component around, it's the only
thing that can transition between pages (this hasn't been a problem
for me).

 Tasks fill a different niche altogether.  They're used when you want
a sequential list of things to happen.  So say before people see the
menu component at all, they need to log in.  Your task would look
something like:

do
   [self session loggedIn ] whileFalse: [ self call: self loginComponent ].
   self call: self menuComponent.

 Hope this helps!

On Fri, Apr 25, 2008 at 4:45 PM, David Zmick <dz0004455@...> wrote:
> So, I have a website, and I would like it to have multiple pages, eg. an
> about page, a members page, etc.  I think you know what I mean.  I have
> currently accomplished this by creating a variable in my session class
> called content and the root component renders different content depending on
> what the content variable stores.
>  This approach appears to have these advantages:
>
> I can have a header and footer that remains constant no matter what page the
> user is on
> It is very simple
> not much elseI do not entirely understand the idea of a root task but I have
> a feeling that that is the way I should go about completing this.
>  What is the "proper" way to accomplish my goal, preferably, I would like to
> be able to do the same things I can now, but do it "correctly" :)
>
> --
> David Zmick
> /dz0004455\
> http://dz0004455.googlepages.com
>  http://dz0004455.blogspot.com
>
> _______________________________________________
>  seaside mailing list
>  seaside@...
>  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Roger
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--
David Zmick
/dz0004455\
http://dz0004455.googlepages.com
http://dz0004455.blogspot.com
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: [NEWBIES] How to set up a multi-page website

by Randal L. Schwartz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>>>>> "Roger" == Roger Ostrander <atiaxi@...> writes:

Roger> do
Roger>     [self session loggedIn ] whileFalse: [ self call: self loginComponent ].
Roger>     self call: self menuComponent.

That's #go, not #do.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: [NEWBIES] How to set up a multi-page website

by David Zmick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yep, i got that, but thanks for clarifying
On Fri, Apr 25, 2008 at 3:51 PM, Randal L. Schwartz <merlyn@...> wrote:
>>>>> "Roger" == Roger Ostrander <atiaxi@...> writes:

Roger> do
Roger>     [self session loggedIn ] whileFalse: [ self call: self loginComponent ].
Roger>     self call: self menuComponent.

That's #go, not #do.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--
David Zmick
/dz0004455\
http://dz0004455.googlepages.com
http://dz0004455.blogspot.com
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: [NEWBIES] How to set up a multi-page website

by David Zmick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

wow, this shouldn't be that hard to figure out, but, I can't seem to be able to change the value of wantsLogin( the variable I am using, should be self explanatory) from my prototype menu component, so, I can't get to the login component, what am i doing?

MenuComponent>>renderConentOn: html
     html anchor callback: [self session wantsLogin: true]; with: [html text: 'login']

RootTask>>go
    [ self session wantsLogin ]
        whileTrue: [Transcript show: 'wantsLogin = true'; cr. self call: self loginComponent].
    Transcript show: 'wantsLogin = false'; cr. self call: self menuComponent


On Fri, Apr 25, 2008 at 3:57 PM, David Zmick <dz0004455@...> wrote:
yep, i got that, but thanks for clarifying

On Fri, Apr 25, 2008 at 3:51 PM, Randal L. Schwartz <merlyn@...> wrote:
>>>>> "Roger" == Roger Ostrander <atiaxi@...> writes:

Roger> do
Roger>     [self session loggedIn ] whileFalse: [ self call: self loginComponent ].
Roger>     self call: self menuComponent.

That's #go, not #do.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--



--
David Zmick
/dz0004455\
http://dz0004455.googlepages.com
http://dz0004455.blogspot.com
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: [NEWBIES] How to set up a multi-page website

by Randal L. Schwartz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>>>>> "David" == David Zmick <dz0004455@...> writes:

David>  renderConentOn: html

Is that spelled right in your code?

David>      html anchor callback: [self session wantsLogin: true]; with: [html
David> text: 'login']

That last block is overkill.  "with: 'login'" will work.  #with: takes
any renderable item.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

RE: [NEWBIES] How to set up a multi-page website

by Ramon Leon-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>
> wow, this shouldn't be that hard to figure out, but, I can't
> seem to be able to change the value of wantsLogin( the
> variable I am using, should be self explanatory) from my
> prototype menu component, so, I can't get to the login
> component, what am i doing?
>
> MenuComponent>>renderConentOn: html
>      html anchor callback: [self session wantsLogin: true];
> with: [html text: 'login']
>
> RootTask>>go
>     [ self session wantsLogin ]
>         whileTrue: [Transcript show: 'wantsLogin = true'; cr.
> self call: self loginComponent].
>     Transcript show: 'wantsLogin = false'; cr. self call:
> self menuComponent
>

Your logic seems a bit backwards here.  By the time your menu component is
shown and has the chance to modify wantsLogin, you're past the login.  To
make it work, you need to restart the task by answering from the menu.

 html anchor callback: [self session wantsLogin: true. self answer]; with:
'login'

So the menu component returns control of the UI back to the Task, which will
then restart.  If you're going to force a login, probably better to stick
the user on the session and have the task check for a nil user instead, then
the login form need just set a current user on the session.  

I usually use a null object pattern here and have a special null user so I
can delegate to the current user (whether logged in or out) to find out what
actions are available.  For example, login is a valid action for a null user
while logout is a valid action for any other user.

Ramon Leon
http://onsmalltalk.com

_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: [NEWBIES] How to set up a multi-page website

by David Zmick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The login isn't a requirement to get on the page, so I want to have a link, but, I understand what you are saying

On Fri, Apr 25, 2008 at 6:24 PM, Ramon Leon <ramon.leon@...> wrote:
>
> wow, this shouldn't be that hard to figure out, but, I can't
> seem to be able to change the value of wantsLogin( the
> variable I am using, should be self explanatory) from my
> prototype menu component, so, I can't get to the login
> component, what am i doing?
>
> MenuComponent>>renderConentOn: html
>      html anchor callback: [self session wantsLogin: true];
> with: [html text: 'login']
>
> RootTask>>go
>     [ self session wantsLogin ]
>         whileTrue: [Transcript show: 'wantsLogin = true'; cr.
> self call: self loginComponent].
>     Transcript show: 'wantsLogin = false'; cr. self call:
> self menuComponent
>

Your logic seems a bit backwards here.  By the time your menu component is
shown and has the chance to modify wantsLogin, you're past the login.  To
make it work, you need to restart the task by answering from the menu.

 html anchor callback: [self session wantsLogin: true. self answer]; with:
'login'

So the menu component returns control of the UI back to the Task, which will
then restart.  If you're going to force a login, probably better to stick
the user on the session and have the task check for a nil user instead, then
the login form need just set a current user on the session.

I usually use a null object pattern here and have a special null user so I
can delegate to the current user (whether logged in or out) to find out what
actions are available.  For example, login is a valid action for a null user
while logout is a valid action for any other user.

Ramon Leon
http://onsmalltalk.com

_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--
David Zmick
/dz0004455\
http://dz0004455.googlepages.com
http://dz0004455.blogspot.com
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: [NEWBIES] How to set up a multi-page website

by David Zmick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

the null object thing seems simpler than my idea, thank you!

On Fri, Apr 25, 2008 at 8:41 PM, David Zmick <dz0004455@...> wrote:
The login isn't a requirement to get on the page, so I want to have a link, but, I understand what you are saying


On Fri, Apr 25, 2008 at 6:24 PM, Ramon Leon <ramon.leon@...> wrote:
>
> wow, this shouldn't be that hard to figure out, but, I can't
> seem to be able to change the value of wantsLogin( the
> variable I am using, should be self explanatory) from my
> prototype menu component, so, I can't get to the login
> component, what am i doing?
>
> MenuComponent>>renderConentOn: html
>      html anchor callback: [self session wantsLogin: true];
> with: [html text: 'login']
>
> RootTask>>go
>     [ self session wantsLogin ]
>         whileTrue: [Transcript show: 'wantsLogin = true'; cr.
> self call: self loginComponent].
>     Transcript show: 'wantsLogin = false'; cr. self call:
> self menuComponent
>

Your logic seems a bit backwards here.  By the time your menu component is
shown and has the chance to modify wantsLogin, you're past the login.  To
make it work, you need to restart the task by answering from the menu.

 html anchor callback: [self session wantsLogin: true. self answer]; with:
'login'

So the menu component returns control of the UI back to the Task, which will
then restart.  If you're going to force a login, probably better to stick
the user on the session and have the task check for a nil user instead, then
the login form need just set a current user on the session.

I usually use a null object pattern here and have a special null user so I
can delegate to the current user (whether logged in or out) to find out what
actions are available.  For example, login is a valid action for a null user
while logout is a valid action for any other user.

Ramon Leon
http://onsmalltalk.com

_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside






--
David Zmick
/dz0004455\
http://dz0004455.googlepages.com
http://dz0004455.blogspot.com
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside