Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-09-24 12:19:57

developr
Plugin Author
From: Basel
Registered: 2011-09-24
Posts: 65
Website

Where should external plugin resources be stored?

Hello Textpattern Community!

This is my first post here. I started working with Textpattern in july 2011 and i love it very much!

Currently, i am writing some plugins wich are based on a self-made standalone web gallery.

Now, i have a question: Some of these plugins use external resources (css, js, swf, php). For now, i place these files into a directory with the name of the plugin within the “plugin_cache_dir” (e.g. /plugins/xyz_plugin).

Is that the right place to store external resources used by plugins?

Thanks in advance!

Offline

#2 2011-09-24 22:17:50

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Where should external plugin resources be stored?

developr wrote:

Is that the right place to store external resources used by plugins?

That is not an ideal location. Pretty much anything else than the plugin cache directory works. Just do not place external plugin resources to plugin_cache_dir (in any case at least not to root) or tmp directory.

Placing something unnecessary to plugin_cache_dir will just marginally slow Textpattern. Plugin cache dir is looked for plugins (i.e. *.php files). The more items the directory has, the longer the look up operation will take.

Offline

#3 2011-09-24 22:53:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: Where should external plugin resources be stored?

I concur with Gocom: avoid the plugin cache dir for everything except the plugins themselves.

I tend to lump external scripts at site root:

/css
  |-> shadowbox
        |-> [shadowbox css files]
  |-> cycle
        |-> [cycle css files]
/js
  |-> shadowbox
        |-> [shadowbox js files]
...

Since I use the rvm_css plugin for serving stylesheets I already have a /css dir set up with all my site’s stylesheets in it so to have additional subdirs off that for third party scripts fits my workflow. You can of course lay it out however suits.

Last edited by Bloke (2011-09-24 22:53:53)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2011-09-26 17:38:32

developr
Plugin Author
From: Basel
Registered: 2011-09-24
Posts: 65
Website

Re: Where should external plugin resources be stored?

Thanks for this clear answers! Good to know.

I will change storage locations and use a structure like te one proposed by Bloke.

Offline

#5 2011-09-26 23:08:34

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Where should external plugin resources be stored?

Placing something unnecessary to plugin_cache_dir will just marginally slow Textpattern. Plugin cache dir is looked for plugins (i.e. *.php files). The more items the directory has, the longer the look up operation will take.

Ah, good to know, thanks.
I’ve a few folders inside the /admin/plugins/ folder, and also a README file. Now that I know, I’ll move the plugins (the .php files) to a subfolder.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB