I have a CCK type (a news article)... is there any way I can give a custom view of this (not just the node, but the whole page), so I can output it in XML etc.? e.g /path/to/node (uses normal node view), / path/to/node/xml (renders it in XML using a template - actually what I want to do is render it in XHTML, but in a certain format)
I've looked at Views, but they seem geared towards rending lists of CCK types - I just want a special view of a particular node
alternatively, I could have a module that loads the CCK type via a callback menu item - e.g. /somecallback/path/to/node . ... but I can't figure out how to load the node based on the /path/to/node information.. anyone know how to do this?
Thanks!
Robert
Are you suggesting that you don't want this page themed using drupal's theming system?
Normally customization is done using content-type.tpl files. But if you're looking for non-themed pages, then you probably want do develop your own custom module.
Happy to advise on either but need to know which strategy you're looking for here.
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Robert Gravina Sent: Monday, March 24, 2008 9:18 AM To: support@drupal.org Subject: [support] CCK custom view
I have a CCK type (a news article)... is there any way I can give a custom view of this (not just the node, but the whole page), so I can output it in XML etc.? e.g /path/to/node (uses normal node view), / path/to/node/xml (renders it in XML using a template - actually what I want to do is render it in XHTML, but in a certain format)
I've looked at Views, but they seem geared towards rending lists of CCK types - I just want a special view of a particular node
alternatively, I could have a module that loads the CCK type via a callback menu item - e.g. /somecallback/path/to/node . ... but I can't figure out how to load the node based on the /path/to/node information.. anyone know how to do this?
Thanks!
Robert
The printer friendly pages module http://drupal.org/project/print might be a place to get some ideas.
On Mon, Mar 24, 2008 at 12:23 PM, Metzler, David metzlerd@evergreen.edu wrote:
Are you suggesting that you don't want this page themed using drupal's theming system?
Normally customization is done using content-type.tpl files. But if you're looking for non-themed pages, then you probably want do develop your own custom module.
Happy to advise on either but need to know which strategy you're looking for here.
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Robert Gravina Sent: Monday, March 24, 2008 9:18 AM To: support@drupal.org Subject: [support] CCK custom view
I have a CCK type (a news article)... is there any way I can give a custom view of this (not just the node, but the whole page), so I can output it in XML etc.? e.g /path/to/node (uses normal node view), / path/to/node/xml (renders it in XML using a template - actually what I want to do is render it in XHTML, but in a certain format)
I've looked at Views, but they seem geared towards rending lists of CCK types - I just want a special view of a particular node
alternatively, I could have a module that loads the CCK type via a callback menu item - e.g. /somecallback/path/to/node . ... but I can't figure out how to load the node based on the /path/to/node information.. anyone know how to do this?
Thanks!
Robert
-- [ Drupal support list | http://lists.drupal.org/ ] -- [ Drupal support list | http://lists.drupal.org/ ]
Robert Gravina ha scritto:
I have a CCK type (a news article)... is there any way I can give a custom view of this (not just the node, but the whole page), so I can output it in XML etc.? e.g /path/to/node (uses normal node view), / path/to/node/xml (renders it in XML using a template - actually what I want to do is render it in XHTML, but in a certain format)
I've looked at Views, but they seem geared towards rending lists of CCK types - I just want a special view of a particular node
alternatively, I could have a module that loads the CCK type via a callback menu item - e.g. /somecallback/path/to/node . ... but I can't figure out how to load the node based on the /path/to/node information.. anyone know how to do this?
Thanks!
Rober
Only a idea but in your template.php file:
function _phptemplate_variables($hook, $vars) { switch ($hook) { case 'node': $tmp = split($_GET['q'],"/"); $last = count($tmp)-1; if ($tmp[$last] == 'xml') { $vars['template_files'] = 'my_template_file_for_NODE_xml.tpl.php'; } break; case 'page': $tmp = split($_GET['q'],"/"); $last = count($tmp)-1; if ($tmp[$last] == 'xml') { $vars['template_files'] = 'my_template_file_for_PAGE_xml.tpl.php'; } break; } return $vars; }
Read this too: http://drupal.org/node/117491
Ah, this php code is not tested.
M