Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-08-07 08:44:14

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Theme standards question

Sorry if I’ve missed the answer to this one but here goes anyway…

Q: is there a standard for naming the page-top, page-body and page-footer containers that admin themes are meant to follow?

I’m asking because I’ve noticed that not all themes follow a convention for these areas and it raises issues for plugin compatibility with themes. For example, bot_image_upload works fine with some themes (classic) but not with others (din) and it would be great if plugin authors knew at least what the container IDs were for these elements so they could consistently target them across all themes.

Many thanks in advance for your replies!


Steve

Offline

#2 2011-08-07 13:19:53

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

Re: Theme standards question

net-carver wrote:

For example, bot_image_upload works fine with some themes (classic) but not with others (din) and it would be great if plugin authors knew at least what the container IDs were for these elements so they could consistently target them across all themes.

In case of bot_image_upload, the plugin could support all themes with any type of menu/header structure by little change to the code. Instead of hiding certain elements, the plugin could pick only the elements it needs. When no hiding, there is no problem of what should be hid. And the change isn’t big, i.e. it’s just matter of:

/*
	Pick the elements needed; upload form, list of image and navigation
*/

var e1 = iframe.find('.upload-form');
var e2 = iframe.find('#images_form table#list');
var e3 = iframe.find('#image_navigation .prev-next');

/*
	Replace the page contents to the way we want
*/

iframe.find('body').html('My header and instructions').append(e1).append(e2).append(e3);

Plugins that could advantage from standard-ish naming (same naming/structure might not fit every theme), are those that directly target the header or the footer, both which already have some callbacks, and the standard container doesn’t mean you can find same sub-nodes.

Last edited by Gocom (2011-08-07 13:28:44)

Offline

#3 2011-08-07 13:27:54

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Theme standards question

Hi Jukka,

yes, that looks like it would work across all themes. However, in either case there seems to me to be a need to define one standard way of doing things — either for plugin authors (following your suggestion) or for theme authors (with a naming constraint on containers.)

Another solution just came to mind: having the core add a wrapper div with a known id around the header and another around the footer.

Hmmm.


Steve

Offline

#4 2011-08-07 13:32:44

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

Re: Theme standards question

net-carver wrote:

Another solution just came to mind: having the core could add a wrapper div with a known id around the header and another around the footer.

But what will just a wrapper actually do? You won’t be able to find the same nodes from the header or footer across themes. It’s not really going to do anything more than what the callbacks already offer, if not then that you want to move the whole menu somewhere with JavaScript.

Last edited by Gocom (2011-08-07 13:43:20)

Offline

#5 2011-08-07 18:20:52

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Theme standards question

Gocom wrote:

… Instead of hiding certain elements, the plugin could pick only the elements it needs. When no hiding, there is no problem of what should be hid. And the change isn’t big, i.e. it’s just matter of…

Thanks Jukka, an useful suggestion as usual!
I’ll incorporate it in the next version.

Offline

#6 2011-08-07 19:39:46

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

Re: Theme standards question

redbot wrote:

Thanks Jukka

Heh, no biggies, glad to be at your service :-)

Offline

#7 2011-08-08 02:41:14

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,076
Website

Re: Theme standards question

net-carver wrote:

Another solution just came to mind: having the core add a wrapper div with a known id around the header and another around the footer.

instead of looking for header or footer – both of which may or not exist or take a well defined format, why not targeting something that you know will exist? All actual content, on all pages, is wrapped in a div; the ID varies per page, but all have one class in common. Plugins can append or prepend something to that element.

I don’t disagree with the need to have a predefined ID / name for header and footer that themes should use, I argued in favour of it in the style guide thread


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB