Jump to content

Assign Callouts(pages) to Page


AJ Troxell
 Share

Recommended Posts

I am new to ProcessWire of course, but loving every minute of developing with it. What I am looking to do is to make a field that can list all children of a page. My page would be "callouts" and the children would be "callouts". I would like to list these in a field in another pages template that lists the "callouts" so that the user can pick a number (lets say 3) of them and they will then show on that page. It is preferred for each page to have a unique set of callouts.

The alternative, I supposed, is to return only the latest-x callouts on each page, but this negates any amount of customization in regard to these callouts.

Is this possible? Can anyone send me in the right direction?

Link to comment
Share on other sites

It bears repeating that I have only been using PW for two days before I go any further. I did readjust things to negate the repeater and only use a pageListSelectMultple in its place, which is working out well. My burden now is the proper output. I can spit out placeholder text accurately for how many "callouts" I have assigned to a page. But I can't spit out any fields assigned to my callout itself. Right now I am using this code:

<?php
            foreach($page->callouts as $callout) {
            echo'<div class="small-12 medium-4 large-4 columns">';
            echo'{$calllout->title}';
            echo'</div>';
            }
        ?>
 
The html is output of course, but instead of my callouts actual title, I am getting {$callout->title}. Any assistance would be highly appreciated. I have done much reading, but just don't know what to do from here.
Link to comment
Share on other sites

In this case you can write simply echo $callout->title.

Just for reference, it would also work if you would change the ' by " because ' ignores variables and " doesn't. But as I said, here you can just drop the ' and {}

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

×
×
  • Create New...