Save to .csv file
20 posts by 4 authors in: Forums > CMS Builder
Last Post: November 30, 2010 (RSS)
Thanx........... Ragi
northernpenguin
Northern Penguin Technologies
"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke
Re: [northernpenguin] Save to .csv file
By Chris - June 28, 2010
Here's the line you have which links to the CSV file:
<center><a href="?as_csv=1&<?php echo @$_SERVER['QUERY_STRING'] ?>">Download these results in CSV format</a></center>
QUERY_STRING won't contain all the form data. I noticed that you solved the problem a few lines below though!
Try changing this:
<center><a href="?as_csv=1&<?php echo @$_SERVER['QUERY_STRING'] ?>">Download these results in CSV format</a></center>
<br />
<div class="searchblock">
<table cellpadding="3">
<?php $query="";
foreach($_REQUEST as $key=>$value){
if($key!="orderBy"){
$query.="$key=$value&";
}
}
?>
... to this:
<?php $query="";
foreach($_REQUEST as $key=>$value){
if($key!="orderBy"){
$query.="$key=$value&";
}
}
?>
<center><a href="?<?php echo $query ?>as_csv=1">Download these results in CSV format</a></center>
<br />
<div class="searchblock">
<table cellpadding="3">
Does that help? Please let us know if you have any questions.
Chris
By northernpenguin - June 29, 2010 - edited: June 29, 2010
Worked great!
Thank you
Ragi
northernpenguin
Northern Penguin Technologies
"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke
How can I fix this?
northernpenguin
Northern Penguin Technologies
"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke
Re: [northernpenguin] Save to .csv file
By Chris - November 26, 2010
I'm guessing you added something like the line in red?
list($dms_home_pageRecords, $dms_home_pageMetaData) = getRecords(array(
'tableName' => 'dms_home_page',
'limit' => 15,
));
// if the user has supplied "as_csv" in query string
if (@$_REQUEST['as_csv']) {
Try this:
$limit = 15;
if (@$_REQUEST['as_csv']) {
$limit = ''; // no limit for 'as_csv' requests!
}
list($dms_home_pageRecords, $dms_home_pageMetaData) = getRecords(array(
'tableName' => 'dms_home_page',
'limit' => $limit,
));
// if the user has supplied "as_csv" in query string
if (@$_REQUEST['as_csv']) {
Does that help? Please let me know if you have any questions.
Chris
By northernpenguin - November 29, 2010 - edited: November 29, 2010
ragi
northernpenguin
Northern Penguin Technologies
"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke
Re: [northernpenguin] Save to .csv file
By Chris - November 29, 2010
Is that not what you wanted? If not, please explain to me exactly how you want things to work.
Chris
Hope this clears things up.
Thanx.......... Ragi
northernpenguin
Northern Penguin Technologies
"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke
Re: [northernpenguin] Save to .csv file
By Chris - November 29, 2010
Oh! Is this what you're looking for?
$perPage = 15;
if (@$_REQUEST['as_csv']) {
$perPage = ''; // no limit for 'as_csv' requests!
}
list($dms_home_pageRecords, $dms_home_pageMetaData) = getRecords(array(
'tableName' => 'dms_home_page',
'perPage' => $perPage,
));
// if the user has supplied "as_csv" in query string
if (@$_REQUEST['as_csv']) {
Chris
Thanx Chris
northernpenguin
Northern Penguin Technologies
"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke