Support home topic override
Purpose & Scope
Just wanted to set a different home topic for only one of my webs. It causes various type of issues they are gathered here just in case we want to support that one of these days. Tried on TWiki 4.1.2.
How-to
Traditionally every Web has the same home topic defined in
configure. The default being the well know
WebHome.
However
TWikiVariables defines the
%HOMETOPIC% variable.
One can override
%HOMETOPIC% by redefining it in
WebPreferences.
Consequences
On
PatternSkin:
- The left bar web list is broken as it links to the current web home topic for every listed web. I guess
%WEBLIST% would need fixing.
- Breadcrumbs is ok though.
On
NatSkin:
Default
redirection from Web URL to Web home topic is still pointing the the value defined in
configure. Something should be fixed in the core I think.
Conclusion
Until the points mentioned above get fixed just don't do try that
--
Contributors: StephaneLenclud - 03 Apr 2007
Discussion
Home about adding something like this to the Func API:
sub getHomeTopicName () {
return getPreferencesValue('HOMETOPIC', shift)
|| $TWiki::cfg{'HomeTopicName'} || 'WebHome';
}
Actually, the
FlexWebListPlugin does not hardcode 'WebHome'. Only the examples do. The next
BreadCrumbsPlugin and
NatSkinPlugin will have a hometopic fix. There are some more plugins that use a hardcoded 'WebHome', e.g.
FindElsewherePlugin, and surely more.
--
MichaelDaum - 04 Apr 2007
Wondering if we need a new function to the Func API? One can simply and consistently write
%HOMETOPIC%, or call
TWiki::Func::expandCommonVariables( '%HOMETOPIC%', '', $web ).
--
PeterThoeny - 04 Apr 2007
I guess a specialized API make it clearer for developers that they need to use it to get the home topic name. The good thing about new API is that they don't break older code

We just have to mention the TWiki version in which it was introduced and provide an example on how to do it on older TWiki version.
In general I like specialized APIs as they provide convenient and explicit shorthand when writing code. Often they also make the code more readable and maintainable.
--
StephaneLenclud - 05 Apr 2007
On the same line it would be nice to be able to set the
DefaultUrlHost for each web. Thus allowing for better web isolation. The idea would be to be able to run multiple webs as if they were completely different web site.
--
StephaneLenclud - 05 Apr 2007