Solved

How to change dupal theme programmatically

Posted on 2008-10-19
5
815 Views
Last Modified: 2013-11-10
Hello,

I want to have different theme for mobiles and PCs in Drupal 6 CMS. I plan to do it like following: first _init hook is called from my custom module. This hook checks USER_AGENT and decides if it is a mobile device. Then it should pick a theme to be displayed. So a question, how to select a theme from within a module hook?

TIA
0
Comment
Question by:U4enik
  • 2
5 Comments
 
LVL 5

Expert Comment

by:stephencolson
ID: 22752415
You are essentially asking for something very similar to the Sections module: http://drupal.org/project/sections

Assuming that can't do exactly what you need, it should provide all of the techniques for you to gut it's functionality and implement it.
0
 

Author Comment

by:U4enik
ID: 24379948
sorry, but this wasn't helpful
0
 
LVL 5

Accepted Solution

by:
stephencolson earned 500 total points
ID: 24380649
Not sure why this wasn't helpful at all. I've done a similar thing using what I had described with good effect. If you wanted more information or some part wasn't clear, you should state that as we can't read your mind.

Please respond so we can get your problem solved.
0
 
LVL 1

Expert Comment

by:ussher
ID: 25265344
also looking for this functionality.  

I want to know how to do it PROGRAMMATICLY  not "just add xxx module."

seams silly to open another question to ask the same question.

here is how to programmaticly insert a view.
http://www.pixelclever.com/how-programmatically-insert-a-view-drupal-6

looking for other ways to also alter themes programmaticly
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now