SwiftlyTilting: usability, reusability

Sunday, August 12, 2007

Winter 2.0.2

A user left a comment notifying me about a warning message which would appear if allow_call_time_pass_reference was set to off in PHP settings. I’ve fixed the problem along with a few other minor bugs for this release. I also added a new comment syntax {{#| You comment here }}

Change log:

* Fixed allow_call_time_pass_reference bug
* Fixed bug with <nowinter> tag
* Fixed bug when undefined variables were referenced
* Added alternative comment syntax

Download Winter 2.0.2
Downloaded 855 times


12 Comments Leave Comment

I have a question about syntax. I am not sure where else to post this question so I will do so here.

By way of comment though, I really like Winter. It’s pretty sweet, thanks for the hard work put forth.

Ok, so I am trying to make a template that iterates through variable names and I can’t seem to figure it out. My code looks like


{{#for | {{#a @= 1}} || {{#a
{{#if | {{#a == 1}} ||
{{#if | {{{child1|}}} ||
{{!}}-
{{!}}valign=”top”{{!}}”’Children”’
{{!}}valign=”top”{{!}}[[Individual:{{{child1|}}} | {{{child1|}}}]]
}}
}}
{{#if | {{{child{{#a}}|}}} ||
{{!}}-
{{!}}valign=”top”{{!}}
{{!}}valign=”top”{{!}}[[Individual:{{{child{{#a}}|}}} | {{{child{{#a}}|}}}]]
}}
}}

Basically it never sees more than one child since the {{#if | {{{child{{#a}}|}}} never evaluates to true for some reason. I have tried EVERYTHING, escape sequences, setting a variable name and trying to use that to append the template variable name, nothing works.

To explain the template is to display a family picture and also display the names of each of the children. I would like to allow for many children and don’t want to make an if statement for each one, so instead I was just going to iterate through them, but I can’t get it to work.

Comment by Kenn — Friday, August 24, 2007 @ 12:45 pm

I meant to add that it does find the first child, but none after that.

Comment by Kenn — Friday, August 24, 2007 @ 1:36 pm

Hi Kenn,

Template variables are evaluated before they are sent to Winter.. so {{{Child1}}} is evaluated correctly because MediaWiki recognizes it as a template variable, but {{{child{{#a}}|}}} is not a variable as far as MediaWiki is concerned.

Right now arbitrary template variable names are not able to be used. In the future I plan on adding a feature which will allow Winter code to be evaluated in more than one place inside the MediaWiki parsing engine since you’re not the first person to want to do something like this with Winter.

Also it looks like your #for statement is missing something ;)

Comment by swiftlytilting — Friday, August 24, 2007 @ 2:51 pm

The for statement is missing some stuff there, but it must not have copied right, but it is right in the code or I would have gotten an error.

Thanks for your help. Even though it doesn’t work, it’s nice to have that confirmed, I’ll do something else. Thanks again. Good work, and I look forward to the new feature when you get around to it.

Comment by Kenn North — Saturday, August 25, 2007 @ 12:41 pm

I’ve got a few ideas on how to handle template variables so hopefully soon I’ll have a good solution. In the meantime you might consider formating your genealogical data into XML and using #xml_xpath to retrieve the data :)

Comment by swiftlytilting — Saturday, August 25, 2007 @ 10:16 pm

I’ve implemented a feature to process Winter code before the wiki code is parsed, but I ran into a rather obvious problem: If you process the code before loading the template, then the template code is not processed. The only way to process code within a template is to load it into the main page, but all template variables are processed by MediaWiki at that time.

Right now I’m looking into ways to get the parameter values into an array which would be a lot more convenient but this feature might not happen as quickly as I expected so you might want to look at some other workarounds. I will add #explode which will act like the PHP command explode() to allow for a string to be divided up into an array using any character as a separator.

Comment by swiftlytilting — Sunday, August 26, 2007 @ 4:09 am

Haha I take it back, I’ve figured out a nice solution. Sit tight while I finish working on the next release.

Comment by swiftlytilting — Monday, August 27, 2007 @ 1:57 am

Very cool. Thanks for your time in looking into this for me. I think it can be pretty valuable.

Comment by Kenn North — Tuesday, October 30, 2007 @ 6:06 am

I see you released this now, how would I use it in my situation? I’d like your take on it, as this is a strange use case.

Comment by Kenn North — Tuesday, October 30, 2007 @ 6:13 am

Ed, nicely done. Fits the spriit of the poem’s theme - I enjoyed your spin. I also play around with taking a mashup like concept to literature and fine art - started with the same Robert Frost poem you morphed and mixed in one of Yogi Berra’s famous sayings.

Comment by Hayat — Wednesday, November 26, 2014 @ 6:42 pm

Haha, shouldn’t you be charging for that kind of knelwodge?!

Comment by Anja — Wednesday, February 25, 2015 @ 8:07 pm

I would love to win the red bird one! Just found your blog through DAM and I’m adnidg you to my google reader ;) Your work is so inspiring and I love your blog templates!

Comment by Houcine — Sunday, April 5, 2015 @ 5:03 pm

Leave a Comment

Validate XHTML | Word Press