i was trying to make something similar... actually was inspired by ror  :-)
may be i'll finish with my first release tomorrow ... too much distractions
with call of duty in our network rite now :-)
actually i was trying to make my life easier basically when creating
modules....
so from one place... add module name in bootstrap, create default module
cotnroller and views..
it will also create model for this module... a view file as well.. so that
you can start with ur customising rite away....




On 6/15/07, David Mintz <[EMAIL PROTECTED]> wrote:

Someone has probably already done something like this, probably better,
but if not -- enjoy.

#!/bin/bash
#
# zfsetup.sh
#
# sets up directory structure and some starter files for a new Zend
Framework application.
# first chdir into the dir under which you want to install the app files,
then run me.
# by DMintz, in humble gratitude. http://davidmintz.org/
#

if [ $# -ne 1 ]; then
    echo "usage: $0 app_name" 1>&2
    exit 1
fi

if [ ! -w . ]; then
    echo "you don't have write permission to `pwd`."
    exit 1;
fi

mkdir $1
cd $1

# make directories
mkdir controllers models views

# write an IndexController class
cat <<EOF >controllers/IndexController.php
<?php
require_once 'Zend/Controller/Action.php';

class IndexController extends Zend_Controller_Action
{
    public function indexAction()
    {
    }
}
EOF

# make more directories
mkdir views/scripts
mkdir views/scripts/index
mkdir views/scripts/error
mkdir views/helpers
mkdir views/filters


# write out an index.phtml view for indexAction()

cat <<EOF >views/scripts/index/index.phtml
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
/DTD/xhtml1-strict.dtd <http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>My first Zend Framework App</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>We are ready to rock.</p>
</body>
</html>
EOF

# write an ErrorController

cat <<EOF >controllers/ErrorController.php
<?php
/** Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';

class ErrorController extends Zend_Controller_Action
{
    public function errorAction()
    {
    }
}

EOF

# write an ErrorController class

cat <<EOF >controllers/ErrorController.php

<?php
/** Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';

class ErrorController extends Zend_Controller_Action
{
    public function errorAction()
    {
    }
}

EOF


cat <<EOF >views/scripts/error/error.phtml

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
/DTD/xhtml1-strict.dtd <http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Error</title>
</head>
<body>
    <h1>An error occurred</h1>
    <p>An error occurred; please try again later.</p>
</body>
</html>
EOF


# write a bootstrap file

CONTROLLER_PATH=`pwd`/controllers

cat <<EOF >index.php

<?php
require_once 'Zend/Controller/Front.php';
Zend_Controller_Front::run('$CONTROLLER_PATH');
EOF

# ... and a .htaccess

cat <<EOF >.htaccess
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
EOF

# move both index.ph and .htaccess to the web root dir

echo -n "Enter the full filesystem path to your web doc root (w/o trailing
slash): ";
read WEB_ROOT

if mv .htaccess index.php $WEB_ROOT/ ;
then
    echo "now just hit http://yoursite/ and see if it works!"
else
    exit 1
fi;
exit 0;



--
David Mintz
http://davidmintz.org/

Just a spoonful of sugar helps the medicine go down
In a most delightful way.

Reply via email to