Tom Walcher Posted October 12, 2016 Posted October 12, 2016 It seams not to work, when i use $page->edit(headline) in a template which i call per $found->render("template.php"). so the field i call with that template are not editable. What i do wrong, should i use the <edit> or D ? thx, tom
Tom Walcher Posted October 13, 2016 Author Posted October 13, 2016 I tryed foreach($modules->children as $module) { $filename = dirname(__FILE__) . "/".$module->template; $t = new TemplateFile($filename); $t->set('page', $module); echo $t->render(); } but still no editor. I think it does know the template, or because its a repeater, just new with this.
Robin S Posted October 15, 2016 Posted October 15, 2016 Front-end editing works okay for me when using $page->render(). If you are using "Option A" for front-end editing make sure you have selected "Fields editable regardless of page". But a couple of observations: 1. Do you really need to be rendering pages? Can you not just get your pages into a PageArray and iterate over them, echoing the fields you want? $items = $pages->find("template=my_template"); foreach($items as $item) { echo "<h3>$item->title</h3>"; echo $item->body; // etc } If you're sure you need to render you might be better off using $files->render() as it is better documented than $page->render(). 2. In your code... On 14/10/2016 at 4:10 AM, Tom Walcher said: foreach($modules->children as $module) { $filename = dirname(__FILE__) . "/".$module->template; $t = new TemplateFile($filename); $t->set('page', $module); echo $t->render(); } ...you are overwriting the core API $modules variable. You should choose a different name for your variable. 1
Tom Walcher Posted October 20, 2016 Author Posted October 20, 2016 Thx, it works with regardless and Option B, fields of course editable for field for inline … Thx a lot, great tool, this processwire!!! yeah, modules are not a good variable! Danke, tom
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now