I'm building a website and need to pull stuff from a SOAP instead of a MySQL server. I'm kind of new to MVC but I figured I'll create a new pagetype and in there make a controller that will call my soap. And then in the .ss-file I'll call the controller.
<select name="category"> <% control getCategories($category) %> <option value="$id">$name</option> <% end_control %> </select>
$category is the category for which I want subcategories. The structure can be explained like this:
In my DB I have my top-level categories. I create a page for each top-level category and choose which category the current page represents using a "HasOneComplexTableField", pretty much like in tutorial #5.
Then, depending on which category I'm on I'll call my getCategories-controller with the current category as an argument.
I have 2 problems with this.
1. How do I get the data from the SOAP into the template? Does the <% control getCategories($category) %> expect a DataObject to be returned or can it handle arrays as well?
2. When I try the code I've done I get an error, but <% control getCategories(1) %> works fine. Do I have to make a new function for each top-level category (getCategoriesForLevelOne, getCategoriesForLevelTwo, etc.) and then have those functions call the getCategories function with a hardcoded argument (1, 2, etc.)? That seems kind of stupid...
Please advise! :)
P.S. Why can't I preview this post before I post it?