Solved

How to change dupal theme programmatically

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and 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…
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.

831 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