2009年3月2日星期一

Re: [fw-mvc] Proper use of Zend_Loader_Autoloader_Resource

I got one more question. See below.


Matthew Weier O'Phinney wrote:
> -- Cristian Bichis <contact@zftutorials.com> wrote
>
> Resource autoloading is different. It would be handled in one of two
> places: an initializer in your bootstrap, or via the "modules" bootstrap
> resource. This latter will (eventually) initialize a
> Zend_Application_Module_Autoloader instance (this is a concrete instance
> of Zend_Loader_Autoloader_Resource that has resources defined per the
> recommended directory structure) per module in your application, and, if
> a bootstrap class is available for that module, register it with that
> bootstrap.
>
> I say eventually, as neither Ben nor I have put together this last bit
> of functionality in the Modules resource yet.
>
Ok, so using code like this under bootstrap would be quite a standard
way ? No other way to simplify the code mroe than below:

protected function _initResources()
{
$this->bootstrapFrontController();

$loaders = array();

foreach ($this->front->getControllerDirectory() as $module => $dir)
{
$loaders[$module] = new Zend_Application_Module_Autoloader(
array(
'namespace' => ucfirst($module).'_',
'basePath' => dirname($dir),
) );

$loaders[$module]->addResourceType('Model', 'models', 'Model');
}
}

--
Best regards,
Cristian Bichis
www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com

[fw-mvc] Re: [fw-general] Re: Using custom router. Where exactly?

Any example for this? Since i saw that Matthew didn't use any router.

2009/3/2 Paweł Chuchmała <pawel.chuchmala@gmail.com>
On Mon, Mar 2, 2009 at 13:33, vadim gavrilov <vadimg88@gmail.com> wrote:
> Thanks i already looked at those files. Still can i place an instance of the
> addRoute inside a certain controller? or do i need to place it somewhere in
> the bootstarp file? Basically what i would like to do is to make a file that
> will hold all the routes for each module/controller. Did anyone made
> something like that before?

The best file is for me routes.ini. in config directory;-)
The rest in bootstrap initRoutes.

Regards,
pch

--
Paweł Chuchmała
pawel.chuchmala at gmail dot com



--
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.




[fw-mvc] Re: [fw-general] Re: Using custom router. Where exactly?

On Mon, Mar 2, 2009 at 13:33, vadim gavrilov <vadimg88@gmail.com> wrote:
> Thanks i already looked at those files. Still can i place an instance of the
> addRoute inside a certain controller? or do i need to place it somewhere in
> the bootstarp file? Basically what i would like to do is to make a file that
> will hold all the routes for each module/controller. Did anyone made
> something like that before?

The best file is for me routes.ini. in config directory;-)
The rest in bootstrap initRoutes.

Regards,
pch

--
Paweł Chuchmała
pawel.chuchmala at gmail dot com

Re: [fw-db] FileMaker Pro support in Zend_DB?

Joshua Beall wrote:
>
>
> Matthew Ratzloff wrote:
>>
>> Zend_Db is only for SQL-based RDMSes.
>
> You can issue SQL queries against FileMaker using an ODBC or JDBC
> connection. See "Using FileMaker Pro as a data source" here:
> http://www.filemaker.com/help/html/odbc.18.1.html
>
> Now, I've never done it, so I can't say how good their SQL support is.
> But it seems like in order to get some usefulness out of the Zend_Db_Table
> style interfaces, it would only need to be fairly basic.
>

I see there are two ODBC extensions for PHP:

http://us3.php.net/manual/en/book.uodbc.php
http://us3.php.net/manual/en/ref.pdo-odbc.php

Any idea which is the preferred one to use, especially if I'm going to try
to connect to FileMaker?

-Josh
--
View this message in context: http://www.nabble.com/FileMaker-Pro-support-in-Zend_DB--tp22212704p22287671.html
Sent from the Zend DB mailing list archive at Nabble.com.

[fw-mvc] Re: [fw-general] Re: Using custom router. Where exactly?

Thanks i already looked at those files. Still can i place an instance of the addRoute inside a certain controller? or do i need to place it somewhere in the bootstarp file? Basically what i would like to do is to make a file that will hold all the routes for each module/controller. Did anyone made something like that before?

Thanks.

On Mon, Mar 2, 2009 at 2:22 PM, Jens Kleikamp <jens@codes-concepts.com> wrote:
vadim gavrilov wrote:
Where exactly do you place the router? In the bootstrap file? in the index?
How can you make a custom router for each module you have? Examples will be
highly appreciated.

You can take a look at Matthews Pastebin application. He uses a modular directory structure and each module has its own bootstrap class. In these classes you have access to the Initialize plugin and the frontcontroller instance.

http://github.com/weierophinney/pastebin/blob/b796ad0e5905e46b312a5b904a2a80c3ed8ff808/library/My/Plugin/Initialize.php
http://github.com/weierophinney/pastebin/blob/b796ad0e5905e46b312a5b904a2a80c3ed8ff808/application/modules/spindle/Bootstrap.php

Now you can use the getRouter() method of the frontcontroller and then add new custom routes with addRoute().


Hope this helps.










--
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.




[fw-mvc] Re: Using custom router. Where exactly?

vadim gavrilov wrote:
> Where exactly do you place the router? In the bootstrap file? in the index?
> How can you make a custom router for each module you have? Examples will be
> highly appreciated.
>
You can take a look at Matthews Pastebin application. He uses a modular
directory structure and each module has its own bootstrap class. In
these classes you have access to the Initialize plugin and the
frontcontroller instance.

http://github.com/weierophinney/pastebin/blob/b796ad0e5905e46b312a5b904a2a80c3ed8ff808/library/My/Plugin/Initialize.php
http://github.com/weierophinney/pastebin/blob/b796ad0e5905e46b312a5b904a2a80c3ed8ff808/application/modules/spindle/Bootstrap.php

Now you can use the getRouter() method of the frontcontroller and then
add new custom routes with addRoute().


Hope this helps.

Re: [fw-mvc] Proper use of Zend_Loader_Autoloader_Resource

Thanks,

Ok, on my side using Zend_Apoplication seems was bugless based on your comments, so now things are working fine.

However, i didn't tested some of advanced functionalities, as module bootstrapping, aso.

--  Best regards, Cristian Bichis www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com

-- Cristian Bichis <contact@zftutorials.com> wrote (on Sunday, 01 March 2009, 09:05 PM +0200):   
Matthew Weier O'Phinney wrote:      Regarding the settings in questions 1, 3, and 4, these could be in a     config file as well, and you could simply pass the path to a config file     when instantiating Zend_Application. As an example, consider this:          $app = new Zend_Application(             APPLICATION_ENV,             APPLICATION_PATH .  '/configs/site.ini'         );      where APPLICATION_PATH . '/configs/site.ini' reads as follows:          [production]         phpSettings.display_errors = false         phpSettings.error_reporting = 771         autoloaderNamespaces.imagis = "Imagis_"         autoloaderNamespaces.phly = "Phly_"         includePaths.cwd = "."         includePaths.lib = APPLICATION_PATH "/../library"          [development : production]         phpSettings.display_errors = true         phpSettings.error_reporting = 8191      As you can see, this makes the application code simpler, and makes it     easier to switch settings per environment (which is also one of the     goals of Zend_Application).    Thanks for replies,  I have one more question:  It is possible to set bootstrap file from config.ini ?  //index.php $application = new Zend_Application(APPLICATION_ENVIRONMENT, APPLICATION_PATH .  '/config/config.ini' );  //config.ini bootstrap = APPLICATION_PATH.'/Bootstrap.php'     
 Try just this:      bootstrap = APPLICATION_PATH "/Bootstrap.php"  note the lack of "." and the double quotes. Also, ensure that the APPLICATION_PATH constant is set prior to instantiating Zend_Application.    
error: Warning: require_once(APPLICATION_PATH.'/Bootstrap.php') [function.require-once ]: failed to open stream: No such file or directory in D:\_Work\hostexpert2\ library\dasprid\Zend\Application.php on line 228  In am encountering error from above when trying to set bootstrap through config file.