On 6/14/07, Patrick R. Michaud <[EMAIL PROTECTED]> wrote: > On Thu, Jun 14, 2007 at 09:44:46AM -0500, Ben Stallings wrote: > > At Dan's request, I'm bringing a disagreement he and I have had by > > private email to the list for other folks' feedback. > > > > In the most recent version of ZAP, he has provided the new markup > > {~Author$:varname} > > which retrieves the varname page text variable from Author's Profiles > > page. > > Nice. Works for me. > > > However, he's also provided a further shortcut for retrieving the > > current user's data (i.e. {~{AuthId}$:varname} ). His markup is > > {~varname} > > I feel strongly that this should be > > {~$:varname} > > instead, so that it's comparable to {*$:varname} and {=$:varname}. > > Consistency -- generally a very good thing -- would tend to argue in > favor of {~$:varname}. This also matches the Unix standard where > ~Alice refers to Alice's home directory, and ~ by itself refers to the > home directory of the currently logged in user.
This is the point Ben made actually, it has semantic problems in UNIX... > In fact, ignoring {~varname} for a moment: If {~Alice$var} > works to get a page variable from Alice's profile page, then > I would naturally expect that {~$var} would get a page variable > from the current author's profile page. To me, if that doesn't work, > it violates the principle of least surprise. Actually, I hadn't thought at all about page variables. I don't think it will work with the current code (which automatically supplies the $:), but if I make the change to Ben's suggestion, the code could be rewritten to allow for either page or text vars. > So, I think that {~$var} should work in any case, and the question > is whether {~varname} is a useful shortcut, and if so, what should > it be a shortcut to. > > One argument against {~varname} is that it appears to be a shortcut > only for page text variables, not page variables. So, {~varname} > allows me to get to $:varname inside of a profile page, but there's > no real shortcut to $varname for a profile page. Yes, see note above. This is a pretty convincing argument to me. > Beyond that, there's some real potential visual confusion in that > {~Alice} _looks_ like it's somehow talking about Alice's profile > page, but as defined above it's really the $:Alice page text > variable of the current user. That's a little confusing. Another good point. Thanks for the input Pm. > Anyway, I'd tend to always go with {~$:var} for consistency. > I think it'd be okay to offer {~var} as a shortcut, but I think > there's potential for confusion there, and saving two characters > per variable just isn't worth that level of confusion to me. > > My $0.02, Here's the new code, seems to be working fine for both page and text vars. Markup('profilevars', '<{$var}', '/\{\~(.*?)\}/e', "ZAPprofileVars('$1')"); function ZAPprofileVars($x) { $profiles = ZAPconfig('Profiles', 'Profiles', 'Site.ZAPConfig'); if(substr($x, 0, 1) != '$') return "{" . $profiles . "." . $x . "}"; else return "{" . $profiles . '.{$AuthId}' . $x . "}"; } I'll upload the revised ZAPtoolbox when I get a chance. Cheers, Dan _______________________________________________ pmwiki-devel mailing list pmwiki-devel@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-devel