DaveP Posted July 30, 2014 Share Posted July 30, 2014 "A moment of sudden realization, inspiration, insight, recognition, or comprehension." (Merriam-Webster) (Nothing to do with these guys.) You are cordially invited to share your PW Aha! moments here. Hopefully others will benefit. For instance, the project I am currently working on includes a form to allow the entry of televised football fixtures (Time/Date, Home team, Away team). This is implemented as a PageTable and I needed to list any lines already existing and a blank line to allow the entry of a new fixture. foreach-ing through the existing fixtures is easy, but how to cleanly (in programming terms) add a blank line? $a->makeBlankItem()! $fixtures = $pages->find("template=fixture"); $emptyFixture = $fixtures->makeBlankItem(); $fixtures->append($emptyFixture); foreach($fixtures as $fixture){ ...do stuff.. }And that will include a blank fixture at the end. The ...do stuff... will very likely be form inputs. (I know a couple of lines could be chained (okay, 1-3), but it reads easier to me as it is.) 8 Link to comment Share on other sites More sharing options...
Joss Posted July 30, 2014 Share Posted July 30, 2014 Sorry, I tried to read this in an Alan Partridge style voice and it came out very strange! Link to comment Share on other sites More sharing options...
DaveP Posted July 30, 2014 Author Share Posted July 30, 2014 That connection never even occurred to me! (#accidentalpartridge) Link to comment Share on other sites More sharing options...
Nico Knoll Posted July 30, 2014 Share Posted July 30, 2014 Isn't this a "pub" topic? Link to comment Share on other sites More sharing options...
DaveP Posted July 30, 2014 Author Share Posted July 30, 2014 @Nico I did wonder about that but since it is directly about PW, I put it here. That said, if any mod wants to move it, then go ahead. Link to comment Share on other sites More sharing options...
Nico Knoll Posted July 30, 2014 Share Posted July 30, 2014 Moved it Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now