C5test

以前にさくらに入れていた(さくらのデータベースのインポート可能容量不足で困らされたときのやつ。さくらのphpMyAdminでの設定の問題と分かった。WebArenaでは容量は大きかった。)concrete5で、様子を探ることにした。
一応は動いていた、自分も登録したはずが、3度登録しないとアクセスできなかったのは、原因不明である。
ドキュメントではconcrete5の基本知識 :: concrete5日本語公式サイトシングルページが求めるものかと思われたが、その入れ方が書いていない。

concrete5の基本知識 :: concrete5日本語公式サイト では 開発者向け・専門用語の解説
として、
シングルページ
「シングルページ」とは、ページタイプを持たないページのことを言います。シングルページは、サイトの中に直接リンクされ、管理画面からインストールする事により、concrete5サイトとリンクする事が出来ます。
シングルページの仕組みを勉強されたい方は
* ログイン
* 登録
* 管理画面の中にあるページ
を参考にして下さい。
とある。

管理画面の「ページとテーマ」の中に、「シングルページ」のタブがあり、その最下面に
シングルページを追加
追加したいページのアドレスを入力:(この機能は上級者向けです)
とある。
このアドレスとは、何のアドレスなのか? 既存のシングルページは多数見えており、それぞれにパスが例えば データベース /dashboard/reports/database とかあるのだが、実際にそのファイルが存在するのでもないようだ。(ちょっと、この部分今調査中。別のディレクトリを見たようで、実際に入っている場所があるみたい。)

concrete5 :: Going Beyond Page Types, Blocks and Themes どうもsingle pageとは、再利用するものではない場合に使うもののようで、別途複雑なことをしたい時に使えるともあるが、実際に置いてあるものは、単純なものばかりのように見える。
Single Pages
Single Pages are just like regular pages in a concrete5 site, with a few important differences that developers will appreciate.
何だって。どこが違う?
concrete5 :: Single PagesYes: single pages can contain block areas.
まあ、ここの手順によれば、シングルページを作るには
1 空のPHPページをsingle_pages/ ディレクトリに作る。まあ、これを”my_profile.php” としましょうか。この名前は URL でのパスになります (例えば “login.php” = http://www.yoursite.com/login”). これは concrete5 の命名慣習に拠っていまして、単語を分けるのにアンダースコア(下線)を使いますね (例えば “my_profile.php”)。
2 concrete5 のdashboardにログインします。 Themes & Page Types > Single Pages に行きまして。一番下で “Add a Single Page” を探して、名前を “my_profile” とか何でも、入れます。この欄では”.php” は入れませんです。
3 予定通りなら、これで管理ページは更新されて、あなたのシングルページがサイトのルートに追加されたでしょう。この名前とパーミッションの変更はできますし、ページ属性の追加もできますが、一つだけ出来ないのは、これのハンドルの変更でして、ハンドルはファイル名から導かれますので変更できません。
4 このシングルページをブラウザで見ましょうか。殆ど全部空白のページが見えると思います。この空白のPHPファイルを修正すれば、その内容がこのページで見えるはずです。

Customizing a Single Page’s Appearance
普通の業務で行われる事柄にあわせるべく、シングルページを包み込むようにテーマは出来ているんです。つまり、シングルページの中にヘッダーとフッターの情報を入れなくて済むような配慮が既になされておりまして、それが今使っているテーマでの”view.php” template です。
concrete/themes/default/view.php がそれなんですが、ちょっと見てみましょうか。

<?php print $innerContent?> という行があると思います。これがこのテンプレートでシングルページの中身が入れられる場所になります。

特定のテーマでシングルページをもっと柔軟に思い通りに使いたいなら、ここを変えられます。Want to change this? You can. If you need more flexible control over a single page within a particular theme, just include a file with the same name as your single page within the theme itself. That entirely file will be used as the single pages template, including the header, footer, etc… It can completely override the single page, too. (So, in our example above, once we have “my_profile” added as a single page, add “my_profile.php” to your active theme. This template will then be used instead of the single page.

Additional Notes

  1. Single pages do not all need to live at the root. Let’s say you want to build out the following single pages, for an e-commerce system:

http://www.yoursite.com/index.php/cart/ http://www.yoursite.com/index.php/cart/shipping/ http://www.yoursite.com/index.php/cart/billing/ http://www.yoursite.com/index.php/cart/checkout/

You’re going to need a single page for the cart view, the shipping view, the billing view, and the checkout view. Here’s how your filesystem would look:

single_pages/cart/view.php

single_pages/cart/shipping.php

single_pages/cart/billing.php

single_pages/cart/checkout.php

Notice that the first item in our list, view.php, automatically maps to the “/cart” view. If we only wanted the cart/ view, and none of the views beneath it, we could’ve dispensed with the directory, and just created

single_pages/cart.php

You can use single pages to extend existing concrete5 functionality, like the dashboard. For example, say you want to add another page into the concrete5 dashboard for some custom business forms. You want this form to be available at

http://www.yoursite.com/index.php/dashboard/my_business_forms/

Just add

single_pages/dashboard/my_business_forms.php

And add it through the single pages interface in the dashboard. The new page should show up immediately in the dashboard navigation.

Adding Interactivity

As mentioned, Single Pages are great for those parts of your site that solve custom problems, and will not need to be reused. This is typically because these pages offer some interactivity, whether its a search form, a lengthy multi-step business form, or forms that let you add/edit certain objects.

The keyword here is “form.” Single Pages are made for solving complex, interactive problems on your site. Once we have a single page in place, we’ll inevitably need to process some form that’s contained on it. That’s why we have controllers.

Read on for information on controllers.

カテゴリー: サイト構築, 日記 パーマリンク

コメントを残す