Anybody know how to get the following to work in drupal 6.x...

http://drupal.org/node/104316

?

Thanks.

Comments

webcomm’s picture

actually, make that...

http://drupal.org/node/139766

How do I get that to work in 6.x?

WorldFallz’s picture

I did it with http://drupal.org/project/sections, lol.

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

webcomm’s picture

hmmm. I don't think that will let me have a template like...

page-this-that-other.php

...for...

www.mysite.com/this/that/other

...and...

page-this-that.php

...for...

www.mysite.com/this/that/oranges
www.mysite.com/this/that/apples
etc

Right?

I don't want to set up a new theme for each page, as the section module requires, even if it's a simple theme.

I wonder why this doesn't work in Drupal 6: http://drupal.org/node/139766

WorldFallz’s picture

My bad--- my eyes saw "template" but my brain said "theme", lol.

The

function _phptemplate_variables($hook, $vars = array()) {
  switch ($hook) {

Has been replaced in d6 with phptemplate_variable_hook. See http://drupal.org/node/223430 for more info.

I would think this code could be updated with:

function phptemplate_preprocess_page(&$vars) {
  if (module_exists('path')) {
    $alias = drupal_get_path_alias(str_replace('/edit','',$_GET['q']));
    if ($alias != $_GET['q']) {
      $suggestions = array();
      $template_filename = 'page';
      foreach (explode('/', $alias) as $path_part) {
        $template_filename = $template_filename . '-' . $path_part;
        $suggestions[] = $template_filename;
      }
    }
    $vars['template_files'] = $suggestions;
  }
}

Post back if it works and I'll update that page.

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

webcomm’s picture

That code works. It interferes with page-front.tpl.php, but I can work around that by creating a page at www.mysite.com/home to serve as my home page, setting that path as my homepage in the Site Information, and creating a page-home.tpl.php template.