theming inside a module - drupal

Hi Everyone I am new to drupal and i am working on drupal theming i have created my own modules which have textfields and javascript validation in it. Now i am trying to create own theme for my module but i am not getting how to do can anyone pls give me a idea of how to do from basic or any links which explains in detail from scratch. thanks in advance.

You don't create themes for modules, themes are made for an entire site which will have several modules enabled.
If you want your module to be themable, that is, make it easy to alter the markup it generates, you will have to use the drupal theme system.
For the most part, when your module needs to generate some markup, you need to use the theme() function.
Sometimes you will need to create some custom markup which there is no theme function for. If that is the case, you will need to register your theme functions, so Drupal know they are there and so themes can overwrite them if needed. This is done with hook_theme().
There is a guide for developers on how to use the theme system.

Hook_theme() is used to define your modules theme implementations.
This looks like quite a good overview.

Related

Is it possible to use a regular wordpress theme without wordpress functionality

First of all i don't have any experience on wordpress.. So please forgive my ignorance.. I've found a theme on themeforest. Unfortunately it's a wordpress theme. I want to develop my own admin panel. I don't want to use wordress. Is it possible?
Anything is possible, however this is a gum in hair scenario. Ask the theme author if there is an HTML version which is common on ThemeForest. If you do try to "extract" the layout:
Begin with the stylesheet and match up the styles with each page template's markup.
Also, why not use WordPress? The Redux theme options framework is very easy to use.
Since a wordpress theme is just a bunch of html/css/js/php files, yes, it is possible. Depending on what language/framework will used backend side, the easiest way would be to extract the html/css/js parts of the theme and than add your own "content-placeholders" which will be used by your own backend.
But: Think twice about doing this. First, there could be a conflict with the license of the theme (depending on what type of license is used by the author of the theme). And more important, second, you should think twice about building your own backend.
For the case this isn't an experiment and you're building a productive website, building you're own backend is a lot of work. Unless you need some special functionalities (or you would like to keep it very slim and basic), I would suggest using a ready made CMS for this - like wordpress.
My opinion: 95% of self-made backends for basic cms features I've seen (and was forced to work with) are very messy and far beyond available open source cms. It seems like many people don't balance the pros and cons of building an own CMS-backend and undervalue the effort to build a state-of-the-art CMS.

RapidWeaver Theme to Drupal6 Theme

I am working on a site which has a RapidWeaver Theme ( f_fusion ). But I am more of a developer than a designer. Is there any way for us to convert a RapidWeaver theme easily to a Drupal6 theme so that all the styling remains the same ?
Yes, it's possible, particularly if you're a developer since it's really a question of taking the HTML & CSS from the RapidWeaver Theme and placing Drupal variables in it.
Start with checking this link to get an overall idea about Drupal Theming
When you know how to create a basic theme structure, you should learn how to modify the page.tpl.php file to start with, after that it will of course depends on the specifics of your site but you definitely should be on your way.
If you want to dig deeper, check this book: Pro Drupal Development

Blank Theme for Wordpress

I need to build a new WordPress site form scratch. So I guess I need a blank theme to do that. I need to know where I can find such a theme like that, and I need a tutorial that can help me to create my first WordPress theme from scratch.
I'm new in that world. So please I need your help.
If you're starting with no WP knowledge, I believe you're better off modifying a blank theme than you are creating one from scratch.
Here is a great tutorial I used when I started doing custom themes. The HTML is getting outdated semantically, but it will teach you all working parts of a WP theme.
As a starter theme I use HTML5 Boilerplate which is full of quality HTML5 and additional features like file caching, cross-browser readiness, mobile device readiness, and file caching, to name a few. Also it's got a minimal default styling.
You may also find the wordpress site helpful. Cheers.
starting with twentyten or twentyeleven isn't a bad option either.
Whatever theme you choice make it a child theme.
It may seem like something complex at first but it will make things easier along the way.
Theme Hybrid has a great blank theme: http://themehybrid.com/themes/skeleton
I have a starter theme on github that was originally based off html5 boilerplate that you can check out.. https://github.com/FernE97/html5-blank-slate

Drupal 6: duplicate theme function in two themes

I have a regular and mobile theme for a site; there are currently a couple of duplicate functions in the template.php of each theme, which do some text munging on the same fields. That is, the markup is the same for these fields in both themes.
How can I impose DRY and only have the logic in one place?
I understand I could make the regular theme inherit the mobile theme, but this doesn't seem like a "proper" solution, since the themes are quite different at the end of the day. Even more so as this would require ex-post-facto manipulation of the preprocess functions, and overriding mobile CSS and JS files - seemingly creating as much work and future WTH as it solves.
Thanks!
I would love to see the proper answer for this.
All i can think of is making a module that holds the duplication of functionality. A library module if you will.
So I'm making this "answer" as a conversation starter.
in: (mobile)template.php
preprocess_page(&$vars){
mymodulename_pagepreprocess($vars,'mobile');
}
(desktop)template.php
preprocess_page(&$vars){
mymodulename_pagepreprocess($vars,'desktop');
}
You can have preprocess-functions in modules as well btw. But it might be nice to send witch template as an argument.(you could however extract this from the global $theme)
How about you make a base theme which holds the functions, and implement both as sub-themes of it.
Or just the mobile theme a sub-theme, and the PC theme is the base?
Creating a sub-theme

drupal theme execution flow

I am beginner to drupal and doesn't know more about it I am amazing about drupal theme works. And I would like know drupal theme's flow of execution. If i open theme folder..., there is a file like page.tpl, template.tpl,node.tpl and more... In which order the drupal reads all those theming file...
There is no easy answer, it really depends.
The thing with Drupal's theming system, is that it is very flexible, which means, that under certain situations you can make it use other templates, than the default.
The only thing you usually can be sure of, is that the page.tpl.php is used, it defines the main structure of the page. It usually defines different regions where you can put dynamic content. This content can be generated by a combination of templates and theme functions.
If you want to understand how this all works, you could try to read the theme guide, or for a more hands on approach, install the Theme developer module to inspect the different elements of a drupal page.
Nick Lewis, as always, has a well written piece about the theming internals here, here, and here. Not one of them gives you the complete overview, but the three of them together creates synergistic drupal awesomeness.

Resources