Skip to:
Content
Pages
Categories
Search
Top
Bottom

REQ: Theme demo switcher like phpBB

Viewing 18 replies - 1 through 18 (of 18 total)
  • Agreed. Once the templates really start flowing, we can get our own theme switcher or maybe we can throw something up on Pro Forums for it. Either way, it will take a little time.

    Trent


    lonemadmax
    Member

    @lonemadmax

    If it’s for a demo, wouldn’t an ad hoc patch be enough? I have not delved into the code, but I guess that adding the name of the chosen theme to the user cookie and changing the function that tells what template is in use to look there first (if necessary) would do. Well, and the dropdown box to select theme, of course.

    Go ahead then :D


    lonemadmax
    Member

    @lonemadmax

    OK, here it is. Notice though that the selection box is added using evil ways. You may be all well and good if you don’t add it, though. More info in the README.

    A few modifications and it will become a nice plugin that saves the user preferred theme in the db and id not annoying (and only works for registered users when logged in). Will that be useful to anyone?

    Demo plz?

    Also found this one where you can dowload the theme you are watching (http://alexking.org/projects/wordpress/theme_browser.php) but it isn’t for download. (Author doesn’t want that)


    lonemadmax
    Member

    @lonemadmax

    Unfortunately, I don’t have a place to show it. You can download and install, *your forum will keep its functionality*, just with an optional annoying box reminding you that you can test themes. And only if you install that part.

    Also, a few things I failed to mention: it’s ugly (I just wanted it to work and I’m not a designer, anyway), it expects nice theme names, the box only appears in the pages that use bb_get_header and the template’s header file is supposed to not finish in the middle of a tag (the middle of the tag itself, not its content, of course). Those don’t seem to be great assumptions, even though I’ve only tested it with two themes.

    This looks really cool. I’ll get working on installing this tomorrow.


    lonemadmax
    Member

    @lonemadmax

    New version, same link. No need to touch core files now. It relies on the bb_foot action to inject the box. More info in the README.

    I have a really tiny question. Is there a way to move the popup-deal to the bottom of the page (it is in the top left right now)? In this position it somewhat obscures the top content. Thanks so much by the way, it’s working beautifully.


    lonemadmax
    Member

    @lonemadmax

    Yep, just have a look at the beginning of the injected javascript, in the plugin file. st is the variable through which you change the CSS of the box. Regarding position, the original file has:

    st.position = "fixed";
    st.left = st.top = "40px";

    Changing top to bottom may give what you are asking for. You can change the value, of course, and add other CSS that you may want. Also, if you know JavaScript, you can make the box work as a draggable window, there are examples of that out there.

    I’ve just tried it under MSIE and guess what, it puts the box in the bottom of the page, after all content (that is, where it is generated). :-)

    And there’s a BUG (I’m talking about my files again, not MSIE positioning). The “close this box for this session” closes it forever. Well, for “more than just this session”, a week, I think. I can’t correct it and test it now, but the change needed would be to add the “just for this session” expiration time for the “annoying_box” cookie. That’d be the third parameter to bb_cookie in line 15 of themes.php. There are only two parameters now, and bbPress takes the absence of the third (or its value being 0) to mean a week. Right now I don’t know if you have to set a value in the past, a negative value or no value to make it a session cookie. In the latter case, it may be necessary to call setcookie directly instead of bb_cookie as bb_cookie changes the no-value case to a week.

    You may also leave that option out, the “box that disappears after 5 seconds” one may be enough.

    Would like to add:

    – Download button that will (on click) download the theme currently viewing (even grater if it would zip the theme folder and offer it for download on the fly)

    – Remove the Show theme button. Just selecting it in the ddlb should be enough to switch (or some explainetion of how to do this, cause I want to use it without that button)


    lonemadmax
    Member

    @lonemadmax

    Download button that will (on click) download the theme currently viewing (even grater if it would zip the theme folder and offer it for download on the fly)

    Good idea! I’ll work on that. I don’t know if zipping on the fly would be nice on the server. I think it’d be better that the admin adds the zip each time he adds a theme. But that’s more work for the admin :-) so I don’t know.

    Remove the Show theme button. Just selecting it in the ddlb should be enough to switch (or some explainetion of how to do this, cause I want to use it without that button)

    You can remove it by deleting the lines that generate it. Line 139 – 142 in cookie_themes.php (that is, from var but = ... to f.appendChild(but);). I put it before adding the “submit on change” stuff, and then I left it just in case the new thing didn’t work. When I tried it yesterday on MSIE, it didn’t work there, you had to use the button. But it may be just my MSIE with paranoid configuration.

    Why not have the server zip the theme every time a theme is added? Minimises work on all sides.

    Very nice work. I especially like the don’t show for … settings. It feels very professional. :)


    lonemadmax
    Member

    @lonemadmax

    But the server doesn’t know when a theme is added. It can be done, of course, by checking the existence of the zip when the list of themes is created. But then, you don’t always have writing permissions. And the theme may be updated without erasing the generated zip. It can probably all be worked out by checking permissions, change times, etc. and choosing the appropriate behaviour.

    I’m excited with this and will work on it, but I’ll have to learn a bit of PHP first and then find some time to do it, so don’t hold your breath. I haven’t even started with the cookie expiration time yet.

    Thank you for your comments.

    I suggest to add a zip of the theme in that theme folder for now, so we can use this download button. Future realease can have this zipping later (if needed at all).

    The download button would be plain wicked :)


    lonemadmax
    Member

    @lonemadmax

    New version, same link.

    Changes:

    • Box/reminder/no box option expires with the session.
    • Micro comments in the plugin file, to make changes (esp. removing things) a bit easier.
    • Download link for the themes with the zip, both in the box and in the screenshots page.

    The zips have to be added manually. Hey, just like the themes themselves. It’s better that way, as an automatic creation would make them available and thus you’d be redistributing them, so you’d better check the license. OK, it’s just a cheap excuse to avoid the work :-) I may add that functionality for the admin (create/rebuild/delete zip links in the screenshots page when the admin loads it), but it’s low in my general TODO list. So, until a new bug is found or another good idea pops up that is easy for me to implement, consider it a final version.

    Also, keep in mind that the users can fake cookies and I don’t check their values. I don’t know how much of a risk it is for this case, nor how to solve it (yeah, I could check that only letters appear in the values).

    Ok and where to put the zips? In the theme’s template folder?


    lonemadmax
    Member

    @lonemadmax

    Yep, and with its same name. For example, put kakumei.zip in bb-templates/kakumei/ This was in the README :-), though maybe a bit hidden. Now it has its own section to be easier to spot, and there’s a one-liner to build all the zips in bash.

    Also, a bug and a security issue (hopefully) corrected in the new version.

Viewing 18 replies - 1 through 18 (of 18 total)

You must be logged in to reply to this topic.