Skip to content
Snippets Groups Projects
Commit 2eb9a460 authored by allisterbeharry's avatar allisterbeharry
Browse files

Added check for row plugin type and separator.

parent ac2ae1aa
No related branches found
No related tags found
No related merge requests found
......@@ -55,4 +55,15 @@ The project consists of 4 Views style plugins (and related row plugins):
1)views_xml - Output as raw XML, OPML, and Atom;
2)views_json - Output as Simile/Exhibit JSON, canonical JSON, JSONP;
3)views_rdf - Output as FOAF, SIOC and DOAP;
4)views_xhtml - Output as hCard, hCalendar, and Geo.
\ No newline at end of file
4)views_xhtml - Output as hCard, hCalendar, and Geo.
To use these plugins you should:
1) Enable all four modules;
2) Set the row style plugin for your view to Unformatted;
3) In the Unformatted row style plugin options set the separator to "|" (it is
set to this by default.)
4) Set the view style plugin to one of:
i) JSON data document
ii) XML data document
iii) RDF data document
iv) XHTML data document
\ No newline at end of file
......@@ -12,25 +12,19 @@
* @see views_json.views.inc
*/
if (get_class($view->style_plugin->row_plugin) !== 'views_plugin_row_unformatted') {
print ('<b style="color:red">The row plugin is not of type Unformatted.</b>');
return;
}
else if (($view->style_plugin->row_plugin->options['separator']) !== '|') {
print ('<b style="color:red">The row plugin separator is not "<span style="color:blue">|</span>" (you can set this in the options for the row style plugin.)</b>');
return;
}
$items = array();
foreach($rows as $row) {
// print_r($row).EOL;
$items[] = explode("|", trim($row));
}
if (count($items) != count($rows))
return ("Did not get all rows (is the field separator '|' ?)");
//print_r($items);
//foreach ($items as $item) {
// print_r($item).PHP_EOL;
// foreach($item as $itemfield) {
// print($itemfield);
// $itemfieldarray = explode(":", $itemfield);
// print_r($itemfieldarray).PHP_EOL;
// $label = $itemfieldarray[0]; $value=$itemfieldarray[1];
// print $label." : ".$value;
// }
//}
}
if ($options['format'] == 'Simple') json_simple_render($items, $view);
if ($options['format'] == 'Exhibit') json_exhibit_render($items, $view);
......
......@@ -11,14 +11,21 @@
* @ingroup views_templates
* @see views_rdf.views.inc
*/
if (get_class($view->style_plugin->row_plugin) !== 'views_plugin_row_unformatted') {
print ('<b style="color:red">The row plugin is not of type Unformatted.</b>');
return;
}
else if (($view->style_plugin->row_plugin->options['separator']) !== '|') {
print ('<b style="color:red">The row plugin separator is not "<span style="color:blue">|</span>" (you can set this in the options for the row style plugin.)</b>');
return;
}
$nodes = array();
foreach($rows as $row) {
$nodes[] = explode("|", trim($row));
}
if (count($nodes) != count($rows))
return ("Did not get all rows (is the field separator '|' ?)");
if ($options['vocabulary'] == 'FOAF') rdf_foaf_xml_render($nodes, $view);
......
......@@ -12,13 +12,24 @@
* @see views_xhtml.views.inc
*/
if (get_class($view->style_plugin->row_plugin) !== 'views_plugin_row_unformatted') {
print ('<b style="color:red">The row plugin is not of type Unformatted.</b>');
return;
}
else if (($view->style_plugin->row_plugin->options['separator']) !== '|') {
print ('<b style="color:red">The row plugin separator is not "<span style="color:blue">|</span>" (you can set this in the options for the row style plugin.)</b>');
return;
}
$nodes = array();
foreach($rows as $row) {
$nodes[] = explode("|", trim($row));
}
if (count($nodes) != count($rows))
return ("Did not get all rows (is the field separator '|' ?)");
if (count($nodes) != count($rows)) {
print ("Did not get all rows (is the field separator '|' ?)");
return;
}
if ($options['format'] == 'hcard') xhtml_hcard_render($nodes, $view);
......
......@@ -11,14 +11,21 @@
* @ingroup views_templates
* @see views_xml.views.inc
*/
if (get_class($view->style_plugin->row_plugin) !== 'views_plugin_row_unformatted') {
print ('<b style="color:red">The row plugin is not of type Unformatted.</b>');
return;
}
else if (($view->style_plugin->row_plugin->options['separator']) !== '|') {
print ('<b style="color:red">The row plugin separator is not "<span style="color:blue">|</span>" (you can set this in the options for the row style plugin.)</b>');
return;
}
$nodes = array();
foreach($rows as $row) {
$nodes[] = explode("|", trim($row));
}
if (count($nodes) != count($rows))
return ("Did not get all rows (is the field separator '|' ?)");
if ($options['schema'] == 'raw') xml_raw_render($nodes, $view);
if ($options['schema'] == 'opml') xml_opml_render($nodes, $view);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment