ロジックとデザインの分離 前回は、PHPのテンプレートエンジンとして広く利用されている「Smarty」を取り上げました。Smartyを活用すれば、foreachによるループ処理や連想配列などを利用し、ロジックとデザインを分離することができます。 今回はこれを踏まえて、第10回までに作成してきた「簡易オンラインストア」のロジックとデザインを、Smartyを用いて分離します。また、テンプレートを動的に切り替えることで、携帯電話用コンテンツとPC用コンテンツの両方を同時に実現する方法を紹介します。 続・Smartyの基本構文 前回は、foreachによるループ処理と連想配列、入れ子といった基本構文を紹介しました。引き続きSmartyのテンプレートを見ていきましょう。 テンプレートの動的切り替え「smarty6.php/template6_pc.tpl/template6_mobile.tpl/t
改ページに対応した一覧表示プログラムApache + PHP + MySQL V5編 Vol.13 改ページに対応した一覧表示プログラムを紹介します。 Web+DBプログラミングの基礎 Apache + PHP + MySQL Version5編 Vol.13 改ページに対応した一覧表示プログラムを紹介します。 [前準備] サンプルプログラムを実行する前にデータベースtestにテーブル「tab2」を作成します。 また、サンプルプログラムで使用するテーブル「tab2」は サーバー名 --- localhost データベース名 --- test ユーザー名 --- root パスワード --- root で設定されていることを前提として 解説します。実際にテストするMySQL環境のサーバー名、データベース名、ユーザー名、パスワードと異なる場合は読みかえて対応してください。 ○テーブルtab2を
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く