Textpattern Forum

You are not logged in. Register | Login | Help

#11 2009-09-25 15:21:26

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

Re: soo_required_files: per-article loading of JavaScript and CSS files

candyman, I’ve had a few ideas about this. I’m considering adding two or three new attributes to expand the plugin’s scope:

  • page_files (boolean) — if true, look for css/js files with the same name as the current page (template)
  • section_files (boolean) — if true, look for css/js files with the same name as the current section

and maybe even:

  • category_files (boolean) — if true, look for css/js files with the same name as the current article categories

The plugin would do a file_exists() check in the default css and js directories (defaults as set in the plugin prefs), then output <link /> elements for existing files.

Is that the kind of thing you were thinking of?


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#12 2009-09-25 18:23:45

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 512

Re: soo_required_files: per-article loading of JavaScript and CSS files

I’ve a page that implement geoblogging: only the map, no articles in that page. It would be useful to load the GoogleMap script for this page only: from this my previous request.

In the meantime I’ve found the stm_javascript and jmd_admin_js plugins also.

Anyway if you can add these features it would be useful, I think.

Last edited by candyman (2009-09-25 18:25:47)

Offline

#13 2009-09-26 12:07:19

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

Re: soo_required_files: per-article loading of JavaScript and CSS files

Version 0.2 released

New features:

  • per-page and/or per-section file loading
  • use soo_required_files as a container tag containing additional files/forms to load
  • use the above in combination with per-article loading

Docs and downloads


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#14 2009-09-26 12:39:46

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 512

Re: soo_required_files: per-article loading of JavaScript and CSS files

Thanks Jeff!

If I’ve understood well with the per-section feature I can load only a specific script for section, can’t I?

Last edited by candyman (2009-09-26 16:21:58)

Offline

#15 2009-09-26 14:11:41

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

Re: soo_required_files: per-article loading of JavaScript and CSS files

Correct: only section.css and/or section.js (where “section” is the section name). However, if you wanted to load multiple files and/or forms for one section and that section shares a page with other sections you could do something like this:

<txp:soo_required_files>
	<txp:if_section name="this_section">
		this_file.js, that_file.js, this_form
	</txp:if_section>
</txp:soo_required_files>

Tag contents get loaded first, then per-page files, per-section files, finally per-article files/forms.


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#16 2009-10-04 11:00:56

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

Re: soo_required_files: per-article loading of JavaScript and CSS files

Version 0.2.1 released

Fixed per-page/section loading in sub-directory installations


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#17 2009-11-30 15:46:39

Sunfoot
Member
Registered: 2009-02-07
Posts: 6

Re: soo_required_files: per-article loading of JavaScript and CSS files

I have installed the soo_plugin_pref. But I have no access to the preferences, because there is no Options link showing up in the plugin list. I have never seen such an Option link there. What I have done wrong? If someone could give me a cue, I would be thankful.

Felix

Offline

#18 2010-07-11 14:51:32

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

Re: soo_required_files: per-article loading of JavaScript and CSS files

Sunfoot wrote:

I have installed the soo_plugin_pref. But I have no access to the preferences, because there is no Options link showing up in the plugin list. I have never seen such an Option link there. What I have done wrong? If someone could give me a cue, I would be thankful.

Sorry I missed this when it appeared. To see a plugin’s Options link the plugin must be activated, and you must be running Txp 4.2.0 or later.


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#19 2010-07-11 14:54:21

jsoo
Developer
From: NC, USA
Registered: 2004-11-15
Posts: 1,730
Website

Re: soo_required_files: per-article loading of JavaScript and CSS files

Version 0.2.2 now available.

Tag contents can now include other Txp tags, allowing e.g. Txp conditional tags for further automation options.

So you can add files to the soo_required_files loading queue based on category, custom fields, etc.

Last edited by jsoo (2010-07-11 14:55:01)


Txp tags not doing what you expect? Learn to use a tag trace. And the Tag Reference.

Offline

#20 2011-07-08 21:32:17

catnip
Member
From: Sydney Australia
Registered: 2006-07-29
Posts: 50
Website

Re: soo_required_files: per-article loading of JavaScript and CSS files

Jeff, can this plugin be used to load one of the styles in the Textpattern Styles tab, or only css files?

Offline

Board footer

Powered by FluxBB