[pmwiki-users] Version Detection for skin.php
H. Fox
haganfox at users.sourceforge.net
Thu Aug 25 16:54:52 CDT 2005
On 8/25/05, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Thu, Aug 25, 2005 at 04:30:42AM -0700, H. Fox wrote:
> > How would I do
> >
> > if (version is older than 2.0.beta53) {
> > something
> > } else {
> > something else
> > }
> >
> > in skin.php?
>
> There's not a trivially simple mechanism for doing this,
> although I've been thinking about adding one. At the moment
> the best I can offer is the $Version string, which will
> look like "pmwiki-2.0.beta53".
>
> I've been thinking about introducing a $VersionNum variable
> which will be guaranteed to have monotonically increasing
> values, but there hasn't been much demand or need for it yet.
Would it be risky to use this in skin.php?
global $Version;
if (strpos($Version, '2.0.beta')
&& substr(strstr($Version, '2.0.beta'), 8) < 53 )
{
// beta52 or older
} else {
// beta53 or newer
}
It's not mission-critical. All I want to do is tweak the search form
for backward-compatibility.
My other compatibility tweak is a simple one:
## For backward compatibility.
global $SiteGroup;
if (!$SiteGroup) { $SiteGroup = 'Main'; }
Hagan
More information about the pmwiki-users
mailing list