Tag Archive for header

iPhone Header

<meta name="viewport" content="width = 320" />
<meta name="viewport" content="initial-scale=1, user-scalable=no" />
<script type="application/x-javascript">
addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);

function hideURLbar(){
window.scrollTo(0,1);
}
</script>

source

PHP Ping link and return header status

function get_link_status($link)
{
  $ch = curl_init($link); 
  curl_setopt($ch, CURLOPT_NOBODY, 1); 
  $c = curl_exec($ch); 
  return (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
}

source

php header content type

header("Content-type:application/vnd.ms-word");
header("Content-Disposition:attachment;filename=test.doc");

header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:attachment;filename=test.xls");

header("Content-type:application/vnd.ms-PowerPoint");
header("Content-Disposition:attachment;filename=test.ppt");

source

Serve PDF file with PHP

// pdfString is the *contents* of a file.
// to serve a file that exists on the file system, use readfile() instead of print $pdfString

header('Content-Description: File Transfer');
header('Content-Type: application/pdf');
header('Content-Length: ' . strlen($pdfString));
header('Content-Disposition: attachment; filename=' . 'pdf_dynamic.pdf');
ob_clean();
flush();
print $pdfString;
exit;

source

Set a custom Section Header in a TableView on iPhone

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    NSString *sectionTitle = [self tableView:tableView titleForHeaderInSection:section];
    if (sectionTitle == nil) {
        return nil;
    }

    // Create label with section title
    UILabel *label = [[[UILabel alloc] init] autorelease];
    label.frame = CGRectMake(20, 6, 300, 30);
    label.backgroundColor = [UIColor clearColor];
    label.textColor = [UIColor colorWithHue:(136.0/360.0)  // Slightly bluish green
                                 saturation:1.0
                                 brightness:0.60
                                      alpha:1.0];
    label.shadowColor = [UIColor whiteColor];
    label.shadowOffset = CGSizeMake(0.0, 1.0);
    label.font = [UIFont boldSystemFontOfSize:16];
    label.text = sectionTitle;

    // Create header view and add label as a subview
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, SectionHeaderHeight)];
    [view autorelease];
    [view addSubview:label];

    return view;
}

source

Customize a file download (songs, PDFs, etc.)

header('Content-type: audio/mpeg');
header('Content-Disposition: attachment; filename="'.$name.'.mp3"');
readfile($link);

// We just need to provide the $name and $link variables for it to work.

source

Suppress certain page header – Crystal Reports

(PageNumber MOD 2) = 0

source

meta tag header

<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="revisit-after" content="28 days" />
<meta name="author" content="">
<meta name="distribution" content="Global" />
<meta name="robots" content="all" />

source

header moved permanently

<?php
header("Status: 301"); # 301 Moved Permanently
header("Location: <a href="http://" >http://</a>{$_SERVER['SERVER_NAME']}/blog");
exit;
?>

source

super over simplified cache control and expire header htaccess

ExpiresActive On
ExpiresDefault A6048000
FileETag none
Header unset Etag
Header unset Last-Modified
Header set Cache-Control "public"

<FilesMatch ".(pl|php|cgi|spl|scgi|fcgi|html?)$">
Header set Cache-Control "private, must-revalidate, proxy-revalidate"
ExpiresDefault A0
ExpiresActive Off
</FilesMatch>

source