2008/10/8 Brad <[EMAIL PROTECTED]>: > > Many thanks for the reply. Can you tell me how I could parse this URL > when it is called so I can generate the required content? Bear in mind > that the actual internal path may be just /gps/ and the rest of the URL > would need to be parsed to determine which data needs to be extracted > via the database or API call. Also, how would I make my application > "aware" that this URL (or at least the http://site.com/gps/ part of it) > is part of my application? >
The documentation of wt 2.2.0 contains an explanation. Start with the WApplication::setInternalPath and friends. http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WApplication.html When the user surfs to a new URL, the signal Wt::WApplication::internalPathChanged is emited. It is up to you to decide, based on the extra string appended to the application path, what changes you will make on the widget tree. You can indeed search a database in order to present the contents. > Is there an example anywhere? The homepage example uses static URLs so I > do not believe it is representative of what I am trying to achieve. > The homepage does not use static URLs - at least, not static pages. Granted, we always show the same content when the user surfs to a particular URL, but the homepage is a web application that is deployed on http://www.webtoolkit.eu/wt/. Aso, the href of the homepage URL's is set to something that looks like a static URL, but that is part of the strategy of being search-engine friendly (and to enable users to right-click and open a link in a new window etc). But look closely at the location bar on top of your browser: there is a hash mark (#) between the application path and the internal path. Mouse clicks are handled by the onClicked() handler rather than following the user-visible URL. The remainder of the URL string, be it 'documentation', 'download', or whatever, is parsed by the WMenu class, which uses the normal setInternalPath and listens to the internalPathChanged signal. Finally, you end up in WMenu::setFromState(), who dynamically looks up the path in a set. You can do whatever database access here. The WMenu class is therefore an example of the use of this interface like you would like to use it. > In order to generate pages for products that I am not aware of at > compile time I need to be able to pass variables to a witty URL either > as an appendage to the "real" URL or as > ?id=abc&manufacturer=garmin&model=nuvi350 style arguments. At the moment > I can't see how to do this, a simple example of how to do this would not > go astray I believe and I would be happy to donate such an example > (subject to peer review of course) if someone can tell me where to start? > I recommend src/Wt/WMenu.C Kind regards, Wim ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
