unsure what to do with the actions I need

dmnkhhn

Active member
Hello there!

I am rebuilding some of my addons and right now I am unsure what to do with all the actions I need.

My first add-on is going to be some sort of garage where my members can show their cars.

Here's the url structure I would like to use

/garage => index (list of garages)
/garage/2 => details for garage with id of 2
/garage/2/car/1 => details for a car with id of 1 parked in garage with id of 2

And (for admins and the owner of the garage)
/garage/2/edit
/garage/2/car/1/edit

I am already using
PHP:
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'garage_id');
in the router so /garage and garage/2 and even garage/2/edit are working fine (the latter just calls actionEdit inside my controller).

Now when I type /garage/2/car/1 into my browser I get:
The controller Garage_ControllerPublic_Index does not define an action called Car1.

How do I get the last part of the Url (the car thing) working?

Is it even possible or do I need to create a new route (like garage-car/2/edit)?
 
The Class you are using to action your index will also need a function added like this:

public function actionCar()
{

}
 
The Class you are using to action your index will also need a function added like this:

public function actionCar()
{

}

I already tried it but I don't get the ID of the car.
With this function in place, the following works: /garage/2/car

But this does not: /garage/2/car/1

ragtek suggest to take a look at prefixadmin/moderators.php - The code looks promising. :)
 
Same here.
I used to run vBGarage which was good in it's day, around the vB3.6 era. Lack of updates meant that it broke after 3.8 IIRC.
 
Top Bottom