Hi,
I'm new to smalltalk, seaside and pier. I want to use pier to host a small site, and if possible, I'd like to change the way internal links to other pages are rendered, so that the wiki text: *Introduction>introduction* produces the link: http://localhost:9090/seaside/pier/information/introduction instead of: http://localhost:9090/seaside/pier/information/introduction?view=PRDefaultView&command=PRViewCommand&_k=jFcQckKB&25&_s=lEBbpcqiBRMHlTFF Both links return the same URL when typed into the browser, so clearly view is the default command. I've tried searching around for information about this but I couldn't find anything obvious to me. While browsing the source code, I came across WAUrl adaptToContext: and WAAnchorTag goto:, which look potentially relevant, but I'm honestly not sure if I'm on the right track. I'd appreciate it if someone could point me in the right direction. Also, if this is a really bad idea for some reason, that would also be good to know. I'm using Sqeak-3.8, Seaside 2.63a3-lr.51 and Pier-all-lr.81 Thanks, Brian _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
Hi,
> I'm new to smalltalk, seaside and pier. I want to use pier to host > a small > site, and if possible, I'd like to change the way internal links to > other > pages are rendered, so that the wiki text: > > *Introduction>introduction* > > produces the link: > http://localhost:9090/seaside/pier/information/introduction > > instead of: > http://localhost:9090/seaside/pier/information/introduction? > view=PRDefaultView&command=PRViewCommand&_k=jFcQckKB&25&_s=lEBbpcqiBRM > HlTFF this is simple to do, have a look #goto: in WAAnchorTag. However I strongly discourage you doing this, since ... - it will start a new session every time you click a link. - you will loose all the state of your application when clicking a link, e.g. most widgets won't work anymore. - waste a lot of memory and cpu-time on the server, because the url has to be parsed and all Seaside components have to be rebuild and reinitialized on every click. > Both links return the same URL when typed into the browser, so clearly > view is the default command. I've tried searching around for > information > about this but I couldn't find anything obvious to me. While > browsing the > source code, I came across WAUrl adaptToContext: and WAAnchorTag > goto:, > which look potentially relevant, but I'm honestly not sure if I'm > on the > right track. I'd appreciate it if someone could point me in the right > direction. Also, if this is a really bad idea for some reason, that > would > also be good to know. Yes, these two methods [1,2] are definitely the ones your are interested in. Let me try to explain the background of these methods: Seaside only parses the URL on the first request, else it will only perform the callback (as defined in [1] by #registerActionCallback:) and ignore all the rest. So why the heck I am doing so many thing with the generated URL, if Seaside is not using it at all? It basically makes it possible to preserve some state when bookmarking the URL, when opening the URL within a new window, or when sending it to friends. If the argument '_s' (Session) is invalid (mostly because of a timeout, or maybe because of a session-protector), Pier will try to restore the state from the URL and bring back the user at the right place. To conclude, you cannot shorten the URL in the anchors without scarifying functionality. That's life, Lukas [1] WAAnchorTag>>goto: aContext "Initialize the receiver to properly activate aContext when being clicked. This includes a callback and a human-readable and bookmarkable url." | actionUrl | aContext isValid ifFalse: [ ^ self class: 'protected'; url: '#' ]. actionUrl := canvas context actionUrl withParameter: (canvas callbacks registerActionCallback: [ PRCurrentContext value: aContext ]). self url: (actionUrl adaptToContext: aContext) displayString [2] WAUrl>>adaptToContext: aContext path := aContext session application baseUrl path copy. aContext structure parents allButFirst do: [ :each | self path add: each name ]. aContext command isView ifTrue: [ self addParameter: 'view' value: aContext command viewComponentClass name asString ]. self addParameter: 'command' value: aContext command class name asString -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
In reply to this post by Brian Chapados
On 31 Mar 2006, at 22:51, Brian Chapados wrote: > Hi, > > I'm new to smalltalk, seaside and pier. I want to use pier to host > a small > site, and if possible, I'd like to change the way internal links to > other > pages are rendered, so that the wiki text: > > *Introduction>introduction* > > produces the link: > http://localhost:9090/seaside/pier/information/introduction > > instead of: > http://localhost:9090/seaside/pier/information/introduction? > view=PRDefaultView&command=PRViewCommand&_k=jFcQckKB&25&_s=lEBbpcqiBRM > HlTFF > > Both links return the same URL when typed into the browser, so clearly > view is the default command. I've tried searching around for > information > about this but I couldn't find anything obvious to me. While > browsing the > source code, I came across WAUrl adaptToContext: and WAAnchorTag > goto:, > which look potentially relevant, but I'm honestly not sure if I'm > on the > right track. I'd appreciate it if someone could point me in the right > direction. Also, if this is a really bad idea for some reason, that > would > also be good to know. > > I'm using Sqeak-3.8, Seaside 2.63a3-lr.51 and Pier-all-lr.81 > > Thanks, > > Brian > > > > > _______________________________________________ > SmallWiki, Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |