-
- 571 Posts
Quote from: donshakespeare at Apr 11, 2018, 08:19 PMYup it is as simple as what they have on their official site.
If you want any of my speciality TinyMCE plugins, they are available on your server when you installed TinymceWrapper.
<script src="https://cloud.tinymce.com/stable/tinymce.min.js"></script>
<script>tinymce.init({ selector:'textarea' });</script>
<textarea>Next, start a free trial!</textarea>
As my requirements were minimal (just bold, italic, insert url and create bulleted list) I downloaded the community edition of Tiny MCE and used it using their examples. Thank you for pointing out how simple this actually was!
When I need more functionality and integration with MODX I will use tinymceWrapper.
-
- 24,544 Posts
You don't use fopen() or fclose() with file_put_contents(). It's probably not working because the file is locked by fopen().
file_put_contents() is identical to calling fopen(), fwrite() and fclose() successively to write data to a file.
Try this:
if (!file_exists($readmeFile)) {
if (file_put_contents($readmeFile, $content) == false) {
return 'Failed to write to file ' . $readmeFile;
}
}
You don't need the file_exists test unless you want to avoid overwriting the file. file_put_contents() will create it if it doesn't exist, and overwrite it if it does, unless you send FILE_APPEND as a third argument.
-
- 708 Posts
Thank you, Bob. Works a treat.
I changed $content to $content='My custom message here...' which seems to work fine.
Is that the correct syntax or is there a better way?
Also, I noticed when I update the message (in the Chunk) the file in RFM is not updated. It must be deleted from RFM and when regenerated the update then appears.
[ed. note: todd.b last edited this post 6 years, 1 month ago.]
Todd
-
- 24,544 Posts
If you're using the literal string, you don't need the $content variable:
if (file_put_contents($readmeFile, 'My custom message here...' ) == false) {
If the actual message is longer, you might want to put it in a chunk and do this:
if (file_put_contents($readmeFile, $modx->getChunk('MyCustomMessage') ) == false) {
-
- 708 Posts
Oh yeah, a Chunk would be better. Thanks for the suggestion.
Though I wish the README file would update when changes are made to its Chunk.
Todd
-
- 708 Posts
Has anyone tried manually updating TW Responsive Filemanager? I'm guessing it's not a simple drop-in replacement.
Todd
-
- 24,544 Posts
@donshakespeare: I notice that TinyMCEWrapper does not show up when you search the MODX extras repo, or Downloads in Package Manager for "richtext" or "rich text". You might want to work those into the description.