Permalink
Browse files

Completed working example

- Added layout script
  - Includes call to "echo $this->user" for widget
- Fixed view script logic
- Added a return; in handleLogin() when no POST is found
- Added placeholder for data/db/ directory
  • Loading branch information...
1 parent af86033 commit 9da22cf45a3aef5c7f083e7ef9db31422d22a258 @weierophinney committed Oct 2, 2010
View
8 widgets-as-helpers/.vimproject
@@ -8,6 +8,11 @@ widgets="/home/matthew/git/zf-examples/widgets-as-helpers" CD=. filter="*.php *.
ErrorController.php
IndexController.php
}
+ layouts=layouts {
+ scripts=scripts {
+ layout.phtml
+ }
+ }
models=models {
}
modules=modules {
@@ -80,8 +85,9 @@ widgets="/home/matthew/git/zf-examples/widgets-as-helpers" CD=. filter="*.php *.
}
library=library {
}
- public=public {
+ public=public filter="*.php *.js *.css .htaccess" {
index.php
+ .htaccess
}
tests=tests {
application=application {
View
1 widgets-as-helpers/application/configs/application.ini
@@ -11,6 +11,7 @@ resources.frontController.params.displayExceptions = 0
resources.modules[] =
resources.db.adapter = "pdo_sqlite"
resources.db.params.dbname = APPLICATION_PATH "/../data/db/application.db"
+resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
[staging : production]
View
12 widgets-as-helpers/application/layouts/scripts/layout.phtml
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
+ <title></title>
+</head>
+<body>
+<?php echo $this->user; ?>
+<?php echo $this->layout()->content; ?>
+</body>
+</html>
View
1 widgets-as-helpers/application/modules/user/helpers/HandleLogin.php
@@ -55,6 +55,7 @@ public function handleLogin()
if (!$request->isPost()) {
$this->renderLoginForm($form);
+ return;
}
if (!$form->isValid($request->getPost())) {
View
3 widgets-as-helpers/application/modules/user/views/scripts/login.phtml
@@ -1,6 +1,7 @@
<div id="login-widget">
- <?php if ($this->error): ?>
+<?php if ($this->error): ?>
<p class="error"><?php echo $this->escape($this->error) ?></p>
+<?php endif ?>
<?php
$this->form->setAction('#')
->setMethod('post');
View
5 widgets-as-helpers/application/modules/user/views/scripts/profile.phtml
@@ -1,7 +1,8 @@
+<?php $identity = (array) $this->identity; ?>
<div id="user-profile">
- <h4><?php echo $this->escape($this->identity['username']) ?></h4>
+ <h4><?php echo $this->escape($identity['username']) ?></h4>
<dl>
- <?php foreach ($this->identity as $field => $value): ?>
+ <?php foreach ($identity as $field => $value): ?>
<?php if ($field == 'username'):
continue;
endif ?>
View
0 widgets-as-helpers/data/db/.placeholder
No changes.

0 comments on commit 9da22cf

Please sign in to comment.