Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-13 06:26:43

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

head-hook

Could something like inject_head($contents) be added to the core? The function would insert content before </head>. Normally plugins have to buffer and str_replace, but it’s tedious.

$contents = <<<EOD
<script type="text/javascript">
function jmdDoStuff(){}
</script>
<style type="text/css">
#jmd_plugin
{}
</style>
EOD;

inject_head($contents);

Offline

#2 2008-06-13 08:08:59

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

Re: head-hook

If it was there, I’d use it.


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

#3 2008-06-13 09:50:47

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: head-hook

What must be in head and cannot be inserted in body?
Would this be a generic hook for all admin pages or aimed at specific events / steps?

Offline

#4 2008-06-13 09:54:16

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: head-hook

Inserted CSS (either style or link elements). It works in the body, but I’d prefer not to invalidate TXP’s HTML.

Edit: It’d be great if it was like register_callback(), so it could be loaded on certain events and steps.

Last edited by jm (2008-06-13 09:59:12)

Offline

Board footer

Powered by FluxBB