Jump to content

Front page editing in 3.0: headline|title


Jozsef
 Share

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...