Welcome to my home on the web!




Ever wondered how to have a page, or several, with one theme and the others with another?
Usually, this comes up when you wish to have the site with one theme and the administration pages with another. That’s the simplest scenario and is solved simply by using the built in functionality in Drupal core.
Just go to Admin -> Site Configuration -> Administration Theme and select the theme you wish to use for only your administration pages.

Another situation is when you wish to have the administration theme applied not only to the administration pages (those who have the ‘admin’ in their URL), but to other pages. To do this you need the help of a module surprisingly called Administration Theme. This module allows you to apply the administration theme of your choice to pages like: batch processing pages, devel node load and render pages, coder code review pages and pages you define yourself.
Just download and install the module and on the same Admin -> Site Configuration -> Administration Theme page you’ll have some new options that allow you to master the new configurations.

So far, I didn’t point out anything new and exciting, but the post is not over…

The third scenario and the one that I have come across recently, is the one where you wish to have a different theme applied to a specific set of pages. Not all administration pages and not those and other pages. In my case, I had to use a different theme just for the editing pages that belong to the Panels module. Luckily, those pages have one thing in common and that is that their URL always starts with ‘admin/build/pages’. This allowed me to create a rather simple solution to the task in hand.
Inside my own module, I have created a function called mymodule_init(). Inside, I checked if the page’s URL currently being visited starts with ‘admin/build/pages’. If so, I use the global variable $custom_theme and set it to the other theme I wish to apply. Then all I needed to do is call init_theme() in order to load the theme.

The $custom_theme global variable allows you to override the Drupal theme programmatically and then by calling init_theme() you initialize the Drupal theme system using the theme you have set in that global variable.

Here is the code:

function mymodule_init() {
  // get global variable to override Drupal theme
  global $custom_theme;

  // check if the current page needs to have its to theme changed
  if (stripos($_GET["q"],"admin/build/pages/") !== FALSE) {
    // set the custom theme and initialize theme system
    $custom_theme = 'garland';
    init_theme();
  }
}

 

My case was probably a specific issue I came across with and probably not relevant to all, but the solution can be applied to other situations as well.



The answer for that is... 42! Well... actually no, not really. :P
I would have to say that this site's general theme is going to be my professional experience regarding web development and software development in general. I also have a big interest in the Information Security realm, so I might write something about that as well.

So, to start things off, I have copied some of my old site posts (and their visitors' comments, if any) onto this site, so more visitors can benefit from them, like others already did.

You can find them in the Archive page or the Recent Posts page. Check them out and let me know what you think by posting a comment.
Also, check out my Links page, where I have some featured sites listed.



When I first started creating this site, I was determined to write every piece of code myself. I love building things from scratch and I think that it is the essence of being a software developer.
So, I have built it all using ASP.NET: page code, database integration, web styling... and it was a lot of fun.
I knew back then that there are all kinds of Content Managing Systems (CMS) out there that promise to do things easy for you, but I thought they are quite restrictive and not worth the effort.
The site was online for a few years, but updating its content was not easy and took a bit of work. I have created the site and its content but not a CMS, so for every post I wished to publish I had to do a lot of manual work.

Then came Drupal. I started to get to know Drupal during my work and quite easily I learned how to use it and tweak it to my benefit. I have to admit that Drupal is not the simplest CMS out there, but its complexity gives you the flexibility other CMS just don't have.

So, I have decided to migrate my .NET site to Drupal and here it is before you!

Hope you like it...

ABOUT ME

View Ehud Ashkenazi's profile on LinkedIn

Ehud Ashkenazi is a Software Developer and Webmaster at a large eLearning company.

Working with various technologies including C-Sharp(C#), ASP 3.0, ASP.NET, PHP, T-SQL, HTML and more.

Currently holding a BA in Computer Science from the Efi Arazi School of Computer Science, IDC Herzliya, Israel.