Category Archives: Blog Admin

htaccess force download file

Using the below part of code inside your htaccess file, you restrict the browser to download the file instead of displaying it in a seperate tab.

Two versions of the code, one for many filetypes and the second just only for pdf:

Various file types:

<FilesMatch "\.(?i:doc|odf|pdf|rtf|txt)$">
  Header set Content-Disposition attachment

Only pdf:

<FilesMatch "\.(?i:doc|odf|pdf|rtf|txt)$">
  Header set Content-Disposition attachment

taken form the drupal comnunity forum

published date meta data from mysql timestamp

I am using the timestamp data type in mysql to keep track of when each row has been modified or inserted.


This saves the date in the database in the form of: 2015-11-24 13:55:10

I need to have a timestamp though, that will be used in the meta tags and will be in the following form :

<meta property="article:published_time" content="2013-09-17T05:59:00+01:00" />

as advised by opengraph guidelines. Googling a lot, and the following are the two candidates on which i ended up to:

date(DATE_ATOM, strtotime($row_getPost['blogpostimestamp']));

which echoes 2015-11-23T15:27:01+00:00



whch echoes 2015-11-23UTC15:27:01.00

The latter also includes the server timezone.

An alternative to this would be to convert the timestamp, during the query phase, which from what i read is not suggested, and of course did not work for me. Conversion in the php code allows you to use the timestamp with multiple forms in the same page e.g in meta and on footer notifying when this was published and by whom.