How to link to a page from inside an embedded component

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to link to a page from inside an embedded component

NorbertHartl
Hi,

I have a component embedded on a page. Inside this component
I want to create links to pages inside my pier kernel.

If I do such a component what would be the best base class?
(WAComponent?).

How can I create a link to another page by specifying the
path? Or something else?

thanks,

Norbert

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: How to link to a page from inside an embedded component

Lukas Renggli
> How can I create a link to another page by specifying the
> path? Or something else?

If you use URLs you lose the current session and possibly state.

The right way to do this, is to use objects, e.g.

     html anchor
         goto: newContext;
         with: 'A Pier Link'

where 'newContext' is the description of where you want to go. Create
this new context object from the current one like so:

     newContext := self context structure: aStructure

where 'aStructure' is the page you want to go to and 'newContext' is a
temporary variable. Instead of using #structure:, it is also possible
to use #structure:command: or #structure:view: to specify a different
command or view.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: How to link to a page from inside an embedded component

NorbertHartl
On Sat, 2009-06-13 at 07:48 +0200, Lukas Renggli wrote:

> > How can I create a link to another page by specifying the
> > path? Or something else?
>
> If you use URLs you lose the current session and possibly state.
>
> The right way to do this, is to use objects, e.g.
>
>      html anchor
>          goto: newContext;
>          with: 'A Pier Link'
>
> where 'newContext' is the description of where you want to go. Create
> this new context object from the current one like so:
>
>      newContext := self context structure: aStructure
>
> where 'aStructure' is the page you want to go to and 'newContext' is a
> temporary variable. Instead of using #structure:, it is also possible
> to use #structure:command: or #structure:view: to specify a different
> command or view.
>
Well, I should try to be more clear when asking :) I don't want to loose
the session in between. I want to do it exactly like you wrote here. My
question was towards looking up/finding the structures. It was meant as
"What is the easiest way to find a structure when I now a path?". The
idea (so far) is that I know some of the structure of the site. I want
to do my own component and then I want to link /a/b/c. So I need a way
to lookup /a/b/c as a structure to able to link to it. I imagine the
answer could be PRPathLookup but are there other ways to do?

thanks,

Norbert

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: How to link to a page from inside an embedded component

Lukas Renggli
There is #lookupPath: and friends defined in PRStructure. This allows
you to lookup structures relative to the receiver. If the path starts
with a slash it is always relative to the root. Internally these
methods use PRPathLookup.

Lukas

On Saturday, June 13, 2009, Norbert Hartl <[hidden email]> wrote:

> On Sat, 2009-06-13 at 07:48 +0200, Lukas Renggli wrote:
>> > How can I create a link to another page by specifying the
>> > path? Or something else?
>>
>> If you use URLs you lose the current session and possibly state.
>>
>> The right way to do this, is to use objects, e.g.
>>
>>      html anchor
>>          goto: newContext;
>>          with: 'A Pier Link'
>>
>> where 'newContext' is the description of where you want to go. Create
>> this new context object from the current one like so:
>>
>>      newContext := self context structure: aStructure
>>
>> where 'aStructure' is the page you want to go to and 'newContext' is a
>> temporary variable. Instead of using #structure:, it is also possible
>> to use #structure:command: or #structure:view: to specify a different
>> command or view.
>>
> Well, I should try to be more clear when asking :) I don't want to loose
> the session in between. I want to do it exactly like you wrote here. My
> question was towards looking up/finding the structures. It was meant as
> "What is the easiest way to find a structure when I now a path?". The
> idea (so far) is that I know some of the structure of the site. I want
> to do my own component and then I want to link /a/b/c. So I need a way
> to lookup /a/b/c as a structure to able to link to it. I imagine the
> answer could be PRPathLookup but are there other ways to do?
>
> thanks,
>
> Norbert
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>

--
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: How to link to a page from inside an embedded component

NorbertHartl
On Sat, 2009-06-13 at 18:06 +0200, Lukas Renggli wrote:
> There is #lookupPath: and friends defined in PRStructure. This allows
> you to lookup structures relative to the receiver. If the path starts
> with a slash it is always relative to the root. Internally these
> methods use PRPathLookup.
>
That sounds good. Is it better the just request PRCurrentContext or
is it better the take a pier class as base class for my component?

Norbert

> Lukas
>
> On Saturday, June 13, 2009, Norbert Hartl <[hidden email]> wrote:
> > On Sat, 2009-06-13 at 07:48 +0200, Lukas Renggli wrote:
> >> > How can I create a link to another page by specifying the
> >> > path? Or something else?
> >>
> >> If you use URLs you lose the current session and possibly state.
> >>
> >> The right way to do this, is to use objects, e.g.
> >>
> >>      html anchor
> >>          goto: newContext;
> >>          with: 'A Pier Link'
> >>
> >> where 'newContext' is the description of where you want to go. Create
> >> this new context object from the current one like so:
> >>
> >>      newContext := self context structure: aStructure
> >>
> >> where 'aStructure' is the page you want to go to and 'newContext' is a
> >> temporary variable. Instead of using #structure:, it is also possible
> >> to use #structure:command: or #structure:view: to specify a different
> >> command or view.
> >>
> > Well, I should try to be more clear when asking :) I don't want to loose
> > the session in between. I want to do it exactly like you wrote here. My
> > question was towards looking up/finding the structures. It was meant as
> > "What is the easiest way to find a structure when I now a path?". The
> > idea (so far) is that I know some of the structure of the site. I want
> > to do my own component and then I want to link /a/b/c. So I need a way
> > to lookup /a/b/c as a structure to able to link to it. I imagine the
> > answer could be PRPathLookup but are there other ways to do?
> >
> > thanks,
> >
> > Norbert
> >
> > _______________________________________________
> > Magritte, Pier and Related Tools ...
> > https://www.iam.unibe.ch/mailman/listinfo/smallwiki
> >
>

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: How to link to a page from inside an embedded component

Lukas Renggli
>> There is #lookupPath: and friends defined in PRStructure. This allows
>> you to lookup structures relative to the receiver. If the path starts
>> with a slash it is always relative to the root. Internally these
>> methods use PRPathLookup.
>>
> That sounds good. Is it better the just request PRCurrentContext or
> is it better the take a pier class as base class for my component?

That doesn't really matter, both will work WAComponent and PRWidget.
For a Pier specific component PRWidget is probably more appropriate.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki