Joss Posted January 15, 2013 Share Posted January 15, 2013 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 1 Link to comment Share on other sites More sharing options...
nik Posted January 15, 2013 Share Posted January 15, 2013 News_Year.title=$currentyear I'm on a mobile but I think I got that right - if I understood you right in the first place . Hope this helps! 3 Link to comment Share on other sites More sharing options...
Soma Posted January 15, 2013 Share Posted January 15, 2013 News_Year.title=xyz Or better retrieve the year as page object. Then do News_Year=$yearpage In the selector. Im on mobile too lol 1 Link to comment Share on other sites More sharing options...
nik Posted January 15, 2013 Share Posted January 15, 2013 Omg, I beat Soma! 3 Link to comment Share on other sites More sharing options...
Soma Posted January 15, 2013 Share Posted January 15, 2013 Ghhk.. Congrats Nik. You level up! Link to comment Share on other sites More sharing options...
Joss Posted January 15, 2013 Author Share Posted January 15, 2013 If I can just squeeze in here!! Ta much!! That worked. I mean, putting a dot in worked. Joss Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now