New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Passing Taxonomy type from page to partial

Stefan Omerovic April 8, 2019 by Stefan Omerovic

Well, hello again..

i created Taxonomy of Categories.. There is just 2 values.. Best and New...

On my homepage, i am showing list of things with partial code. That list of things just a simple collection. Each item inside of that collection have category(tags) for best and new..

If i go to that partial where i loop trough that collection of items and i set this..

{{ collection:casinos taxonomy:categories="best" }}"

it will show me just items that have category of BEST.. Okay, so that part is working great..

Now on my Home Page, i have partial tag that is leading to that PARTIAL where i loop trough that collection

{{ theme:partial src="casinos" }}

or i can use it like this also..

{{ partial:casinos }}

Now what i want to succeed is next..

I want from that partial tag to set taxonomy value so in that partial html i can use that value.. Just to do it dynamicly..

So if my partial tag is passing variable best on that collection i would pass that variable instead of "best" in category..

So then i can have my partial wherever i wish and passing the values that i wish, but it will still use the same code inside of html of collection, it will just render different items based on "category" that is based on that variable.

Did you get me??

Thank you once more.. You are great!!

Answered by Erin Dalzell!
>>>>>>> Answered <<<<<<<
2 Replies