I have a site where I need to add a doorway page - for lack of a better term. The site's new index will have to main links to other nodes on the site. The current index page is going to be one of those pages. The problem I am having is that the current index page has a distinct layout that it must maintain. I found a tutorial on Lulabot.com (I think) on how to create a custom index page. That worked fine. I added the following function to my template.php file:
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
global $user;
if ($vars['is_front']) {
$vars['template_file'] = 'page-index';
}
break;
}
return $vars;
}What I would like to do is replace the current page with the new index and then point to the old index page as one of the two main links on the new index page. I thought that by creating a new page node I could link to it and then use the _phptemplate_variables function to replace the layout of that specific page node.
Here is the bit of code I tried to use:
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
global $user;
if ($vars['is_front']) {
$vars['template_file'] = 'page-index';
}else if ($vars['nid'] = '382') { // 382 is the node id of the page node I created
$vars['template_file'] = 'page-school-bus-home'; //page=school-bus-home.tpl.php is the template file I need to use for the above node
}
break;
}
return $vars;
}Right not I am just trying to test to see if the layout looks correct when I go to the node url (matthewsbuses.com/node/382). So far nothing. Is there a better way to do what I am trying to do?

Comments
Please see the docs for
Please see the docs for Template Naming Suggestions:
http://drupal.org/node/190815
There is a standard way to name .tpl.php files so that drupal will automagically use that file. Example, there is a convention for naming something page-front.tpl.php and Drupal will just use that for the front page. However, I don't recommend using that to override the standard home page, /node - you may want a tiny custom module with its own menu function for that, or Panels, depending on what you want to do.
Also, I don't know that $vars['nid'] does contain anything if the case statement matched "page".
If you have devel.module installed, try running dsm($vars) and see what is in there.
Ryan Price
DrupalEasy Podcast
I will install the devel
I will install the devel module and try running dsm($vars). As for the naming convention, I only want one page to look like that file. Since that page will no longer be the index page, I can't use front or index. I need another way to get drupal to use the template for that page.
EDIT:
I think you might be right about creating a small custom module to do that for me but I have never created a module before. Are there any good tutorials for creating one that you can recommend? I have used panels before with some success but I thought that what I am trying to do would be easier if I just focused on the three pages affected by the change in the index page.
---------------| New Index |
---------------
|
____________________________________
| |
------------------ -----------------
| Page A | | Old Index |
------------------- -----------------
I am trying to keep the layout of the Old Index page. I'm just trying to figure out the easiest way to do that.