Hi Guys lets learn how to make or create a simple, basic durpal theme from scratch .
It is easy to understand and apply the concept on your projects there are some important files which have to be added in your theme.
Most durpal theme will contain the following files
For example if my theme name is learnwebscripts then
- learnwebscripts.info(ie your theme name and the extension .info)
- style.css –The stylesheet that must be followed in your theme
- page.tpl.php –The template of your theme
- logo.png (remember it must to a .png file so that drupal can automatically add the logo to your theme)
- page—front.tpl.php – The separate theme you like to follow for your front page.
- images directory
- screenshot.png this shows a default preview of your them.
- template.php etc and lots more
By default a .info file of your theme is more than enough to start your theme
You should add your default theme in sites/all/themes/learnwebscripts
What drupal does it scans the template files present in you directory if you do not have those files it automatically adds the files to your theme it is located in modules/system folder
So thats what drupal need from you.
To create a simple drupal theme just .info file is enough.
Lets learn in depth about these files
Now once this file is added activate your theme in appearance->and find your theme then click enable and set deafault once this is done then this is how your template looks
What should a durpal .info file should contain
name = learnwebscripts
description = learnwebscripts theme is designed by webkites.in
version = VERSION
core = 7.x
project = “learnwebscripts”
if you have a css file in your theme you should add the following code for example if you have two css files you should declare like this
stylesheets[all][] = style.css
stylesheets[all][] = settings.css
Each drupal theme is separated by regions for example if you theme has a header, footer, left sidebar, right sidebar each of them is a separate regions and you should assign those regions in the info file eg
regions[header] = Header
regions[leftsidebar] = Leftsidebar
regions[rightsidebar] = Rightsidebar
regions[footer] = Footer
Now each regions what you have assigned will automatically added to your theme you can find it in structure->blocks and all your theme regions will automatically be assigned over there.
page.tpl.php
This is the page where you should design your theme to call the regions which you have assigned you just need to add this code
Eg:if you want to call the header region just add
<?php if ($page['header']): ?>
<?php print render($page['header']); ?>
<?php endif; ?>
page—front.tpl.php
Suppose if you have a unique front page then you should design it over here.
Template.php
For example there are certain situation where you have to write conditions that a css should work only for a separate page it that case use this code
<?php
if (drupal_is_front_page()) {
drupal_add_css(drupal_get_path(‘theme’, learnwebscripts) . ‘/style.css’, array(‘group’ => CSS_THEME, ‘type’ => ‘file’));
}
?>
So all the conditions in your theme should be added here
This is how you create a simple , basic durpal theme in my next tutorial i will help you regarding how to style your theme and control using css thanks for steeping to learnwebscripts.com cheers.














Good searching for this stuff thank you very much
I tuhohgt I’d have to read a book for a discovery like this!
This line caused my install problems: core = “7.x”
The quotes are not needed and actually caused Drupal to complain about the theme not being valid for v7 (using v7.15). Remove them and all will be fine.
Thx
thanks dude
Okay I’m convcnied. Let’s put it to action.
really nice.. i need step by step for how to create a style.css file
I just want to mention I am very new to blogging and site-building and seriously loved you’re web-site. Likely I’m planning to bookmark your website . You actually have amazing posts. Cheers for sharing with us your blog.
Wonderful artical, I unfortunately had some troubles printing this artcle out, The print formating looks slightly screwed over, something you might want to appear into.
I really appreciate this post. I’ve been looking everywhere for this! Thank goodness I found it on Bing. You have made my day! Thanks again!
Wow! This could be one particular of the most useful blogs We have ever arrive across on this subject. Basically Wonderful. I am also a specialist in this topic therefore I can understand your effort.
you’re in point of fact a good webmaster. The website loading velocity is amazing. It sort of feels that you are doing any unique trick. Furthermore, The contents are masterwork. you’ve performed a magnificent job on this subject!
Usually I do not read article on blogs, but I wish to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Thanks, quite nice post.
I really appreciate this post. I’ve been looking all over for this! Thank goodness I found it on Bing. You have made my day! Thx again
Saved at first read through of just one write-up. The nation’s great report. How much does this indicate? We point you’re the very best bloger my spouse and i ever in your life readet around my entire life. Will be there somehow to make contact with to you? Kind regards!
Wow! Thank you! I continually wanted to write on my website something like that. Can I implement a portion of your post to my site?
sure learnwebscripts.com is free for everyone . It would be great if you place our site link there so our article also gets appreciated.
Sure learnwebscripts.com is free for all . If possible mention our site name . My aim is to educate everyone in this world for free………….
Somebody essentially help to make seriously articles I would state. This is the very first time I frequented your web page and thus far? I amazed with the research you made to create this particular publish incredible. Great job!
I really like your writing style, fantastic information, appreciate it for posting
. “Silence is more musical than any song.” by Christina G. Rossetti.
I have recently started a web site, the information you provide on this site has helped me tremendously. Thanks for all of your time & work. “One of the greatest pains to human nature is the pain of a new idea.” by Walter Bagehot.
Hey incredibly cool web-site!! Man .. Beautiful .. Remarkable .. I’ll bookmark your internet site and take the feeds also…I’m happy to find a good deal of practical information here in the post, we need develop much more strategies in this regard, thanks for sharing. . . . . .
I was able to find good information from your articles.|
I was suggested this blog by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my trouble. You’re amazing! Thanks!
It is in fact a cool and beneficial piece of info. I’m happy that you simply just shared this helpful details with us. Please hold us informed like this. Thank you for sharing.
Well described.
Nice to understand. May God bless you for your all efforts.
Looking around…
I like to browse around the online world, regularly I will go to Digg and follow thru…