Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.6k views
in Q2A Core by
Hi Gidgreen,
I have prepared Orkut Application for my website :http://www.prepare4interview.com
Here is the url: http://www.orkut.co.in/Application.aspx?appId=549445333343

As my site is getting embedded with a iframe, i want to reduce the width of main section to make it fit. But i dont want to change current theme. So i would lik eot know, is it possible to set a theme by passing theme in parameter?

1 Answer

+1 vote
by
 
Best answer
Interesting question! Yes, you can do this with a small code modification. I see you're using version 1.2 beta, so look at qa-page.php (older versions should see qa-index.php). Where you have this line:

$themeclass=qa_load_theme_class(qa_get_option($qa_db, 'site_theme'), $qa_template, $qa_content, $qa_request);

Replace it with this:

$qa_theme=qa_get('qa_theme'); // get from URL parameter if possible
if (!isset($qa_theme)) // otherwise get option
    $qa_theme=qa_get_option($qa_db, 'site_theme');
$themeclass=qa_load_theme_class($qa_theme, $qa_template, $qa_content, $qa_request);

The other issue is that you will probably want the theme to be passed from one page to another, if the user navigates around. So to do this, you would modify qa_path(...) in qa-base.php, and add this at the start:

$qa_theme=qa_get('qa_theme');
if (isset($qa_theme))
    @$params['qa_theme']=$qa_theme;

This won't work for Ajax voting, but that won't matter if both themes use the same layout for the voting boxes. There might also be some other places where it doesn't work right, so please try it out and report back!
by
No, you need to add it at the start of function qa_path(...)
by
edited by
Ahh.. Sorry...
Works perfectly now...

One small thing is when i try to login.. goes back to old theme.
No problem, if you get some time, you please help me on this.. :)

Thanks a lot!

--
How to reduce answer textarea columns count from 40 to 20?
Due to its column property, not able to reduce its size to fit into main-area.
Please have a look, if time allows.. :)
by
I move it into production.. http://www.orkut.co.in/Application.aspx?appId=549445333343

Works perfectly..
Thanks a lot! :D
by
You can use a plugin to override the core function - instead of the core hack:
http://www.question2answer.org/qa/45225/how-to-load-another-theme-using-a-plugin
...