Big Box Mart
Apparently, shopping at Wal-Mart isn’t as cheap as they would like us to think. Here you’ll find a movie that explains it all. Enjoy!
Apparently, shopping at Wal-Mart isn’t as cheap as they would like us to think. Here you’ll find a movie that explains it all. Enjoy!
I’ve just read this nice opinion piece about templates and why “the vast majority of template engines […] simply have it wrong”. And so I thought it may be a good time to talk more about templates in Reflex.
I don’t think I can put Reflex templates in the same category as most template engines. Templates in Reflex are there to save you (the framework or module programmer) from writing code. And by doing so, it changes that traditional template paradigm: instead of retrieving all the data then sending it to the template engine, it’s the template engine that gather the data based on what the template actually need.
But this doesn’t make the template hard to use; you’d hardly notice what’s happening when you write something like this:
<rx:entry-list>
<h2><rx:entry-title/></h2>
<rx:entry-content/>
</rx:entry-list>
which in reality is simply a shorter form for this:
<rx:list source="weblog/entry" as="entry">
<h2><rx:data source="entry/title"/></h2>
<rx:data source="entry/content"/>
</rx:list>
All this looks like a standard template engine doesn’t it? But based on this template, Reflex will perform the following SQL query:
SELECT title, content FROM weblog_entry WHERE weblog_id=1
Let’s say we add a publication date to our template:
<rx:entry-list>
<h2><rx:entry-title/></h2>
<rx:entry-content/>
<p>Published on <rx:entry-publication-date/></p>
</rx:entry-list>
The query will change accordingly:
SELECT title, content, published_on FROM weblog_entry WHERE weblog_id=1
How does this work? The template is converted to an intermediately form, which is an array of strings and “Pane” objects. Panes nested into other panes can request data to their parent; panes that gather data should select fields requested by their children.
So, Reflex use the template for both things: gathering the data and rendering the data. Doing this doesn’t make the template more complicated than other template systems. But it’s a subtle paradigm shift: instead of being about only how things are presented, the template is also about what is presented.
I must absolutely pass on this interview of one of the few independent journalist in Iraq who does go on the ground instead of staying in an hotel in the green zone and reporting what the US-backed government has to say.
This excerpt is no good news:
The myth that the US military has control over any portion of Iraq is just that-a myth. Even the heavily fortified “Green Zone” is mortared on a regular basis. If one wishes to fly in or out of Baghdad International Airport, get ready for a spiral descent/take off… as this has been necessary for also over a year due to the inability of the military to safeguard the area around the airport. Like in Vietnam, planes will be shot down if they don’t use the spiral method of taking off/landing.
The infrastructure is in shambles. For most of the western companies who were awarded the no-bid cost-plus contracts in Iraq, it’s their dream contract — guaranteed profits with no oversight. Companies like Bechtel have been paid out in full for their initial contract worth $680 million and awarded contracts totaling over $3.8 Billion, despite the fact that many of their projects in their initial contract were not even begun.
Meanwhile, Iraqis suffer and die from waterborne diseases, child malnutrition is worse than during the sanctions, and there is over 70% unemployment.
Yesterday I got a nice, simple, and direct question in may mailbox: “How goes work on Reflex?” The answer is that it’s taking more time than I expected (it’s not the first time I say that obviously). But it’s also going to be something great when it goes out.
What’s happening is that I’m currently building the administrative interface, and it forces me to rethink one by one many things of the underlying system. The interesting thing is that the admin interface will be made from same template system you’ll use to build pages of your Reflex-powered website, which imply that it will be easy to make forms on any page that can create or edit parts of your website. It’s a little tricky to get everything work right, but I’ll get to it eventually.
To those who fear that I’m mixing the application logic with the display logic by putting everything in the template, don’t worry: it’s not the case. The template only choose the logic to use on a page (like which button performs which action), while the framework or modules define the action (with some PHP code).
This makes Reflex a mix between a traditional CMS (where you manage the content, and the logic is all decided for you) and a web application framework (where you write both the application logic and the pages).