How do I make path parts optional arguments for View action?

Permalink
Hi guys and girls,

I have a Single Page controller, and followed this How-To: http://www.concrete5.org/documentation/how-tos/developers/use-query... to use path parts as arguments for the view action.

How do you make these arguments optional?
I have code like this:
public function view($p1,$p2,$p3,$p4) {
-code-
}


This parses the arguments exactly as planned when the path includes the parts to process, but delivers "Missing argument 2 for Concrete\Package\Events\Controller\SinglePage\GetInvolved\Events::view()" if the URL doesn't include the extra arguments.

How do I make those $p1 - $p4 arguments optional so that the page doesn't fail?

Thanks for your help!

goldfox
 
Mnkras replied on at Permalink Best Answer Reply
Mnkras
public function view($p1 = null, $p2 = null, $p3 = null, $p4 = null) {
goldfox replied on at Permalink Reply
goldfox
Hero! That worked perfectly. Many thanks!
Mnkras replied on at Permalink Reply
Mnkras
The small simple things :)