Solved

How to change dupal theme programmatically

Posted on 2008-10-19
5
813 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 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

13 Experts available now in Live!

Get 1:1 Help Now