[fw-general] Re: re[fw-general] using view scripts across controllers.

2009-06-10 Thread staar2



Themselves wrote:
 
 Hi guys,
 
 I have a number of view scripts that are cut and paste across almost all
 of
 my view directories, basically templates that hold code to load a
 structural
 html / tabs / etc. These files are almost all  identical, so there is a
 very
 obvious case for removing these duplications, along with providing an
 override system if and when that particular action requires custom code.
 I've seen this page here:
 http://joshribakoff.com/2009/02/overridable-view-scripts-in-zend-framework/-
 and it does exactly what I want, but it also seems a little bit
 curious
 having to duplicate code across all of my actions / controllers in order
 to
 remove some duplicate code. Is there a better way of doing this?
 
 
I would use here custom made view
helpers(http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.custom)
and for more pure html code can be done with
partials(http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.partial)

-- 
View this message in context: 
http://www.nabble.com/reusing-view-scripts-across-controllers.-tp23956441p23957061.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] CRUD and modularity

2009-06-09 Thread staar2

Thank you all for replies, so what i have thought i ll make these CRUD code
manually. But the problem what i have now is the how to associate the
modules with admin area and how to make these easily addable. My current
solution is this.
Structure how the module will be
application/modules/news
application/modules/news/forms
application/modules/news/controllers
application/modules/news/views
application/modules/news/models

There must be two basic controllers:
*one for admin area indexController - you could access it with /news,
contains the CRUD(add, view, edit, delete actions)
*other which goes to /application/controllers  - controller name will be
moduleController example newsController, contains only view part (view
action only)
*model will be same for these controllers.

So any suggestions or ideas ?


staar2 wrote:
 
 I thought to use modular design and make some simple modules 
 
 guestbook
 admin area
 comment area
 feedback
 polls
 news
 content managment
 
 But all these requires almost same CRUD functionality, forms are different
 database tables and presentation code. But mostly the code keeps to be
 same in controller part. Currently i am thinking to write this code
 manually so i wanted to ask for ideas for different approach.
 

-- 
View this message in context: 
http://www.nabble.com/CRUD-and-modularity-tp23920809p23950050.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] CRUD and modularity

2009-06-08 Thread staar2

I thought to use modular design and make some simple modules 

guestbook
admin area
comment area
feedback
polls
news
content managment

But all these requires almost same CRUD functionality, forms are different
database tables and presentation code. But mostly the code keeps to be same
in controller part. Currently i am thinking to write this code manually so i
wanted to ask for ideas for different approach.
-- 
View this message in context: 
http://www.nabble.com/CRUD-and-modularity-tp23920809p23920809.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend Studio 6 phpUnit and Zend Framework

2008-04-18 Thread staar2

As the new feature of Zend Studio it has phpUnit Gui where you can simply
click and it runs the tests. But i dont get it working with Zend Framework.
Current tests structure is same as the normal one.

Test code is taken mostly from here http://www.alexatnet.com/node/12

After running code get error, something wrong with the phpUnit libraries?
Also tested just simple $this-AssertEquals('o', 'o'); worked.

Fatal error: Uncaught exception 'InvalidArgumentException' in F:\Program
Files\Zend\Zend Studio for Eclipse -
6.0.0\plugins\com.zend.php.phpunit_6.0.0.v20080107\resources\library\PHPUnit\Framework\TestSuite.php:300
Stack trace: #0 F:\wamp\www\zend\tests\AllTests.php(34):
PHPUnit_Framework_TestSuite-addTestSuite('IndexController...') #1
F:\wamp\www\zend\tests\AllTests.php(42): AllTests-__construct() #2
[internal function]: AllTests::suite() #3 F:\Program Files\Zend\Zend Studio
for Eclipse -
6.0.0\plugins\com.zend.php.phpunit_6.0.0.v20080107\resources\ZendPHPUnit.php(76):
call_user_func(Array) #4 F:\Program Files\Zend\Zend Studio for Eclipse -
6.0.0\plugins\com.zend.php.phpunit_6.0.0.v20080107\resources\ZendPHPUnit.php(549):
ZendPHPUnitSuite::suite() #5 {main} thrown in F:\Program Files\Zend\Zend
Studio for Eclipse -
6.0.0\plugins\com.zend.php.phpunit_6.0.0.v20080107\resources\library\PHPUnit\Framework\TestSuite.php
on line 300


-application
--default
---controllers
indexController.php
---models
---views

-html
--index.php

-library
--zend
--my

-tests
-AllTests.php
-application
--default
---controllers
indexControllerTest.php
---models

AllTests.php code
?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'on');
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR .
'../library' . PATH_SEPARATOR . '../application/models' . PATH_SEPARATOR .
'../library/My');
ini_set('xdebug.collect_params', '4');


require_once 'Zend/Loader.php';

Zend_Loader::registerAutoload();


$front = Zend_Controller_Front::getInstance()
//-setBaseUrl('')
//-setControllerDirectory(array(
//  'default ' = '../application/default/controllers',
//  'news' = '../application/news/controllers'))
-addModuleDirectory('../application/')
//-registerPlugin(new Zend_Controller_Plugin_ErrorHandler())
-setControllerDirectory('../application/default/controllers')
-throwExceptions(true);

require_once 'application/default/controllers/indexControllerTests.php';
/**
 * Static test suite.
 */
class AllTests extends PHPUnit_Framework_TestSuite {

/**
 * Constructs the test suite handler.
 */
public function __construct() {
$this-setName ( 'AllTests' );
$this-addTestSuite('IndexControllerTests');

}

/**
 * Creates the suite.
 */
public static function suite() {
return new self ( );
}
}



IndexControllerTests.php code

?php


/**
 * IndexController test case.
 */
class indexController extends PHPUnit_Framework_TestCase {

/**
 * @var IndexController
 */
private $IndexController;

/**
 * Prepares the environment before running a test.
 */
protected function setUp() {
parent::setUp ();

// TODO Auto-generated indexController::setUp()


$this-IndexController = new IndexController(/* parameters */);

}

/**
 * Cleans up the environment after running a test.
 */
protected function tearDown() {
// TODO Auto-generated indexController::tearDown()


$this-IndexController = null;

parent::tearDown ();
}

/**
 * Constructs the test case.
 */
public function __construct() {
// TODO Auto-generated constructor
}

/**
 * Tests IndexController-aboutAction()
 */
public function testAboutAction() {
// TODO Auto-generated indexController-testAboutAction()
$this-markTestIncomplete ( aboutAction test not implemented 
);

$this-IndexController-aboutAction(/* parameters */);

}

/**
 * Tests IndexController-contactAction()
 */
function testMainUseCase() {
// User opens http://localhost/main/user/register 
$front = Zend_Controller_Front::getInstance();
$request = new
Zend_Controller_Request_Http('http://localhost/zend/demo_app/index.php');
$response = new Zend_Controller_Response_Http();
   
$front-returnResponse(true)-setRequest($request)-setResponse($response);
// System shows registration screen by invoking registerAction().
// This action 

Re: [fw-general] Best way to load Zend_Form_Element_* classes

2008-04-08 Thread staar2



Mark Steudel-3 wrote:
 
 Hi All,
 
  
 
 I'm just using components of the Zend Framework in my application, and one
 of those is Zend_Form which in my header file I'm loading like:
 
  
 
 Zend_Loader::loadClass('Zend_Form');
 
  
 
 But when I go to instantiate a text element like:
 
  
 
 $usrename = new Zend_Form_Element_Text( 'username');
 
  
 
 I got the Class 'Zend_Form_Element_Text' not found error. So I tried
 loading
 the Zend_Form_Element_Text class like so:
 
  
 
 Zend_Loader::loadClass('Zend_Form_Element_Text');
 
  
 
 My question is do I really need to load each element, I'm figuring there
 must be a cleaner way to do load each form element class.
 
  
 
 Thanks, Mark
 
 
 

i would write in the index.php file top of the code
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

Then you dont need to load each class seperatly
-- 
View this message in context: 
http://www.nabble.com/Best-way-to-load-Zend_Form_Element_*-classes-tp16571099p16571332.html
Sent from the Zend Framework mailing list archive at Nabble.com.