Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-11-18 16:02:37

typenerd
New Member
Registered: 2008-11-18
Posts: 5

edit template files in an external text editor?

Hi everyone,

I’ve been searching google, the forums and the handbook and I still can’t find out how to do this. How can I edit my page templates and CSS files in an external text editor? Is there a way to reference external files in the templates?

I found this plugin:
http://textpattern.org/plugins/595/mcw_templates

And it works OK, but it’s a pain to have to reimport templates all the time. Can’t I just reference an external file somehow? I’d like to be able to just keep my template code in a php file and when I hit save in my text editor the new code is being referenced on my site.

Thanks!
-dave

Last edited by typenerd (2008-11-18 16:09:05)

Offline

#2 2008-11-18 16:16:36

kemie
Plugin Author
From: mexico<-->sweden
Registered: 2004-05-20
Posts: 495
Website

Re: edit template files in an external text editor?

i’d recommend hcg_templates as a newer, better alternative, but it has the same mechanism for importing templates


~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~

Offline

#3 2008-11-18 16:24:55

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: edit template files in an external text editor?

cnk_versioning is the most consistently essential and useful Textpattern plugin.

I’ve worked with hcg_templates, but I prefer cnk_versioning because it automatically updates changes with each pageload when your installation isn’t in “live” mode.

Last edited by johnstephens (2008-11-18 16:27:22)

Offline

#4 2008-11-18 16:42:21

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: edit template files in an external text editor?

If it’s only about your preference to work in your own text editor: I’m using Firefox extension It’s all Text. You can choose your own editor, and don’t have to upload files.
There is also EditArea.

Offline

#5 2008-11-18 17:06:36

typenerd
New Member
Registered: 2008-11-18
Posts: 5

Re: edit template files in an external text editor?

Well my preference is to use bbedit or coda for all my editing. I’ve made files external for editing with Expression Engine before, but I’m not sure how to do it with TXP.

Any other ideas?

Offline

#6 2008-11-18 17:28:34

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: edit template files in an external text editor?

cnk_versioning and hcg_templates both allow you to export, edit in your own editor, and reimport text files. cnk_versioning is more automatic than hcg_templates— you can make changes in your text file, save, and see the results immediately with a page refresh in your browser. hcg_templates requires that you manually re-import the files using a tab under Extensions.

I use Textmate along with the Textpattern bundle and cnk_versioning. This allows me to keep my templates in version control and backups. But with either of these plugins, you can use any editor you want, including BBEdit or Coda.

Offline

#7 2008-11-18 17:57:39

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: edit template files in an external text editor?

typenerd wrote:

Any other ideas?

I’d say you have a look at the suggestions made here ;)

Offline

#8 2008-11-18 18:12:56

typenerd
New Member
Registered: 2008-11-18
Posts: 5

Re: edit template files in an external text editor?

cnk_versioning and hcg_templates are both good options for me, but I’m having some issues with my setup; the files both of these scripts write aren’t editable by my user account, so I’m not sure what to do about that.

Offline

#9 2008-11-19 10:43:32

kemie
Plugin Author
From: mexico<-->sweden
Registered: 2004-05-20
Posts: 495
Website

Re: edit template files in an external text editor?

oooh, i always thought that cnk_versioning was for versioning articles, so i never quite took a good look at it. I’ll have to download/install now!


~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~

Offline

#10 2008-11-19 16:19:49

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: edit template files in an external text editor?

typenerd wrote:

… the files both of these scripts write aren’t editable by my user account, so I’m not sure what to do about that.

I’m not sure what you mean. It sounds like you successfully installed and activated the plugins and created the directory for your templates. In cnk_versioning, did you verify that the templates directory you created is named correctly by the plugin? This is accomplished by Editing the plugin in the Plugins tab:

Look for this line:

$CNK_VER_OUTPUT_PATH = 'your/templates'; //e.g. 'textpattern/_templates/versioning/'

You want to replace your/templates with the path to your templates directory, relative to your site_url; make sure you include a trailing slash, but do not include a leading slash.

You also need to make sure that the templates directory is writable by the server by changing the file permissions. Most FTP programs can do this, but the easiest way is to use the shell if you have access. Did you do this already too? Without this step, cnk_versioning won’t generate any files. Is that what you mean by “the files both of these scripts write aren’t editable by my user account”?

Offline

#11 2008-11-19 16:37:28

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: edit template files in an external text editor?

If the files created by the plugin are not writeable by you you should check with your host.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#12 2008-11-19 16:40:27

typenerd
New Member
Registered: 2008-11-18
Posts: 5

Re: edit template files in an external text editor?

Hi John,

Well the files are written just fine, directories are created OK. I just can’t open them via sftp because I don’t have write permission to them. I’m assuming the user that PHP/apache is running is in a different group than my user account, so I don’t have write permission on these files. I’m not sure how to fix that… any ideas?

Thanks for the help,

-dave

Offline

Board footer

Powered by FluxBB