Hi folks. I'm trying to figure out the cleanest way to set this up.
I have a site that is actually kinda sorta 2 sites. It doesn't make sense to make it a multi-site, really, but it needs to give the impression of multiple sites, visually.
For the most part that's easy; just base the template file off of the path for the sub-site. (/ and /journal in my case). However, the client wants news items (news nodes) to appear on both "sites", with each one having its own visual appearance. That is, at /news/$nid it uses the main site template, while at /journal/news/$nid it uses the sub-site's template.
Is there a good way to do that?
So far my best guess is to use something like Panels 2 to create a panel at each location that has only one pane, which is the node specified by an argument. Of course, I haven't actually worked with Panels 2 yet, just seen Earl's demos, so I'm not sure if that's actually a reasonable plan. Is there some better way?
(This site will be built on Drupal 6; it's just in planning stages now, so I want to figure out what I'll be doing in 3 months to build it. <g>)
--Larry Garfield
Create a hook in your template.php file:
function _phptemplate_variables($hook, $vars) { $path = $vars['node']->path; switch($hook) { case 'page': if($path = '/one/of/your/paths') { $vars['template_file'] = 'page-difffile'; } } return $vars; }
This will specify a page template ('page-diffile.tpl.php') for a specific path. You can use any number of operators in the 'if' statement to test for various levels of truth (i.e. use a strstr to see if the path contains a substring, and return a template for all paths below that.)
-Andrew
On 10/16/07, Larry Garfield larry@garfieldtech.com wrote:
Hi folks. I'm trying to figure out the cleanest way to set this up.
I have a site that is actually kinda sorta 2 sites. It doesn't make sense to make it a multi-site, really, but it needs to give the impression of multiple sites, visually.
For the most part that's easy; just base the template file off of the path for the sub-site. (/ and /journal in my case). However, the client wants news items (news nodes) to appear on both "sites", with each one having its own visual appearance. That is, at /news/$nid it uses the main site template, while at /journal/news/$nid it uses the sub-site's template.
Is there a good way to do that?
So far my best guess is to use something like Panels 2 to create a panel at each location that has only one pane, which is the node specified by an argument. Of course, I haven't actually worked with Panels 2 yet, just seen Earl's demos, so I'm not sure if that's actually a reasonable plan. Is there some better way?
(This site will be built on Drupal 6; it's just in planning stages now, so I want to figure out what I'll be doing in 3 months to build it. <g>)
--Larry Garfield
-- [ Drupal support list | http://lists.drupal.org/ ]
That would work for changing the theme, as would the $suggestions array, but it wouldn't do anything for a node "existing" at two different paths. That's the tricky part.
On Tuesday 16 October 2007, Andrew Hankinson wrote:
Create a hook in your template.php file:
function _phptemplate_variables($hook, $vars) { $path = $vars['node']->path; switch($hook) { case 'page': if($path = '/one/of/your/paths') { $vars['template_file'] = 'page-difffile'; } } return $vars; }
This will specify a page template ('page-diffile.tpl.php') for a specific path. You can use any number of operators in the 'if' statement to test for various levels of truth (i.e. use a strstr to see if the path contains a substring, and return a template for all paths below that.)
-Andrew
On 10/16/07, Larry Garfield larry@garfieldtech.com wrote:
Hi folks. I'm trying to figure out the cleanest way to set this up.
I have a site that is actually kinda sorta 2 sites. It doesn't make sense to make it a multi-site, really, but it needs to give the impression of multiple sites, visually.
For the most part that's easy; just base the template file off of the path for the sub-site. (/ and /journal in my case). However, the client wants news items (news nodes) to appear on both "sites", with each one having its own visual appearance. That is, at /news/$nid it uses the main site template, while at /journal/news/$nid it uses the sub-site's template.
Is there a good way to do that?
So far my best guess is to use something like Panels 2 to create a panel at each location that has only one pane, which is the node specified by an argument. Of course, I haven't actually worked with Panels 2 yet, just seen Earl's demos, so I'm not sure if that's actually a reasonable plan. Is there some better way?
(This site will be built on Drupal 6; it's just in planning stages now, so I want to figure out what I'll be doing in 3 months to build it. <g>)
--Larry Garfield
-- [ Drupal support list | http://lists.drupal.org/ ]
Quoting Larry Garfield larry@garfieldtech.com:
Hi folks. I'm trying to figure out the cleanest way to set this up.
I have a site that is actually kinda sorta 2 sites. It doesn't make sense to make it a multi-site, really, but it needs to give the impression of multiple sites, visually.
For the most part that's easy; just base the template file off of the path for the sub-site. (/ and /journal in my case). However, the client wants news items (news nodes) to appear on both "sites", with each one having its own visual appearance. That is, at /news/$nid it uses the main site template, while at /journal/news/$nid it uses the sub-site's template.
Is there a good way to do that?
How about a modification to $GLOBALS['base_path']? [1]
[1] http://api.drupal.org/api/function/base_path/6
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/