Forum
Add entries from a collection into a dropdown for the navigation
I have a collection containing services, I would like to get these services items into a dropdown for the parent page. Can I somehow pass them into the navigation template by setting a variable?
What I can't get my head around it how I could pull out the titles with the corrosponding slugs for it to work as a dropdown. Or am I going about this all wrong, I just don't know. Advice or help appreciated.
As far as I've got:
$service_items = perch_collection('Services', [
'template' =>'services.html',
'skip-template' => true
]);
// main navigation
PerchSystem::set_var('service_list', $service_items);
Though I get Array to string conversion in
, I am guessing because I am just grabbing everything, would I need to loop through each and do something?
Why are you using skip-template? Why not just template them and pass them into the nav?
You know, I have no idea. After the entire day in Runway I think I was going code blind. Anyway, all working now. Thanks for the reply, Drew.