Prevent Joomla 2.5.8 from stripping out \t \n in a component - Joomla! Forum - community, help and support


i trying create excel spreadsheet file custom joomla 2.5.8 front end component. have found these urls have examples of this: viewtopic.php?p=2638207 (joomla 1.5) , https://groups.google.com/forum/?fromgr ... iye99aacxa (joomla 1.6).

there must change in how \t , \n tags handled joomla 2.5.8 because when run php code standalone php program outside of joomla excel spreadsheet created without problem but, when put code in custom joomla component, output placed in first cell. \t , \n being stripped away. scripts above same thing when add them component.

i have tried setting text filters in global configuration no filtering adding them white list. neither worked.

how prevent joomla 2.5.8 stripping out \t , \n tags?

here code:

<?php
// no direct access file
defined('_jexec') or die('restricted access');

$use_title = 1;
$db = jfactory::getdbo();
if(!isset($_post['volunter_roster'])){
echo 'you forgot select event date. please <a href="coordinators.html">click here go coordinator section , select date want volunteer roster.</a>';
} else {
$which_date_id=$_post['volunter_roster'];
$sql = "select distinct
volunteer_last_name,
volunteer_first_name,
volunteer_address1,
volunteer_address2,
volunteer_city,
volunteer_state,
volunteer_zip,
volunteer_email,
#__volunteer_roles.volunteer_role,
tee_shirt_size
from
#__volunteer,
#__volunteer_roles,
#__tee_shirt,
#__date_time
where
#__volunteer.event_date=$which_date_id
and
volunteer_tee_shirt_size=#__tee_shirt.id
and #__volunteer.volunteer_role=#__volunteer_roles.id
order by
volunteer_last_name,
volunteer_first_name
";
$db->setquery((string)$sql);
$results_volunteer = $db->loadobjectlist();
if($results_volunteer){

$query_get_date = $db->getquery(true);
$query_get_date->select('event_date,event_time, event_location');
$query_get_date->from('#__date_time');
$query_get_date->where("id=$which_date_id");
$db->setquery((string)$query_get_date);
$results_date = $db->loadobjectlist();
foreach($results_date $result_date) {
$date_time = date("f j, y", mktime(0, 0, 0, substr($result_date->event_date,5,2), substr($result_date->event_date,8,2), substr($result_date->event_date,0,4))). ' - ' . $result_date->event_time;
$location_id=$result_date->event_location;;
}
$query_get_location = $db->getquery(true);
$query_get_location->select('event_location_city');
$query_get_location->from('#__location');
$query_get_location->where("id=$location_id");
$db->setquery((string)$query_get_location);
$results_location = $db->loadobjectlist();
foreach($results_location $result_location) {
$location=$result_location->event_location_city;;
}
$title = "volunteer registration ". $location." on ".$date_time." of ".date('f j,-y h:i');
$ttype = trim($location);
if (isset($w) && ($w==1)){
$file_type = "msword";
$file_ending = "doc";
} else {

$file_type = "vnd.ms-excel";
$file_ending = "xls";
}
header("content-type: application/$file_type");
header("content-disposition: attachment; filename=$ttype.$file_ending");
header("pragma: no-cache");
header("expires: 0");
if ($use_title == 1){
echo "$title\n\n";
}
//define separator (defines columns in excel & tabs in word)
$sep = "\\t"; //tabbed character
echo "last name".$sep."first name".$sep."address 1".$sep."address 2".$sep."city".$sep."state".$sep."zip".$sep."e mail".$sep."role".$sep."tee shirt size";
echo "\n\n";
foreach($results_volunteer $result_volunteer){
echo $result_volunteer->volunteer_last_name.$sep;
echo $result_volunteer->volunteer_first_name.$sep;
echo $result_volunteer->volunteer_address1.$sep;
echo $result_volunteer->volunteer_address2.$sep;
echo $result_volunteer->volunteer_city.$sep;
echo $result_volunteer->volunteer_state.$sep;
echo $result_volunteer->volunteer_zip.$sep;
echo $result_volunteer->volunteer_email.$sep;
echo $result_volunteer->volunteer_role.$sep;
echo $result_volunteer->tee_shirt_size.$sep;
echo "\n";
}
}
}






Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

PProHeadless.exe has stopped working error when opening projects in Adobe Media Encoder CS6

Preconditions Failed. - Joomla! Forum - community, help and support