Phil,<br>I have skinned the cat several ways here, only to hit dead ends. The easy solution is obviously to load the whole set of options in memory and split it out into tabs using JQuery, but as I said, there are overheads if your pages are heavy.<br>
<br>It is likely that I have missed an easier approach than what I am attempting, but I think it is more probable that the API falls short here. After all, most themes today use a custom built option maintenance mechanism, and I am pretty sure very few people if any have attempted large theme options pages with the Settings API. The Settings API works fine if I leave in add_menu_page and add_submenu_page (I was going to submit it that way), but the combination with AJAX is what makes it tough to implement. Again, it is possible that I missed a trick here.<br>
<br>Sayontan.<br><br><div class="gmail_quote">On Mon, Jan 24, 2011 at 12:52 PM, Philip M. Hofer (Frumph) <span dir="ltr"><<a href="mailto:philip@frumph.net">philip@frumph.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div bgcolor="#ffffff">
<div><font face="Arial" size="2">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: 2px solid rgb(0, 0, 0); padding-left: 5px; padding-right: 0px; margin-left: 5px; margin-right: 0px;"><div class="im">
<div style="font: 10pt arial;">----- Original Message ----- </div>
<div style="font: 10pt arial; background: none repeat scroll 0% 0% rgb(228, 228, 228);"><b>From:</b>
<a title="sayontan@gmail.com" href="mailto:sayontan@gmail.com" target="_blank">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" target="_blank">theme-reviewers@lists.wordpress.org</a>
</div>
</div><div class="im"><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>
</div><div><div></div><div class="h5"><blockquote style="border-left: 1px solid rgb(204, 204, 204); 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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">http://host.com/wp-content/themes/my-theme/my-sub-options-1.php</a>,
which is just not done.
</li><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" target="_blank">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" target="_blank">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: 1px solid rgb(204, 204, 204); 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>
</div></div><p>
</p><hr><div class="im">
<p></p>_______________________________________________<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></blockquote></div>
<br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">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>
<br></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>