The following are examples to integrate your Structure site with Safecracker to have full creating and editing capabilities.
Creating A New Listing Entry
You can choose to make certain values editable or not, notes are listed inline below:
{exp:safecracker channel="your-listing-channel" return="/your-return-url"}
<!-- Place your template ID into the value below or allow it to be chosen using {exp:structure:saef_select type="template"} -->
<input type="hidden" name="structure_template_id" value="XXX" />
<!-- Place your parent entry ID into the value below or allow it to be chosen using {exp:structure:saef_select type="parent"} -->
<input type="hidden" name="structure_parent_id" value="XXX" />
<p>Title: <input type="text" name="title" id="title" value="{title}" /></p>
<!-- The field below is required. Please note when added as a hidden field we'll automatically generate the uri-->
<p>Structure URI: <input type="text" name="structure_uri" /></p>
<p><input type="submit" name="submit" value="Submit" /></p>
{/exp:safecracker}
Creating a New Page
You can choose to make certain values editable or not, notes are listed inline below:
{exp:safecracker channel="your-page-channel" return="/your-return-url"}
<p>Title: <input type="text" name="title" id="title" value="{title}" /></p>
<!-- You can also use a hidden value instead of the field below, so it is not editable: <input type="hidden" name="structure_template_id" value="XXX" /> -->
<p>Template: {exp:structure:saef_select type="template"}</p>
<!-- You can also use a hidden value instead of the field below, so it is not editable: <input type="hidden" name="structure_parent_id" value="XXX" /> -->
<p>Parent: {exp:structure:saef_select type="parent"}</p>
<!-- The field below is required. Please note when added as a hidden field we'll automatically generate the uri-->
<p>Structure URI: <input type="text" name="structure_uri" /></p>
<p><input type="submit" name="submit" value="Submit" /></p>
{/exp:safecracker}
Editing a Listing Entry
When editing entries, you can use existing segments or an addon like Freebie to create additional ones to feed into your safecracker tag below:
{exp:safecracker channel="your-listing-channel" entry_id="{some_segment}" return="/your-return-url"}
<input type="hidden" name="entry_id" value="{entry_id}" />
<p>Title: <input type="text" name="title" id="title" value="{title}" /></p>
<!-- You can also use a hidden value instead of the field below, so it is not editable: <input type="hidden" name="structure_template_id" value="XXX" /> -->
<p>Template: {exp:structure:saef_select type="template" entry_id="{entry_id}"}</p>
<!-- You can also use a hidden value instead of the field below, so it is not editable: <input type="hidden" name="structure_parent_id" value="XXX" /> -->
<p>Parent: {exp:structure:saef_select type="parent" entry_id="{entry_id}"}</p>
<p>Structure_uri: <input type="text" name="structure_uri" value="{structure:page_slug_for:{entry_id}}" /></p>
<p><input type="submit" name="submit" value="Submit" /></p>
{/exp:safecracker}
Editing a Page
When editing entries, you can use existing segments or an addon like Freebie to create additional ones to feed into your safecracker tag below:
{exp:safecracker channel="your-page-channel" entry_id="{some_segment}" return="/your-return-url"}
<input type="hidden" name="entry_id" value="{entry_id}" />
<p>Title: <input type="text" name="title" id="title" value="{title}" /></p>
<!-- You can also use a hidden value instead of the field below, so it is not editable: <input type="hidden" name="structure_template_id" value="XXX" /> -->
<p>Template: {exp:structure:saef_select type="template" entry_id="{entry_id}"}</p>
<!-- You can also use a hidden value instead of the field below, so it is not editable: <input type="hidden" name="structure_parent_id" value="XXX" /> -->
<p>Parent: {exp:structure:saef_select type="parent" entry_id="{entry_id}"}</p>
<p>Structure_uri: <input type="text" name="structure_uri" value="{structure:page_slug_for:{entry_id}}" /></p>
<p><input type="submit" name="submit" value="Submit" /></p>
{/exp:safecracker}