<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18928">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>I have no idea what code your using to try to
accomplish what you're doing, but i'm thinking that there are better methods for
implementation that are being overlooked.</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="FONT: 10pt arial; BACKGROUND: #e4e4e4; font-color: black"><B>From:</B>
<A title=sayontan@gmail.com href="mailto:sayontan@gmail.com">Sayontan
Sinha</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=theme-reviewers@lists.wordpress.org
href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, January 24, 2011 12:46
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [theme-reviewers]
add_theme_page()</DIV>
<DIV><BR></DIV>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>Ideally, it would still have just one Theme Options page
under<BR>appearance, and then use tabs or something else on its own page
to<BR>separate the options out.<BR></BLOCKQUOTE><BR>This is much easier said
than done. I have been working towards getting tabs in place on one page
(multiple calls to add_theme_page makes things look quite ugly), but there are
simply too many limitations with the whole API to make this work effectively.
Let me try to explain.<BR><BR><U><B>The Scenario:</B></U><BR>My theme has
several options. Putting them all on one page causes a lot of issues, like
sluggishness of the back-end and interference with PHP-Suhosin protection
settings (though Suhosin can be tweaked). I originally had a 2-level tab
system, with horizontal tabs at the top for different sections of settings,
then vertical tabs within each section (that is similar to the kind of
settings that the other folks are talking about). The tabs were all handled by
JQuery. This works fine with a small number of options, but with a large
number of options, the sluggishness shows up in the back-end. That was when I
removed the horizontal tabs at the top level and used add_menu_page and
add_submenu_page.<BR><BR>But with the recent enforcements of new rules and
recommendations, I have had to do some major rework. I first rewrote the
options framework to use the Settings API, but still with add_menu_page and
add_submenu_page. Now I am rewriting again to get rid of the additional menu
and roll it back to how the look was earlier, but with a difference: the
entire set of options will not be loaded into browser memory in JQuery tabs.
Instead, I will try to fetch each page as it is clicked, like the Theme
Installation page in WP.<BR><BR><B><U>My attempts:</U></B><BR>
<OL>
<LI>I first simply created one options page, then included a set of links at
the top. <BR><U><B>Issue:</B></U> Getting the links to behave as belonging
within WP. E.g. If your admin panel is at <A
href="http://host.com/wp-admin">http://host.com/wp-admin</A>, your theme
options page could be at <A
href="http://host.com/wp-admin/themes.php?page=my-options">http://host.com/wp-admin/themes.php?page=my-options</A>.
The tabs, however cannot be given links through the admin panel. In other
words, to get a URL such as <A
href="http://host.com/wp-admin/themes.php?page=my-sub-options-1">http://host.com/wp-admin/themes.php?page=my-sub-options-1</A>,
I HAVE to use add_theme_page. If I don't use add_theme_page, the page isn't
added to the whitelist and will not show up. I cannot use other URLs,
because then I will have something like this: <A
href="http://host.com/wp-content/themes/my-theme/my-sub-options-1.php">http://host.com/wp-content/themes/my-theme/my-sub-options-1.php</A>,
which is just not done.
<LI>To get around the above, I decided to bundle AJAX with the options page.
So I have one options page accessible through <A
href="http://host.com/wp-admin/themes.php?page=my-options">http://host.com/wp-admin/themes.php?page=my-options</A>.
In there I have 5 links, each of which invokes AJAX to load the specific
options page, while staying in <A
href="http://host.com/wp-admin/themes.php?page=my-options">http://host.com/wp-admin/themes.php?page=my-options</A>.
This way I only need to whitelist the main page.<BR><U><B>Issue:</B></U>
Getting settings_fields() to generate _wp_http_referer different from
admin-ajax.php. This is causing options.php to return
admin-ajax.php?updated=true, which is not what I want. This is where I am
stuck right now, but hopefully I will get over the hurdle soon.<BR></LI></OL>I
am looking forward to completing this exercise, so that other developers can
learn from my (rather harsh) experience
here.<BR><BR>Cheers,<BR>Sayontan.<BR><BR>
<DIV class=gmail_quote>On Mon, Jan 24, 2011 at 11:08 AM, Otto <SPAN
dir=ltr><<A href="mailto:otto@ottodestruct.com"
target=_blank>otto@ottodestruct.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>
<DIV>On Mon, Jan 24, 2011 at 1:03 PM, Rahul Bansal <<A
href="mailto:rahul286@gmail.com" target=_blank>rahul286@gmail.com</A>>
wrote:<BR>> What if theme offers so many options that it need to contains
4-5 subpages?<BR><BR></DIV>Ideally, it would still have just one Theme
Options page under<BR>appearance, and then use tabs or something else on its
own page to<BR>separate the options out.<BR><BR>Realistically, I'd say a
theme with that many options is too complex<BR>to begin with. Themes should
be about the look of the site, not crazy<BR>functionality. Break the
functionality parts out into plugins that go<BR>along with the theme or
something like that.<BR><FONT color=#888888><BR>-Otto<BR></FONT>
<DIV>
<DIV></DIV>
<DIV>_______________________________________________<BR>theme-reviewers
mailing list<BR><A href="mailto:theme-reviewers@lists.wordpress.org"
target=_blank>theme-reviewers@lists.wordpress.org</A><BR><A
href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers"
target=_blank>http://lists.wordpress.org/mailman/listinfo/theme-reviewers</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>Sayontan Sinha<BR><A href="http://mynethome.net"
target=_blank>http://mynethome.net</A> | <A href="http://mynethome.net/blog"
target=_blank>http://mynethome.net/blog</A><BR>--<BR>Beating Australia in
Cricket is like killing a celebrity. The death gets more coverage than the
crime.<BR><BR>
<P>
<HR>
<P></P>_______________________________________________<BR>theme-reviewers
mailing
list<BR>theme-reviewers@lists.wordpress.org<BR>http://lists.wordpress.org/mailman/listinfo/theme-reviewers<BR></BLOCKQUOTE></BODY></HTML>