Jump to content

Pages - Find problem [solved]


Joss
 Share

Recommended Posts

Evening!

I have a "pages" field in some news articles that is for selecting a year.

I can retrieve this field from the article like this:

<?php echo $pages->get("/news-articles/proper-photography/")->News_Year->title; ?>

"title" is the field I used in the pages that make up my selects.

So far, so good. Now the problem.

I need to get an array of pages matching this value to a variable. For instance, I need all pages where this field = 2012. 

So:

$newsitems = $pages->find("template=TB_News, =$currentyear");

$currentyear is my variable

??? is me not knowing what to put!

if "News_Year" was a text field I could just put that field in there. But because it is a pages field, I need to get the "title" bit.

Obviously, if I put News_Year->title in there, PHP thinks I have gone nuts and bursts into tears.

So, how to I get that value and put it in my ??? hole?
 

Joss

  • Like 1
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...