2015年11月20日金曜日

関係副詞where

関係副詞whereは、先行詞が場所以外も使う。 point (重点、主眼点、要点) case (場合、実例) situation (状況、状態、立場) circumstance (事情、状況) condition (状態、条件) environment (環境) example (例) instance (例、場合) premise (前提) context (文脈、背景、場面)

2015年11月17日火曜日

CakePHPのサイトにPDFなどのファイルを載せる

cakePHPは基本的に「(サイトのアドレス)/コントローラー/アクション」という風にアドレスをrewriteするので注意

//パスを作る。
$dir_pdf  = APP.WEBROOT_DIR.DS."files".DS."pdf".DS;//'C:\dev\cakephp276\app\webroot\files\pdf\'
//debug($dir_pdf);
$files=array();
foreach (glob($dir_pdf."*.pdf") as $filename) {
  $files[] = basename($filename);
}
foreach($files as $file){
 /*webrootを参照*/
 
 echo $this->Html->link(
  $file,
  '/files/pdf/'.$file,
  array('target' => '_blank')
 );
 
 //ファイル名.pdf
 
 echo "
"; }