summaryrefslogtreecommitdiff
path: root/demos/blog-tutorial/protected/layout/MainLayout.php
diff options
context:
space:
mode:
authortof <>2007-08-27 07:16:27 +0000
committertof <>2007-08-27 07:16:27 +0000
commit7e884b51284e83b1604c9d029d3845e77e76d802 (patch)
tree050c205b14adef43b14d8970a13ea4ff4a8a3a1b /demos/blog-tutorial/protected/layout/MainLayout.php
parent37508534ac227c4e39ba8e9eb417d559a7bf0f3e (diff)
Add Internationalization to Blog-Tutorial
Diffstat (limited to 'demos/blog-tutorial/protected/layout/MainLayout.php')
-rw-r--r--demos/blog-tutorial/protected/layout/MainLayout.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/demos/blog-tutorial/protected/layout/MainLayout.php b/demos/blog-tutorial/protected/layout/MainLayout.php
index 253d6c03..4b5890de 100644
--- a/demos/blog-tutorial/protected/layout/MainLayout.php
+++ b/demos/blog-tutorial/protected/layout/MainLayout.php
@@ -1,7 +1,30 @@
<?php
class MainLayout extends TTemplateControl
-{
+{
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+
+ $this->languages->DataSource = TPropertyValue::ensureArray($this->Application->Parameters['languages']);
+ $this->languages->dataBind();
+ }
+
+ public function languageLinkCreated($sender, $param)
+ {
+ $item = $param->Item;
+ if($item->ItemType == TListItemType::Item || $item->ItemType == TListItemType::AlternatingItem)
+ {
+ $params = $this->Request->toArray();
+ $params['lang'] = $sender->DataKeys[$item->ItemIndex];
+ unset($params[$this->Request->ServiceID]);
+ $url = $this->Service->ConstructUrl($this->Service->RequestedPagePath, $params);
+ $item->link->NavigateUrl = $url;
+ if($this->Application->Globalization->Culture == $params['lang'])
+ $item->link->CssClass="active";
+ }
+ }
}
?> \ No newline at end of file