Reload a stack with a page list using AJAX

Permalink
Hi,

I'm trying to find out if it's possible to reload a stack onto a page using AJAX. The thing I'm going for is a stack with a page list that is reloaded after a certain action is performed.

For example, say a select box is clicked to choose a filter for the page list. After the value of the select box has changed, I need to reload the stack with the page list in it and apply the filter.

I can get as far as grabbing the select box's value and posting it through to a PHP file. However, I'm having trouble loading that stack in that PHP file. The first error I get is that it can't find the class for 'Stack'.

I'm guessing that there are a bunch if includes that I'm missing, but I don't know what I need to be pulling in before I try to get and display the stack along with the page list inside it.

 
mnakalay replied on at Permalink Reply
mnakalay
Concrete5 does it with blocks every time you edit a block and save so I am sure it is possible with stacks as well.
Look at the code for saving blocks in the core, that might help you
JohntheFish replied on at Permalink Reply
JohntheFish
If you are on 5.6.x, you can do it building out from Blocks by Ajax (for the ajax load and post data) and Universal Content Puller (to pull the stack). You will still need a custom page list block that lists according to post parameters (or you could use Magic Data and Uber List for that part)
WillemAnchor replied on at Permalink Reply
WillemAnchor
You might wanna check /dashboard/stacks, 2 files are important:
\concrete\single_pages\dashboard\blocks\stacks\view.php
\concrete\controllers\single_page\dashboard\blocks\stacks.php

You can copy part of the view.php for previewing the stack into your controller.

Or check my Stack Manager add-on. It's getting a stack's content from the controller every time you select a different stack.

good luck !

- edit -

I see now that you want to load it into a normal page. But the technique is quite the same.
Might also wanna check:
\concrete\blocks\core_stack_display\controller.php and
\concrete\blocks\core_stack_display\view.php