custom .zfproject.xml file - zend-framework

Yall:
I'm trying to squeeze the Zend Framework into my ISP securely.
My ISP pretty much requires me to put much of the stack in a /private directory
in my HTDOCS Home.
So, it looks like this
/index.php
/private/application/configs
/private/application/controllers
/private/application/bootstrap.php
...
I tried editing the .zfproject.xml so indicate this, but ZF.bat/ZF.sh seems
to ignore this.
Anyone had any success with this type of configuration.

you should just set up the directory like this:
/private/MyProject/application
DONE! No need to modify the xml file

Unless you'll be using Zend_Tool you won't need zfproject.xml. This thread talks more about it.

Related

Setting the Expiry Headers for JS/Images

Please help to set the Expiry Header for files like JS/Images/CSS
Server : Linux
App Server : Jboss
I was getting some examples in internet to achieve similar thing using .htaccess files, but it not clear.
You can do that within an application by using a custom filter, like this.
But you did not explain the actual problem you are trying to solve. Your question sounds pretty unusual, so chances are high that what you really need is something completely different. You mention .htaccess file, and this means you have a web server, likely Apache, along with JBoss. Static contents (files like .css, .js, etc.) should normally be served by that server, not JBoss. Then, it's not JBoss that should set HTTP headers for them. Here you can find an explanation how it should be done in Apache.

Zend configuation file not linking correctly

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

Manually requesting the HAML file

If I want to manually request a particular HAML file in Sinatra, it looks like this works:
get '/' do
haml_file = File.open('views/index.haml').read
haml haml_file
end
My question is, do you have any reasons to believe that this is more inefficient than using the conventional method?
get '/' do
haml :index
end
Maybe Sinatra does a more "efficient" reading a file than what I did manually?
If my manual method is no good, please suggest an alternative way to manually get at the HAML file, located in a particular path. (reason being that the paths are not always that simple).
Are you saying you don't keep all your views in the same directory? That's a pain, but up to you. You could use Sinatra-Partial (I'm the maintainer) if it's getting at sub-directories of the view directory you need. Otherwise, what you've done is fine, it's difficult to see how it could improved the efficiency for such a small text file. The only thing you might want to add is headers for caching.
Additional:
This is pretty standard nowadays, right?
config.ru
app/
main.rb
public/
helpers/
models/
views/
mobile/
stylesheets/
whatever/
_partial1.haml
_partial2.haml
layout.haml
specs/

Zend Framework Bootstrap with Layout?

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.

How should I set up my application when I can't change the document root?

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.