Page Type Switcher

Developer

Laisvunas

3rd Party (Commercial)
Current Version: 1.2

License Agreement

Buy Now!

$15.00
Qty:

EE Version Support

  • ExpressionEngine 1.x
  • ExpressionEngine 2

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

  • Updater
  • Multi Site Manager
  • Stand Alone Entry Form
  • Low Variables
  • Content Elements
  • Better Workflow
  • Matrix
  • Grid
  • Webservice
  • Publisher

Requirements

  • jQuery for the Control Panel

Add-On Type(s)

Fieldtype

Tags

A dropdown fieldtype displaying list of page types; selecting different page type shows/hides relevant fields. Compatible with SAEF (EE1.x) and Safecracker (EE2 plus).

Installation (for EE2 plus)

1) copy the folder "page_type_switcher" into /sytem/expressionengine/third_party on the server.

2) go Control Panel Home > Add-ond > Fieldtypes, find Page Type Switcher in the list and click "Install".

3) go CP Home >  Admin >  Channel Administration >  Field Groups >  Custom Fields and create new field of the type "Page Type Switcher".

4) go Control Panel Home > Add-ond > Fieldtypes, click "Page Type Switcher" link in the list, find relevant field group and enter names of page types and assign fields to them by checking relevant checkboxes.
By default you can define up to 7 page types. If you need more of them, change the value of the “Max number of page types” on the top of the form.

Installation (for EE1.x)

1) copy the folder "page_type_switcher" into /sytem/extensions/fieldtypes on the server.

2) copy the file "lang.page_type_switcher.php" into /sytem/language/english on the server.

3) go Control Panel Home > Admin >  Utilities >  Extensions Manager >  FieldFrame and enable Page Type Switcher.

4) go CP Home >  Admin >  Weblog Administration >  Field Groups >  Custom Fields and create new field of the type "Page Type Switcher".

5) go Control Panel Home > Admin >  Utilities >  Extensions Manager >  FieldFrame, Find Page Type Switcher, click "Show", find relevant field group and enter names of page types and assign fields to them by checking relevant checkboxes. By default you can define up to 7 page types. If you need more of them, change the value of the “Max number of page types” on the top of the form.

 

Usage

{exp:channel:entries}

{if my_page_type_switcher_field == "Default"}

Some code

{if:elseif my_page_type_switcher_field == "Images"}

Some other code

{if:elseif my_page_type_switcher_field == "Video"}

Yet another code

{/if}

{/exp:channel:entries}

Using Page Type Switcher with Safecracker

To use Page Type Switcher with Safecracker you should wrap all custom fields with div element having attribute id="publish" and wrap each custom field with div element having attribute class="publish_field".  The latter div elements also should have attributes as this:  id="hold_field_1571". The relevant field in number you can easily find in the Control Panel using such browser add-on as Firebug. Here is an example:

{exp:safecracker channel="technical" entry_id="3897" return="technical/test"}
<div id="publish">

<p>Title<br />
<input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" onkeyup="liveUrlTitle();" /></p>

<p>URL Title<br />
<input type="text" name="url_title" id='url_title' value="{url_title}" maxlength="75" size="50" /></p>

<div id="hold_field_1973" class="publish_field">
<p>Page types<br />
{field:technical_page_types}
</div>

<div id="hold_field_1963" class="publish_field">
<p>File<br />
{field:safe_cracker_file}
</div>

<div id="hold_field_1967" class="publish_field">
<p>Pictures</p>
{field:matrix}
</div>

<div id="hold_field_1571" class="publish_field">
<p>Article<br />
{field:article}
</div>

<p><input type="submit" name="submit" value="Submit" />

</div>
{/exp:safecracker}

Using Page Type Switcher with SAEF

To use Page Type Switcher with SAEF you should wrap all custom fields with div element having attributes as this: id="field_pane_on_2035". The relevant field in number you can easily find in the Control Panel using such browser add-on as Firebug. Eadch such div element should in his turn be wrapper with another viv element having attribute class="publishRows". Here is an example:


{exp:weblog:entry_form weblog="technical" return="technical/test"} 

<p>Title<br />
<input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" onkeyup="liveUrlTitle();" /></p>

<p>URL Title<br />
<input type="text" name="url_title" id='url_title' value="{url_title}" maxlength="75" size="50" /></p>

<div class="publishRows">
<div id="field_pane_on_2035">
<p>Page type</p>
{page_type_technical}
</div>
</div>

<div class="publishRows">
<div id="field_pane_on_1975">
<p>Subdir Upload</p>
{subdir_upload}
</div>
</div>

<div class="publishRows">
<div id="field_pane_on_1973">
<p>Pictures</p>
{matrix}
</div>
</div>

<div class="publishRows">
<div id="field_pane_on_1571">
<p>Article</p>
{custom_fields}
{if textarea}
<textarea name="{field_name}" dir="{text_direction}" cols="50" rows="{rows}" onclick="setFieldName(this.name)">{field_data}</textarea>
{/if}
{/custom_fields}
</div>
</div>

<p><input type="submit" name="submit" value="Submit" />
<input type="submit" name="preview" value="Preview" /></p>

{/exp:weblog:entry_form}

This entry was created April 29, 2011, 12:37 pm.
This entry was last updated October 17, 2011, 7:38 am.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.

1 Review:

DCalabrese 10.19.11

Rating - {addon_rating_average}

Terrific in every way for giving lots of easy highly customized preset choices, so you can focus on content.  Laisvunas is the best for support.

Chris