Jump to content

wire ('pages')->get


dab
 Share

Recommended Posts

I'm using the "wire ('pages')->get" hook for an event calendar.

The wire hook below is "hard coded" & works fine :)

$events = wire('pages')->get("/courses/skills/")->date_repeater;
   

But I want to get the repeater for the current page (being viewed)

I've tried lots of ways of replacing the "->get" to get the repeater from the current page, but no luck.

I've tried $currentpage = $page>path; & replacing the get("/courses/-skills/") with $currentpage but no joy....

Any hints would be a huge help.

Link to comment
Share on other sites

@louisstephens Thanks....

It's got to be called via a hook, rather than a regular call from a page
 

function getEvents()
    {

    $events = wire('pages')->get("/courses/hill-skills/")->course_start_date_repeater;

    foreach ($events as $event)
    {
    
    echo "'$event->course_start_date' : '<span>BOOK BELOW!</span>',";    
    echo "'$event->course_finish_date' : '<span>PICK THE START DATE!</span>',";
    }
    }

 

Link to comment
Share on other sites

Just now, dab said:

@louisstephens Thanks....

It's got to be called via a hook, rather than a regular call from a page
 


function getEvents()
    {

    $events = wire('pages')->get("/courses/hill-skills/")->course_start_date_repeater;

    foreach ($events as $event)
    {
    
    echo "'$event->course_start_date' : '<span>BOOK BELOW!</span>',";    
    echo "'$event->course_finish_date' : '<span>PICK THE START DATE!</span>',";
    }
    }

 

My apologies on that. I should have picked up on the function reference.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...