Skip to content

frwssr/frwssr_clonepage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FEUERWASSER ClonePage (frwssr_clonepage)

Field type to clone a (somewhat standard) page and its contents in PerchCMS.

Installation

  1. Download zip archive and extract locally.
  2. Create a frwssr_clonepage folder in the /perch/addons/fieldtypes/ folder of your perch install.
  3. Copy the files frwssr_clonepage.class.php, index.php, and init.js to the /perch/addons/fieldtypes/frwssr_clonepage folder.

Usage

In a Perch attributes template (e.g. perch/templates/pages/attributes/seo.html), you can use this field type as follows:

<perch:pages id="clone" type="frwssr_clonepage" suppress>

Attributes

  • buttontext - Customize the text on the button. Defaults to “✌️ Clone page ⚠️” (—the emoji trying to signify the danger zone character of the button.)
  • buttonbg - Customize the styling of the button. Defaults to background: slategray. You might get fancy with something like buttonbg="background: linear-gradient(to top right, teal, tomato); float: right;", too. Impress your Perch users!
  • renamepostfix - Customize the text appended to the Page title and the Navigation text. Defaults to “ (Copy)”. A slugified version of the renamepostfix will be appended to the clone’s filename, too.

Example

<perch:pages id="clone" type="frwssr_clonepage" buttontext="Make a copy of this awesome page" buttonbg="background: linear-gradient(to top right, teal, tomato); float: right;" renamepostfix="—copy" suppress>

Notes

  • Use suppress on the frwssr_clonepage field to make sure it doesn’t show up in your website.
  • The clone will be placed in the same folder as the original file.
  • The clone will be hidden from the main navigation and will not be associated with any navigation groups, to prevent it from showing up in the wrong place.
  • The filename will be a product of the original page’s filename and a (predefined or custom) postfix. To keep URLs clean, you will have to use the standard processes in Perch to rename and move the file.
  • If you are creating a slug in any of the content items, the slug field in the cloned page’s item will hold the exact same value as the original. You need to update that manually. (Unfortunately, there is no way to automate this.)
  • Cloning pages will work best on pages, utilising a generic master page with region names like banner, contents, and such. Otherwise you might end up with multiple pages holding a region called news, for instance.
  • This fieldtype was developed under Perch (Standard) Version 3.1.7 on a server running PHP 7.4.x.
  • Also tested under Perch Runway 4.5 on a server running PHP 8.0.26.
    Use at own risk!

License

This project is free, open source, and GPL friendly. You can use it for commercial projects, for open source projects, or for almost whatever you want, really.

Donations

This is free software, but it took some time to develop. If you use it, please let me know—I live off of positive feedback…and chocolate. If you appreciate the fieldtype and use it regularly, feel free to buy me some sweets.

Issues

Create a GitHub Issue: https://github.com/frwssr/frwssr_clonepage/issues or better yet become a contributor.

Developer: Nils Mielke ([email protected], @nilsmielke (on Mastodon)) of FEUERWASSER

About

Field type to clone a (somewhat standard) page in [PerchCMS](https://grabaperch.com/).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published