Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
3.7k views
in Q2A Core by
edited by

I took a look at the old Q2AStack theme mentioned here:

http://www.question2answer.org/qa/1382/do-we-have-any-beautiful-themes-for-q2a#a1436

and wound up making a new version here:

http://www.mediafire.com/download.php?ykalwn13milh6m3

In doing so, I made clear in my mind two things:

1) the q2a theme system is a great concept.  Not sure if it's revolutionary or maybe I just live under a rock, but it's better than any theme system I've seen.  It makes custom theme creation exceptionally easy, exemplified, I think, by the Q2AStack theme above.

2) there are still some areas where it could improve, as far as custom theme creating goes - great doesn't mean perfect, after all :)

So, maybe we can use this thread to kvetch about theming issues and maybe get some of them implemented in 1.5?  Here's my list:

1. it would be really useful to have more information available to the various functions.  For instance, when editing vote_buttons($post), I would like to know which sort of post this is.  Is it a q-view or is it a q-list-item?  There are many, many instances of this, and my workaround is just to add the information higher up in the theme hierarchy (so $post['class'] = 'q_item'), etc.

2. much of the data in qa_content is already html-ified when we get it.  Is this really necessary?  It would be much better, from a theme point of view if things like user handles, votes, titles, forms, etc. are left as data and processed by the theme.  That would make it alot easier to fully customize the interface.

3. some of the functions make preprocessing difficult, and so require us to rewrite the theme ourselves, which of course is dangerous.  Example:

                if (isset($post['who']['points'])) {
                    $post['who']['points']['prefix']='('.$post['who']['points']['prefix'];
                    $post['who']['points']['suffix'].=')';
                    $this->output_split($post['who']['points'], $class.'-who-points');
                }

What if I don't want parentheses around the points?  Here's my answer:

            if(isset($post['who']['points'])) {
            $post['who']['title'] = @$post['who']['title'] . '</span>'.(isset($post['who']['title'])?'&nbsp;':'').'<span class="'.$class.'-who-points-data">'.$post['who']['points']['data'];
            unset($post['who']['points']);
            }

Pretty ugly...

That's all for me... anyone else have any suggestions?  Hopefully this is helpful for Gideon, rather than adding unnecessary burden.

Update: Here's a screenshot of the StackOverflow Theme - at least it shows how customizable Q2A is:


by
Me too... and besides, it's all copyrighted anyway :) still, it's a neat design.
by
@NoahY: when i change the theme to this one i can't see any things on my website(only shows a white page), why?
by
I don't know, check your PHP logs :)
by
Download My Theme Q2ASuperUser Same Like Superuser.com
Download Link
http://www.mediafire.com/download.php?vrbrxkh3ikcjo1c

1 Answer

0 votes
by

I agree that the Q2A theme is a great system. I think a lot of people want a system when you simply write out the HTML in a file but then you'd still have to call other functions and probably end up using include() dozens of times. That would surely be slower, more awkward and less stable with upgrades than the functional system we have now.

Regarding your points:

1. Agree, and I think Gideon is adding that in 1.5 judging by the roadmap.

2. One idea would be to have two instances of the data - one HTML-ified and one with the raw data. That could add more overhead and increase memory usage though.

3. Agree, but no idea how we can make that better.

OTOH I can only think of one small thing that bothers me in the theming, which is this CSS:

.qa-nav-main-clear,
.qa-nav-sub-clear,
.qa-q-item-clear,
.qa-q-view-clear,
.qa-a-item-clear,
.qa-c-item-clear,
.qa-footer-clear,
.qa-vote-count-clear,
.qa-page-links-clear {clear:both;}

Why the heck do we need 9 separate CSS classes for clearing floats? Is there any difference between the sections? Why not just this:

.qa-clear { clear: both; }

 

by
P.S. Do you have a preview of that StackOverflow theme?
by
About the clear classes, I can imagine a case where you put different things in them and want to position them differently; maybe you don't want them all to clear both... dunno, but imo more customizability is better than less - it makes me think of another kvetch I had, that form fields don't have id fields, just name fields (hence the problem with the draft plugin that was recently suggested).

And about the preview, I added a screenshot, but I'm not actually using the theme myself, just on my localhost copy.
by
Not really sure how "qa-q-item-clear" could ever be different from "qa-a-item-clear". They are just there to clear floats. It's not a huge issue on its own but I think there are other things in the same vein that I don't remember right now.

Which form fields don't have IDs? I thought they all did, this comment form certainly does.
by
The question asking form doesn't have ids for "content" or "notify".
asked Mar 27, 2012 in Q2A Core by
edited Mar 27, 2012 by
error about Q2AStack(stackoverflow like theme) on 1.51
...