0
votes

I am new to Drupal, and I want to load a new page.tpl.php if there is different source in URL like: www.example.com?source=s1

where s1 will load page--p1.tpl.php and s2 will load page--p2.tpl.php

Drupal can load different pages depends on node or node type is it possible to have this kind of functionality.

Currently I have written all if conditions in page.tpl.php to achiever this. But it is looking messy.

1
What is s1 and s2? - hardik solanki
These are different sources from where traffic is coming. we want to have different header and footer for each source. - Rakesh K

1 Answers

2
votes

you have to use theme suggestion to this , code is given below

function bartik_preprocess_page(&$vars, $hook) {
if(arg(0)) {
  $vars['theme_hook_suggestions'][] = 'page__'.  arg(0);
}

}