Jump to content

Recommended Posts

Posted

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?

Posted

I found the answer to my question. Created a "callouts" repeater with a page field called "callout" listing my callouts page children. Works perfectly.

The flexibility and amount of user of PW is simply astounding!

  • Like 1
Posted

You could also create a multiple page field and choose callouts page as parent. users can select them and drag them around to position.

  • Like 1
Posted

You can also populate a page field with a custom php code in the field settings and use api to fill dropdown with child pages of current page. Like context aware.

  • Like 2
Posted

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.
Posted

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 {}

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
×
×
  • Create New...