Content last modified Tuesday 2 August 2016
hop to #bottom
Categories:
Author:
Stanislav Müller
Current version:
0.3
About It:
Get it:
Rate it:
  • Helpful?
  • 6 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

stm_javascript

Stores JavaScript files within the database and handles them similar to CSS files.

In admin section, go to tab “presentation > javascript” and create one ore more javascript files that you want to embed within your page templates. This is similiar to the “styles” tab – the JavaScript files get stored in the database and you can embed them with a new Textpattern tag:

<txp:js /> (embeds default JavaScript file)
<txp:js n="myDomScript" /> (embeds JavaScript file named "myDomScript")

Output:
<script type="text/javascript" src="http://mysite.com/?js=myDomScript"></script>

PS: if you have got some bugs, just drop me a mail

Article Request Count:
Keywords/tags:
Initially released:
30.11.2006
Posted here:
30 Nov 2006
Article modified:
27 May 2010

Comments/questions? Leave a message in the form.

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (22)

mrdale:

Great news Exactly what I’ve wanted for quite some time

Thank You.

doens’t work for me — using it on txp 4.0.4, and all it does is cause a bunch of PHP parse errors on the presentation > javascript page. My only other plug-in is a captcha one.

I tested it as well, unfortunately it’s not working in version 4.0.4

Any chance someone can update this to work? It seems like a rather gaping hole in the textpattern system, and I’d love to start updating my sites with better JS support.

Download link is broken. I just get a blank file.

Nick:

Seems to work fine for me in 4.0.4 – great plugin.

Download link doesn’t work!

i have a problem with this one too… The site resides in a sub directory and the plugin’s output is:
site.com/sd?js=tabmenujs
as oposed to
site.com/sd/?js=tabmenujs
the first does not fetch the js file…

@colak: change the url in the plugin’s source;
hacking isn’t bad ;)

This is just waht i wanted

@Stanislav Müller
I’ve edited the plugin. Only mentioned it here to alert the developer and other users re this.

Nick:

Most bizarre – after posting above that I had no problems installing on one site (with about twenty existing plugins), I’ve now tried to install it on an almost vanilla 4.0.4 installation, and I’ve got the parse errors mentioned earlier:

Warning: Table ‘photohst_one.txp_txp_js’ doesn’t exist select count(*) from txp_txp_js as txp_js where name=‘default’ in /data01/photohst/public_html/textpattern/lib/txplib_db.php on line 84

@Nick
there is problem with this plugin when you use db prefix, change the name of table and everything will be ok

updated to version 0.2. Prefix bug is fixed i think?!

excelent time of reaction :)
it seems, that everything work fine now, even with prefixes.

The functions inside this plugin should be prefixed with the plugin author prefix to avoid namespace conflicts (js -> stm_js).

@Ruud van Melick: why do think so?

Seb:

Does this plugin work with version 4.0.6?

If so, why don’t I see the new tab “Javascript” when I select “Presentation” in the admin area?

Matt Lockwood:

I don’t see the Javascript tab either. Is there something else to install?

Jim:

Yeah, I don’t see a “Javascript” tab in 4.0.6 either.

@all, sorry for waiting. Bug is fixed now and tested with version 4.0.6.

- Best

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

Would you care to write a comment?

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.