Recent Topics

Tapping into events to custom admin and display page

Started by on Mar 06, 2008 – Contents updated: Mar 06, 2008

Mar 06, 2008 17:16    

Howdy all...

Two questions. One, is there an easy way to tap into the "Text Renderers" area of the admin? I want to add another checkbox, that if checked, will always add an element(s) to the post.

Two, is there an event that I can hook into after the tags are displayed? i.e., are the tags a plugin that I just missed? It would be really useful to have a "post display" hook that the tags and comments and such hooked into so you could add stuff that looked natural at that point.

-T

Mar 06, 2008 17:57

In your plugin:

	var $apply_rendering = 'opt-in';

will give you a checkable checkbox that, when checked, will do whatever you have the RenderItemAsHtml hook tell it to do. For multiple thingies you would probably want a way to pick which thingie gets added by enjoying the AdminDisplayToolbar hook yah? Also depending on what you're adding, just using AdminDisplayToolbar would probably be enough.

No that's not right. No toolbar because that ... would ... people could place the thingie anywhere, but that's not really right. Your RenderItemAsHtml could easily say "if you see this bit anywhere in the post remove it from whereever it is and add this stuff to the very end of the content".

Tags are one of those "peripheral" bits like author and date and cats. Not a plugin, and typically treated outside the actual post content, but I suppose one could make a plugin that snaggles the tags and does something with them inside post_content. I mean, if one was smart and had a notion to do something like that. I gave up on tags after figuring out how to make my skin say "this post is untagged" if/when I opt to not use them.

Mar 06, 2008 18:04

EdB wrote:

... snip ... Your RenderItemAsHtml could easily say "if you see this bit anywhere in the post remove it from whereever it is and add this stuff to the very end of the content".

Yeah, that's what I've got, but I didn't want to have to add "[dzone]" to every post that I wanted to have the dzone widget on it. I was thinking a checkbox would be much more suitable in this instance.

I did try "opt-out" as means of putting it on all of the time (the way smilies are), but that didn't seem to do the trick.

Mar 06, 2008 18:17

try "always" if you want to add it to old posts ( or even stealth ), also look into DisplayItemAsHtml .... all the hooks are in /inc/plugins/model/_plugins_admin.class.php or summat

¥

Mar 06, 2008 18:20

Does it not work without adding something to the post content for it to render? I never tried it but I was thinking something like

/* Somebody's gotta do some actual work around here! */
function RenderItemAsHtml( & $params ) {
	$content = & $params['data'];
	$content .= ' I wonder what a dzone is?';
	return true;
	}

hmmm... I need to look at smilies again. no: didn't help me. I have a plugin that intermittently and randomly after an unknowable amount of time decides to not render.

Anyway back on track: assuming you can add something without having something in the post to replace then the next thing is to make a couple of iterations of the plugin so you get multiple checkboxes. That way nothing goes in the post and all the bits are accessible from the back office.


Form is loading...

Run your own website! – This forum is powered by b2evolution CMS, a complete engine for your website.