yellowled Posted June 10, 2012 Share Posted June 10, 2012 Current project has news posts which are supposed to be associated with one or more sections of the site. So the template news-posts uses a field news_sections, which uses the fieldtype Page/Multiple Pages. Now, on the index page of any given section (which are child pages of Home), I would like to emit a list of recent news posts associated with said section, limited to 5 posts. However, I can't figure out a way to use the news_sections field as a selector. The basic API call for this should be something like this: $news = $pages->find("template=news-post, limit=5"); so my idea was to use something like $sectionId = $page->id; $news = $pages->find("template=news-post, news_section*=$sectionId, limit=5"); but that doesn't work because the field type doesn't accept *= as a selector operator. Am I doing it wrong or is this fieldtype simply not meant to be used in a selector? Link to comment Share on other sites More sharing options...
diogo Posted June 10, 2012 Share Posted June 10, 2012 The page fieldtype refers to the page object itself, and not the id. So this should work: $news = $pages->find("template=news-post, news_section=$page, limit=5"); 4 Link to comment Share on other sites More sharing options...
yellowled Posted June 10, 2012 Author Share Posted June 10, 2012 And again, with PW, it's just too easy. Perfect, thanks a lot. 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