Solved

How to change dupal theme programmatically

Posted on 2008-10-19
5
818 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

696 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