[development] Modify Views CSV Export

Maciej Perlinski maciej.perlinski at gmail.com
Thu Mar 13 11:31:00 UTC 2008


You shouldn't have db_query in the presentation layer in my opinion
just work on the data you got from views.
On the other hand you are returning db_query object which requires
db_fetch function to read that- > but this is not the point in the
phptemplate_ functions work with the data you are receiving in the
arguments.

Mac

On Thu, Mar 13, 2008 at 10:03 AM, Marolijo - Pol maresma
<marolijo at yahoo.es> wrote:
> I found how to modify tha theming of the field, but can't return the info
>  needed. I wanna return the Filepath of the imagefield, any idea?
>  This solution I found doesn't return anything....
>
>  function
>  phptemplate_views_handle_field_exportcsv_node_data_field_foto1_field_foto1_f
>  id($fields, $field, $data){
>   $q = db_query('SELECT filepath FROM {files} WHERE fid =
>  %d',$data->$field['queryname']);
>   return db_result($q);
>  }
>
>  Thank's!!!
>
>
>  ________________________________
>
>         De: development-bounces at drupal.org
>  [mailto:development-bounces at drupal.org] En nombre de Marolijo - Pol maresma
>         Enviado el: dimecres, 12 / març / 2008 15:19
>         Para: development at drupal.org
>         Asunto: [development] Modify Views CSV Export
>
>
>
>
>
>         Hello, I need to modify this function to allow it to export
>  imagefield as a full path, not full <img src=…> tag.
>         How can I filter the imagefield fields to do something like
>         If (fieldtype=imagefield){
>                 $value = $field ['filepath']
>         }else{
>                 ...
>         }
>
>         Thank's!!!
>
>         ////////////////////////////////////
>
>           foreach ($nodes as $node) {
>             $values = array();
>             foreach ($view->field as $field) {
>                 if ($fields[$field['id']]['visible'] !== false) {
>                 $value = views_theme_field('views_handle_field',
>  $field['queryname'], $fields, $field, $node, $view);
>                     $value = preg_replace('/<\/?(a|span|li|ul|div) ?.*?>/',
>  '', $value); // strip 'a' and 'span' tags
>
>                 $value = str_replace(array("\r", "\n", ','), ' ', $value);
>  // strip line breaks and commas
>                 $value = str_replace('"', '""', $value); // escape "
>  characters
>                 $value = decode_entities($value);
>                 $values[] = '"' . $value . '"';
>
>               }
>             }
>             $output .= implode(',', $values) . "\r\n";
>           }
>
>
>         Pol Maresma / pol at polnetwork.com <mailto:pol at polnetwork.com>
>
>         PolNetwork.com / Serveis d'Internet
>         msn: marolijo
>
>
>
>         __________ Información de NOD32, revisión 2940 (20080312) __________
>
>         Este mensaje ha sido analizado con NOD32 antivirus system
>         http://www.nod32.com
>
>
>
>
>



-- 
-
kindest regards
Maciej Perlinski
maciej.perlinski at meant4.com
http://www.meant4.com


More information about the development mailing list