Home  Extras  MODx Add-Ons  automaticTpl

automaticTpl



Votes: 2
Tags: Administration, plugin, manager
Submitted: Jun 22, 2009
Released: Jun 25, 2009
Downloads: 6
License: GPLv3


automaticTpl 0.5-final | Author: xpix

Works with the following Version(s): 0.9.6.3 | Evolution-1.0.0

Documents are automatically created with the template specified in the parent document. You can specify the default template for children, grand children, grand grand children documents and more. Children will inherit the template specified in the automaticTpl TV of the parent. If no valid Template ID is found Inherit Template Plugin will kick in(if installed)


Download


Description

Specify in the parent container, the templates you want to use for your documents. Stop teaching your client what a template is :)

When a document is created you can specify what template it has to use.

Instructions

Installation: 1) Create a new Template Variable with the following information: a) Variable Name: automaticTpl b) Caption: Eg: Comma separated list of template ids c) Description: Eg: Children will be created using the specified template IDs. Each template Id represents a level d) Input Type: Text e) Input Option Values: Empty f) Default Value: Empty g) Widget: Don't change, leave blank. h) Sort Order: Don't change unless desired. i) Template Access: Select which templates should use this TV. The children of the documents using this template will be created with the template specified in step 1.b. j) Access Permissions: It's up to you what users will have access to change this TV. You will need to set up documents groups and permissions 3) Take note of the id of the automaticTpl Template Variable from either the Template Variable Resource List or from your database table modx_site_tmplvars. 4) Create a new plugin with the following information: a) Plugin Name: automaticTpl b) Description: Sets the default template when a children is created. c) Plugin Disabled: Leave Unchecked d) Plugin code (php): Copy & paste the code from the automaticTpl.php file that you downloaded. 5) Go into the System Events tab and find OnDocFormPrerender and check it on. 6) Go into the Configuration tab and paste the following code: &automaticTplTvID=automaticTpl TV ID;text; 7) Click anywhere outside the textbox, this will dynamically generate a new parameter field. 8) Input the ID of the Template Variable you took note of before. 9) Save the plugin 10) Go back to the main Plugins Resource List page and click on 'Edit Plugin Execution Order by Event'. Ensure that 'automaticTpl' is sorted BELOW 'Inherit Parent Template'. If not, change it to be so. Testing: 1) Edit a document that has a template with the TV 'automaticTpl' asociated to it 2) Inside automaticTpl TV insert the id of the template you want you children to be created by default Eg: 4 3) If you need to assign the default template for children on more levels put a comma separated list Eg: 4,6,29 4) Save the document 5) Create a children for the above document. The "Uses template" field should be populated by default with the name of the template Id you entered. In our example: 4 6) Save your document. If you entered a comma separated list GO TO 7. Otherwise you're done 7) Create a children in for the children document created at step 5. 8) Create a children for the children document created at 5. The "Uses template" field should be populated by default with the name of the second template Id you entered. In our example: 6 9) And so on if you entered a longer list of IDs Advanced Usage: Refer to the example above. If the template id 6 has an automaticTpl TV with the value of 30 the children of the document using this template will be created using the template id 30 not 29. The plugin goes up the tree until it finds the first not empty automaticTpl. This way you can have more flexibility for multiple levels of documents




Sub-Packages



Previous Releases


0.4

Forums Support Thread Votes: 23
Tags: Administration, plugin, manager
Submitted: Oct 23, 2008
Released: Oct 23, 2008
Downloads: 348
License: GPL - GNU Public
Package Website


automaticTpl 0.4 | Author: xpix

Works with the following Version(s): 0.9.6

Automate the template of your documents. Now there is no need to worry about the template field.


Download


Description

Specify in the parent container, the templates you want to use for your documents. Stop teaching your client what a template is :)

When a document is created you can specify what template it has to use.

Instructions

- Create a TV named automaticTpl,
Input Type: Text
- Choose the templates you would use it for. When used give a coma separated list of templates id for your sub-containers/documents.
- Get the id of the TV from the modx_site_tmplvars

- Create a new plugin called automaticTpl and paste downloaded code.
Check the OnDocFormPrerender event.
Make sure this plugin is called after Inherit parent Template plugin.
- In the configuration section paste the following: &automaticTplTvID=automaticTpl TV ID;text;
Click outside the box for the parameters fields to appear.
Enter the id for the automaticTpl TV.Updates- removed php tags
- spell check



0.3

Forums Support Thread Votes: 13
Tags: Administration, plugin, manager
Submitted: Aug 13, 2008
Released: Aug 13, 2008
Downloads: 400
License: GPL - GNU Public
Package Website


automaticTpl 0.3 | Author: xpix

Works with the following Version(s): 0.9.6

Automate the template of your documents. Now there is no need to worry about the template field.


Download


Description

Specify in the parent container, the templates you want to use for your documents. Stop teaching your client what a template is :)

When a document is created you can specify what template it has to use.

Instructions

- Create a TV named automaticTpl,
Input Type: Text
- Choose the templates you would use it for. When used give a coma separated list of templates id for your sub-containers/documents
- Get the id of the TV from the modx_site_tmplvars

- Create a new plugin called automaticTpl and paste this code
Check the OnDocFormPrerender event
Make sure this plugin is called after Inherit parent Template plugin
- In the configuration section paste the following: &automaticTplTvID=automaticTpl TV ID;text;
click outside the box for the parameters fields to appear
enter the id for the automaticTpl TV




Comments

Please login to comment.

Close ]


 
 
 

Contact Us | Team Blog | FAQ | Site Credits

© 2005-2009 the MODx CMS project. All rights reserved. Privacy Policy | Terms of Service