web development war stories from the frontlines to the backend

I’m not sure why I haven’t posted this yet. The following code block is (one way) of simulating named parameters in PHP for class method calls. It utilizes PHP’s magic method __call and takes advantage of PHP 5’s Reflection API for determining default values of parameters not passed.
Parameters can be passed two ways:

$obj->method(array(‘key’ [...]

This post is simply stating the obvious. Sometimes even obvious things, in the wee hours of the morning, aren’t so.
When you specify parameters in your URLconf like:

urlpatterns = patterns(”,
url(r’^mark/(?P<id>\d+)/(?P<complete>\d+)/$’, views.mark, name=’mark’),
)

Keep in mind that each captured argument is a Python string. Even if the regex only captures integers – [...]

What exactly are they using it for? Front-end?

  

Recent Posts

Categories

Archives