This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Flynsarmy
Flynsarmy

If you have a page with url /blog/:slug and you want to get the value of :slug from your Post component, you can do it from your components onRun() method with $this->controller->param('slug').

For a list of all parameters and their values, use $this->getRouter()->getParameters()

Last updated

daftspunky
daftspunky

$this->param('slug') works too, components will "fallback" to the controller for method calls.

Tschallacka
Tschallacka

daftspunk said:

$this->param('slug') works too, components will "fallback" to the controller for method calls.

^^^^^ o_O that would be a nice thing to have prominently featured in the documentation...

That explains so much weird behaviour...

Maybe an idea to draw out a graph of the october ineritance model for coders... because you have these fallbacks, extending into the __construct etc...

I'd like to have a sheet that neatly explains all the ways october objects can be influenced and what their fallbacks are...

leorapirap25286
leorapirap25286

daftspunk said:

$this->param('slug') works too, components will "fallback" to the controller for method calls.

this one works for me! thank you!

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.