I am new to the Zend framework and struggling to understand how the Zend .ini file configuration works. There seems to be very little documentation/tutorial regarding it.
I am trying to set up a system path for my images. I want to store images in the following folder:
C:\Dev\example_site\httpdocs\ep\resource\modelling_photos
I have tried to store the path to this folder in a .ini file but it did not link correctly. I suspect that I am still confused about how the .ini format works.
Does anyone know any good tutorials on this issue? For example, in what is shown below, what does the code on the left mean as opposed to the code on the right:
assets.asset.modelling_photos.path = resource/modelling_photos/%s-%s.%s
assets.asset.modelling_photos.base = local
You can recover the config options from the getOptions method of Bootstrap or create a custom resource loader that is more close to a DI system
Zend session initiation
Related
In my netbeans IDE I am creating one project.That project(Web Application) needs properties file.Since my application is having several packages.And all packages need to read this properties file in their code.So where should I place this java properties file.If I place the file out side of the packages that is under sourcepackages seperately,I am getting FilenotFound Exception.So where should I place it.
And one more doubt is if I want to change any content in the file in future where should I change the contents since it is present in Projects folder and under Files->build->classes folder also.From where should I modify it.From where the changes will be effected.
Please help.
Thank you.
Put your file under /src/resources/, then use it like below:
ResourceBundle props = ResourceBundle.getBundle("resources.config");
You may put this in any package. The point ist to read with
MyClass.getResourceAsStream("my.properties");
Read further here.
You always change in the project src folder. The build folder is only for building your app.
If you want to change the properties file on a deployed system you may put the properties into the WEB-INF folder and then access with ServletContext#getRealPath().
I put the .properties file in the same folder as the src and it works :)
Alright, so I'm working on Windows and here's my solution...
It actually doesn't matter much where you put the .properties file--but assuming you created the file in NetBeans and let it save to its default location, you can simply call the data with the full directory attached.
Just for reference, here's what I did:
SimpleDataSource sds = new SimpleDataSource("src\\simpledatasource\\mystuff.properties");
Notice you'll need to escape the backslash, so use two of them.
So, I have a problem and I have been searching forever about how to do this.
I want to have several project directories on my shared host but I want to be able to hit the public directory when someone types in the root directory for that project. I can't edit the httpd.conf to set up virtual hosts so I have been looking for alternative solutions.
Account Structure
/public_html
.../Project1
....../application
....../public
I stumbled on http://www.mauriciocuenca.com/blog/2009/03/two-or-more-zend-framework-projects-on-a-shared-host/ and followed the steps (modifying some stuff since it is outdated)
And I can get a single view to show up. The problem is, if I create a layout I can't get anything but the normal view to display. I think I am just missing a simple hook up.
Is the above solution the best for my situation?
You problem is not 100% clear, I can't figure out that you want to serve one site per shared host directory or all site from the same directory.
Although you can't edit httpd.conf, you can use .htaccess file. While using Zend you already use .htaccess (located in public dir). So you can write rules to make url based redirections.
I've started using Zend framework, and Im following this simple Zend form tutorial. The form is located in application/forms directory I have included the Zend framework in the Path (by going to computer properties). However when i access form.php page, i get this error:
Fatal error: Class 'Zend_Form' not found
I have also tried by copying the Zend folder from the Zend framework in the library folder of the application, however error still remains same. Thanks.
It sounds like you are confusing two notions: the system path and the include path.
The system path is an operating system concept. When you ask the OS to execute a command, the system path is a list of places to look for the executable.
In contrast, the include path is a PHP concept that tells PHP a list of folders in which to look for files invoked by PHP include/require statements.
Any path that you find in "Computer > Properties" is almost certainly the OS-level system path. What you need to do is to make sure the Zend folder on the PHP include path, either by moving the Zend folder or by modifying PHP's include path to include a point to the Zend folder.
In a typical ZF app, the include folder is set in index.php (the front controller). So, the only explanation for not finding Zend_Form is that the autoloader is not being instantiated.
If you are using Zend_Application, this happens automatically. However, it seems like you are bypassing public/index.php and the whole Zend_Application instantiation by trying to directly "access" a file called form.php directly. If this file contains only the definition of your form (extending Zend_Form), then the absence of autoloading could easily explain the error message you are getting.
I'd try instantiating the form in a controller action, by which time in the request processing cycle, the autoloading is probably already in place.
[At that point, given the file locations you cite, we might run into a resource-loader issue, but that's a somewhat different issue that can be handled by instantiating a Zend_Application_Module_Autoloader in your Bootstrap.]
It looks like you do not use Zend_Loader. You should focus on it.
You can also manually in your custom form class include Zend_Form class.
I am working on a shared project in Flash Builder 4. Our data is coming through web services. We have put the generated .as files into vss so that we can share them. What I can't figure out is how to import those files. I see the files that others have created under my services directory but I can't figure out how to get them to appear in my Data/Services view. Does anybody know how to do this?
It looks like this information is in a file with an .fml extension. This is located in your project.model directory. Besides the fact that you can't get to that file from within flash builder to check it out, I don't know that it is a good idea to source control a project file. We are looking at what options we have to help everyone maintain these service files.
I don't have permission to change the document root the /public/ directory so how should I set up my Zend Framework application to run from the current root directory? Using the Zend Framework 1.8 command line tool, I don't know if there is a way to tell it to create a directory structure this way.
If you can access only the upper level of web (i.e. - public), you should set index there and the whole application folder too. Create a .htaccess with
Deny from all
And put it into your /application.
Your configuration will be:
/application
/library
index.php
The simplest way without changing a lot of configuration, is to put everything in the public folder you mention into your public_html folder, then place all the other contents, like the application, and library folders into the directory up from public_html.
You can also throw everything into your public_html folder, although that is not recommended. Each class has options to provide a different path. For example on the Front_Controller, you can set the Controllers directory to wherever you want. There are options to specify different paths, but if you follow convention it is done for you.
Just use the quickstart guide and adjust according to it. Zend_Tool is still experimental anyway. Let me know if this helps.
So here's what I ended up doing:
Download the Quickstart sample code.
Move everything in public up to the main directory, along side application, library directories.
Alter include paths to library and application in index.php to point to the correct locations
I think that was all I had to do. ZF new how to the rest.
I don't think this is ideal however, as already mentioned, application directory becomes accessible from the web, but for now, it's getting the job done.