Jozsef Posted June 23, 2016 Share Posted June 23, 2016 Normally I output some fields with fallback values as follows (with Headline field filled in in this case): $content .= "<h1>$page->get('headline|title')</h1>; How would you approach front page editing in the template for this (B/C/D method)? $content .= "<h1>$page->edit('headline|title')</h1>"; results in the Headline outputted but editing doesn't work. $content .= "<edit title>"; $content .= "<h1>{$page->get('headline|title')}</h1>"; $content .= "</edit>"; Results in the Headline outputted but double click will edit the Title field instead. Has anyone succeeded this way? Link to comment Share on other sites More sharing options...
Robin S Posted June 24, 2016 Share Posted June 24, 2016 I don't have much experience with the PW3 front-end editing features, but this seems to work: <?php $heading_field = $page->headline ? 'headline' : 'title'; $content .= "<h1>$page->edit($heading_field)</h1>"; Link to comment Share on other sites More sharing options...
flydev Posted June 24, 2016 Share Posted June 24, 2016 For reference there is a nice blog post about it : https://processwire.com/blog/posts/front-end-editing-now-in-processwire-3.0-alpha-4/ Link to comment Share on other sites More sharing options...
Jozsef Posted June 24, 2016 Author Share Posted June 24, 2016 Thanks for the quick help. I was hoping that there was a built in method but a workaround like that will be the answer then. I read the blog, it explains a lot of situations but this. Link to comment Share on other sites More sharing options...
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