jay singh Posted January 17, 2021 Share Posted January 17, 2021 Hi Guys, I am new to processwire and am trying to create a job portal for my website but im stuck.. I have a page where the portal superuser can see the jobs posted and it has a button that shows the number of applications (children) of each job. Ideally i want that when that show button is clicked, it takes me to a page where i can view all the applications for that job specifically. I have a template created for that page but its just a matter of getting it to only display the relevant applications/children. any guidance would be appreciated. This is the code i have to display the jobs in a list by their template <?php foreach($jobs as $job){ ?> <!-- Item #1 --> <tr> <td class="title"><a href="<?php echo $job->get('url');?>"><?php echo $job->get('title');?></a></td> <td>January 30, 2020</td> <td>January 30, 2020</td> <?php $qty = $job->numChildren(true);?> <td class="centered"><a href="#" class="button">Show (<?php echo $qty;?>)</a></td> <td class="action"> <a href=""><i class="fa fa-pencil"></i> Edit</a> <a href="#" class="delete"><i class="fa fa-remove"></i> Delete</a> </td> </tr> <?php }?> Link to comment Share on other sites More sharing options...
virtualgadjo Posted January 17, 2021 Share Posted January 17, 2021 Hi, not sure i understand the question that well... but i'll try ? if what you want is to display the content of, say job 1 applications contents, its quite simple, you can use the $page->chidren() method to retreive all the children of the page you're on if the page you use to display job application is not the job page itself, just start with a method to get the job page example... you have a single page that will show all the applications for a job depending on a link from the job page itself on the job page (let's say job 1) make a link with something like job-applications/1017 on the job-application template, allow url segments and now, sure you've guessed, you can retrieve the job page children using that segment (you could use the page name instead of its id, prettier even if a little - very little - more code to retreive the page id using name and template but this is just for the example) $jobpage = pages->get(1017) $applications = $jobpage->chidren(); job done ? hope it helps have a nice day 2 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