Hi there,
the example i postet was just dummy code to illustrate my problem.
Let me explain what's really happening:
I have a js function called createColorItem.js
define(function () {
var scriptURL = cmsURLS.urls.root + 'php/updateColorItem.php',
_target = cmsURLS.urls.target,
_dropRect,
_color;
return {
create: function (itemData, EventBus)
{
_dropRect = itemData[0].toString();
_color = itemData[1].toString();
var scriptURL = cmsURLS.urls.root + 'php/createColorItem.php';
$.ajax({
url: scriptURL,
type: 'GET',
data: {
target: _target,
dropRect: _dropRect,
color: _color
},
}).done(function(data)
{
//..
});
}
};
});
As you can see it calls php function updateColorItem.php
<?php namespace ProcessWire;
require_once '../index.php';
$drop_rect = $_GET["dropRect"];
$item_color = $_GET["color"];
$target = $_GET["target"];
$color_items = wire('pages')->get('/color_items_desktop/')->children();
$newIndex = count($color_items)+1;
$p = new Page();
$p->template = 'color_item';
$p->parent = wire('pages')->get('/color_items_desktop/');
$p->title = 'colorItem'.$newIndex;
$p->save();
$p->desktop_drop_rect = $drop_rect; // TODO: das muss es auch für tablet und mobile geben
$p->color = $item_color;
$p->save();
echo $p->id;
So this all works fine! But i what i want to achieve is this:
$targetPage = "color_items_".$target;
$color_items = wire('pages')->get($targetPage)->children();
And this is not working?
Look behind the scene (whit the working code) http://devbureau.de/video/
Cheers Simon
PS: Yes all GET vars are coming - and i dont sanitize atm - because it's for one singe user/client ... he wont try to kill his system .)
PPS: This is a visual grid editor (backend) for the front end
First Image is the frontend - secon grid editor