summaryrefslogtreecommitdiff
path: root/demos/quickstart
diff options
context:
space:
mode:
authorxue <>2005-12-28 18:31:03 +0000
committerxue <>2005-12-28 18:31:03 +0000
commit930c51a6d618d487105cd46c517f36c3b1fe3b44 (patch)
tree16a60f8fcb56dfa613c528b7abc253dcd9204751 /demos/quickstart
parentfaf4aa4f219e3bf6fdac4144112de58d2fdfd131 (diff)
Diffstat (limited to 'demos/quickstart')
-rw-r--r--demos/quickstart/protected/controls/RunBar.php23
-rw-r--r--demos/quickstart/protected/controls/RunBar.tpl4
-rw-r--r--demos/quickstart/protected/pages/Controls/Simple.page4
-rw-r--r--demos/quickstart/protected/pages/Samples/Hangman.page7
-rw-r--r--demos/quickstart/protected/pages/Samples/HelloWorld.page9
5 files changed, 34 insertions, 13 deletions
diff --git a/demos/quickstart/protected/controls/RunBar.php b/demos/quickstart/protected/controls/RunBar.php
new file mode 100644
index 00000000..0d20e0d4
--- /dev/null
+++ b/demos/quickstart/protected/controls/RunBar.php
@@ -0,0 +1,23 @@
+<?php
+
+class RunBar extends TTemplateControl
+{
+ public function getPagePath()
+ {
+ return $this->getViewState('PagePath','');
+ }
+
+ public function setPagePath($value)
+ {
+ $this->setViewState('PagePath',$value,'');
+ }
+
+ protected function onPreRender($param)
+ {
+ $pagePath=$this->getPagePath();
+ $this->RunButton->NavigateUrl="?page=$pagePath";
+ $this->ViewSourceButton->NavigateUrl="?page=ViewSource&path=/".strtr($pagePath,'.','/').'.page';
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/RunBar.tpl b/demos/quickstart/protected/controls/RunBar.tpl
new file mode 100644
index 00000000..14e57fc3
--- /dev/null
+++ b/demos/quickstart/protected/controls/RunBar.tpl
@@ -0,0 +1,4 @@
+<div class="runbar">
+<com:THyperLink ID="RunButton" Target="_blank" Text="Run Sample" />
+<com:THyperLink ID="ViewSourceButton" Target="_blank" Text="View Source" />
+</div> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Simple.page b/demos/quickstart/protected/pages/Controls/Simple.page
index dc2e768d..7242cded 100644
--- a/demos/quickstart/protected/pages/Controls/Simple.page
+++ b/demos/quickstart/protected/pages/Controls/Simple.page
@@ -6,9 +6,5 @@
<p>
<tt>TLabel</tt> displays a piece of text on a Web page. The text to be displayed is set via its <tt>Text</tt> property. If <tt>Text</tt> is empty, content enclosed within the <tt>TLabel</tt> component tag will be displayed. <tt>TLabel</tt> may also be used a form label associated with some control on the form. <tt>Text</tt> is not HTML-encoded when being rendered. Make sure it does not contain dangerous characters that you want to avoid.
</p>
-<div class="runbar">
-<a href="#">Run Sample</a>
-<a href="#">View Source</a>
-</div>
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Samples/Hangman.page b/demos/quickstart/protected/pages/Samples/Hangman.page
index 4541c8f9..e39b3e11 100644
--- a/demos/quickstart/protected/pages/Samples/Hangman.page
+++ b/demos/quickstart/protected/pages/Samples/Hangman.page
@@ -1,4 +1,5 @@
<com:TContent ID="body" >
+
<h1>Sample: Hangman Game</h1>
<p>
Having seen the simple "Hello World" application, we now build a more complex application called "Hangman Game". In this game, the player is asked to guess a word, a letter at a time. If he guesses a letter right, the letter will be shown in the word. The player can continue to guess as long as the number of his misses is within a prespecified bound. The player wins the game if he finds out the word within the miss bound, or he loses.
@@ -9,8 +10,6 @@ To facilitate the building of this game, we show the state transition diagram of
<p>
To be continued...
</p>
-<div class="runbar">
-<a href="?page=Samples.Hangman.Home" target="_blank">Run Sample</a>
-<a href="?page=ViewSource&amp;path=/Samples/Hangman/Home.php" target="_blank">View Source</a>
-</div>
+<com:RunBar PagePath="Samples.Hangman.Home" />
+
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Samples/HelloWorld.page b/demos/quickstart/protected/pages/Samples/HelloWorld.page
index 7f7e8538..1723d741 100644
--- a/demos/quickstart/protected/pages/Samples/HelloWorld.page
+++ b/demos/quickstart/protected/pages/Samples/HelloWorld.page
@@ -16,11 +16,10 @@ The code that a developer needs to write is merely the following event handler f
<pre class="source">
public function buttonClicked($sender,$param)
{
- $sender->Text="Hello World";
+ $sender-&gt;Text="Hello World";
}
</pre>
-<div class="runbar">
-<a href="?page=Samples.HelloWorld.Home" target="_blank">Run Sample</a>
-<a href="?page=ViewSource&amp;path=/Samples/HelloWorld/Home.php" target="_blank">View Source</a>
-</div>
+
+<com:RunBar PagePath="Samples.HelloWorld.Home" />
+
</com:TContent> \ No newline at end of file