Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: edit template files in an external text editor?
chmod-ing the directory one time should do it. No?
Offline
Re: edit template files in an external text editor?
Hi – I found this tip at hicksdesign
This seems to be an ideal solution as it works in auto loading any changes made to the external files.
I am assuming that this will work for all files: Forms, Pages, Style?
Jon Hicks cautions that this was only tried with version 4.3.0.
…. texted postive
Offline
#18 2011-01-03 09:19:07
- Dimitri
- Member

- From: Johannesburg
- Registered: 2010-10-31
- Posts: 129
Re: edit template files in an external text editor?
bici wrote:
Hi – I found this tip at hicksdesign
This seems to be an ideal solution as it works in auto loading any changes made to the external files.
I am assuming that this will work for all files: Forms, Pages, Style?
Jon Hicks cautions that this was only tried with version 4.3.0.
Hi, do you mean John Hicks only tried with 4.2 :)
Check my early post
<txp:way_too_cool />
Offline
Re: edit template files in an external text editor?
Jon Hick’s method is outlined on TXP Tips, and there was a subsequent follow up by Steffan Willams titled Static Textpattern Forms and Pages.
Might be helpful for you.
Offline
Re: edit template files in an external text editor?
Dimitri wrote:
bici wrote:
Hi – I found this tip at hicksdesign
This seems to be an ideal solution as it works in auto loading any changes made to the external files.
I am assuming that this will work for all files: Forms, Pages, Style?
Jon Hicks cautions that this was only tried with version 4.3.0.
Hi, do you mean John Hicks only tried with 4.2 :)
Check my early post
yes my mistake. He tried it with 4.2.0 only. But i used his method with 4.3.0 and the one Page i tried it with was working fine.
…. texted postive
Offline
Re: edit template files in an external text editor?
I don’t see many advantages and quite a few drawbacks to editing your Pages, Forms and Styles external to the Textpattern admin area. What we should work towards is to make editing our templates easier via the admin area. Larger textareas comes to mind, which I’ve done on my local install that I use for creating templates.
Keep in mind that most of my template code resides in forms, my pages are pretty static and small. So having access to form snippets in a text editor does me no good. About the only thing that a text editor would benefit me would be when I’m working on the style, but even then I can have a syntax highlighting text editor open along side my browser if I need to see nicely colored code.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
Re: edit template files in an external text editor?
hcgtv wrote:
I don’t see many advantages and quite a few drawbacks to editing your Pages, Forms and Styles external to the Textpattern admin area. What we should work towards is to make editing our templates easier via the admin area. Larger textareas comes to mind, which I’ve done on my local install that I use for creating templates.
Keep in mind that most of my template code resides in forms, my pages are pretty static and small. So having access to form snippets in a text editor does me no good. About the only thing that a text editor would benefit me would be when I’m working on the style, but even then I can have a syntax highlighting text editor open along side my browser if I need to see nicely colored code.
ME:
Well i agree that working natively would be the most elegant solution. I don’t know if this is possible, but could one have a Preferences Setting to access to the Forms/Pages as external files?
As for CSS, that is easy enough to set up as an external file and I have easily done that on every site I work on. In addition I store all my css/layout images outside the DB in an /assets/images/ directory.
Being able to load all the FORMS/PAGES files for editing via Coda/Espresso would be a huge productivity gain.
cheers
…. texted postive
Offline
Re: edit template files in an external text editor?
I use a text editor pretty exclusively for my Textpattern code, and cnk_versioning does the job for me. I’m ignorant of the drawbacks, but there are quite a few advantages for me: Say you edit your templates in TXP. After you save the files to view the changes, there’s no simple way to “Undo” and roll back to your previous version. Using cnk_versioning, you can edit a template file, save, reload the page in your browser to view the changes; if you don’t like it, you can go back to your text editor and use it’s “Undo/Redo” history to go back to an earlier rendition. Furthermore, you can keep your templates under version control, using whatever system you prefer, from something as simple as Dropbox to something as robust as Mercurial or Git.
I know it’s possible to modify Textpattern so that it can keep a version history of your articles and templates, but I can’t imagine a core solution that would be as flexible as cnk_versioning.
And since you don’t have to install or run cnk_versioning, you’re free to use Textpattern’s admin area if that’s your preference. What am I missing?
Offline
Re: edit template files in an external text editor?
johnstephens wrote:
I use a text editor pretty exclusively for my Textpattern code, and cnk_versioning does the job for me. I’m ignorant of the drawbacks, but there are quite a few advantages for me: Say you edit your templates in TXP. After you save the files to view the changes, there’s no simple way to “Undo” and roll back to your previous version. Using cnk_versioning, you can edit a template file, save, reload the page in your browser to view the changes; if you don’t like it, you can go back to your text editor and use it’s “Undo/Redo” history to go back to an earlier rendition. Furthermore, you can keep your templates under version control, using whatever system you prefer, from something as simple as Dropbox to something as robust as Mercurial or Git.
I know it’s possible to modify Textpattern so that it can keep a version history of your articles and templates, but I can’t imagine a core solution that would be as flexible as cnk_versioning.
And since you don’t have to install or run cnk_versioning, you’re free to use Textpattern’s admin area if that’s your preference. What am I missing?
ME: @John Well one major question/fear is this warning that comes with cnk: “Please use this with care! Your pages/forms/css will be deleted from the database, when you delete the corresponding files”
Have you had any issues with deleted files? The way you have described your work flow does make me want to try that as it seems to give me what i want: editing via textmate.
…. texted postive
Offline
Re: edit template files in an external text editor?
johnstephens wrote:
And since you don’t have to install or run cnk_versioning, you’re free to use Textpattern’s admin area if that’s your preference. What am I missing?
You could also try out rah_post_versions if you want keep track of changes.
Personally, whenever I launch a new site or decide to make major changes to an existing site, I do it locally. On my local install, the Textpattern admin is plenty fast for my needs. About the only time I enlist a text editor is when I’m converting an existing XHTML design into Textpattern.
I know we all work differently, but having multiple tabs open in Firefox is just the same to me as having multiple tabs opened up in Notepad++ or any other text editor.
Like I said before, I’d like to see the admin area enhanced to facilitate template creation or maintenance. We all have larger monitors these days and with a few tweaks here and there, the admin can be a better place for all of us to hang out in.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
Re: edit template files in an external text editor?
Have you had any issues with deleted files? The way you have described your work flow does make me want to try that as it seems to give me what i want: editing via textmate.
No, I haven’t, but it was confusing the first time I installed and enabled cnk_versioning. It’s always wise to back up your database before doing stuff.
I recommend creating your template directory first, and the enclosed css, forms, and pages directories, and making sure that the permissions on those directories are correct. Then you can install and edit cnk_versioning to include the path to your templates directory. After that, activate the plugin and go to the “Versioning” tab under “Presentation”. You will need to “Install” the database table used to track the versions, then write out the current template files. To import changes to the templates, just change your site’s “Production Status” to “Testing” or “Debugging” and reload any public page on the site.
If anything goes wrong, just restore your database backup, but I’ve never lost anything. If you’re still anxious about it, you can do a trial run on a clean Textpattern install. Once you’ve set it up once or twice, it goes pretty smoothly.
Last edited by johnstephens (2011-01-03 21:33:10)
Offline
Re: edit template files in an external text editor?
johnstephens wrote:
No, I haven’t, but it was confusing the first time I installed and enabled cnk_versioning. It’s always wise to back up your database before doing stuff.
I recommend creating your template directory first, and the enclosedcss,forms, andpagesdirectories, and making sure that the permissions on those directories are correct. Then you can install and edit cnk_versioning to include the path to your templates directory. After that, activate the plugin and go to the “Versioning” tab under “Presentation”. You will need to “Install” the database table used to track the versions, then write out the current template files. To import changes to the templates, just change your site’s “Production Status” to “Testing” or “Debugging” and reload any public page on the site.
Thanks for this John. The way you have described the use of cnk makes good sense. As I backup by SQL DB on a monthly basis i don’t see much of a downside.
Will give it a go on my current development site on my local drive.
Last edited by bici (2011-01-03 23:51:11)
…. texted postive
Offline
Re: edit template files in an external text editor?
johnstephens wrote:
I recommend creating your template directory first, and the enclosed css, forms, and pages directories, and making sure that the permissions on those directories are correct.
I am trying it out. But where do change the CNK to point to the various directories in _Templates/Pages, _Templates/Forms ??
@ global $CNK_VER_OUTPUT_PATH, $CNK_VER_EXT, $CNK_VER_EXT_CSS;
$CNK_VER_OUTPUT_PATH = ‘’; //e.g. ‘textpattern/_templates/versioning/’
$CNK_VER_EXT = ‘txp’;
$CNK_VER_EXT_CSS = ‘css’;
@
…. texted postive
Offline
Re: edit template files in an external text editor?
bici wrote:
I am trying it out. But where do change the CNK to point to the various directories in _Templates/Pages, _Templates/Forms ??
Edit this line — just add your path between the single quotes after the equal sign:
$CNK_VER_OUTPUT_PATH = ''; //e.g. 'textpattern/_templates/versioning/'
Offline
Re: edit template files in an external text editor?
johnstephens wrote:
bici wrote:
I am trying it out. But where do change the CNK to point to the various directories in _Templates/Pages, _Templates/Forms ??
Edit this line — just add your path between the single quotes after the equal sign:
$CNK_VER_OUTPUT_PATH = ''; //e.g. 'textpattern/_templates/versioning/'
yes. that i was able to figure out. But i was wondering how to make the directories as you suggested :
“ and the enclosed css, forms, and pages directories “ and have it work by PAGE/FORMS??
…. texted postive
Offline