zend-framework

How to solve the case when users surf to index.php

In Zend framework, using the MVC, if A user surf explicitly to http://base/url/index.php instead of just http://base/url, The system thinks the real base url is http://base/url/index.php/ and according to that calculates all the URLs in the system. So, if I have a controller XXX and action YYY The link will be http://base/url/index.php/...

Should I use a framework or write my own MVC?

I have a project that is currently all over the place and i'm thinking of making it MVC. The problem is that the system is currently being used and I can not change the interface (It's in frames :s) Also there are certain things that I will need to handle myself such as password generation, login and user levels. I already have the mod...

No Hits Found Using Zend Lucene Search

So I've been working on a crawler script to index all the pages on the my site using Zend Lucene search. I've been able to get the script to work but for some reason will not find the other links on the pages. The problem seems to be when the script hits the find method: $hits = $index->find('url:'.$targets[$i]); When I execute the sc...

Is there a particular approach to prevent CSRF/XSRF with Zend Framework?

Cross-site request forgery (CSRF or XSRF) attacks provokes unauthorised actions in your web application by users you believe to be trusted. That is surely something we would like to prevent, and I am particularly working with Zend Framework. Is there a Zend Framework approach to prevent CSRF/XSRF? ...

Zend Framework slow as molasses - need to speed the website up. Any ideas?

Hi guys, I'm working on a community based website using zend framework - but its so slow it takes a while for pages to load. I would like to know what aspects of the zend framework should I look into to ensure it runs much faster. Any tips and help would be greatly appreciated :) Nice advice - I took upon the database and indexed it ...

How do I force a user to be logged in to view any page?

I am playing about with the Zend Framework at the moment and I have a written the authentication code using Zend_Auth. I am trying to find a way to ensure that the user is logged in before they can view anything but I don't want to do it on a per controller basis. I am thinking a plugin, but all the books I have on it are pretty rubbish...

MAMP: Host Setup Questions

I'm just setting up my test environment, a few questions. I'm using MAMP, should my document root be pointed at the htdocs folder within MAMP? MAMP currently uses the php.ini file that's in .:Applications/MAMP/conf/php5/php.ini, how do I get it to use a php.ini that's in my /var/www/projectname/ folder? I'm getting the following error,...

What's the best way to issue a 301 redirect in this situation?

Hi all, I have a PHP5/Zend Framework 1.8.1 web site which is located at: http://www.example.com/foo The older version of this site, which infuriatingly, is still maintained by google's index was located at: http://www.example.com/foo/DEFAULT.ASP So a lot of people are requesting the above link and hitting a dead end. I figure, th...

Is there any way to put zip file in PHP's include_path?

Copying Zenf Framework everywhere is a nightmare, so I had an idea, thas deployment would be faster if whole framework would ba just a zip file. Is there a way to do that? Would it be very inefficient? ...

adding a Route to the a Router in Zend Framework

I am using the mod-rewrite router. I am trying to add a Route to the router that will convert the following url: baseurl/category/aaa/mycontroller/myaction/param/value to be: Controller=mycontroller action=myaction --parameters-- category=aaa param=value I am using the following (not working) in my bootstrap, _front is the ...

How to specify a dynamic default for a key in a router, Zend Framework

This question is linked to this one How can I set the default of the category part to be the category value in the request url? $Router=$this->_front->getRouter(); $CategoryRoute = new Zend_Controller_Router_Route('category/:category/:controller/:action/*', array( 'controller' => 'index', ...

Loading view file into a variable in Zend Framework

I am trying to send mail using mail templates. To do this I want to load a .tpl into a variable. Instead of loading an HTML file and substituting placeholders, I wonder if it is possible to set values of the view in the controller, and then load this view into a variable. This way I would have a variable containing the HTML mail filled o...

Registering Zend Database Adapter in Registry

Hi I am looking to register a reference to the main Database Adapter in the Registry during Bootstrapping so it can be used elsewhere in my site (specifically the Authorisation action). I have implemented an ugly fix where i create a Database Table object and call the getAdapter() method on it and pass through that. However, this is a ...

Zend Framework won't let me include Google Maps API

Hi! I'm experiencing this problem: I want to add the Google Maps API to my Zend Framework application using the HeadScript Helper in the bootstrap: $view->headScript() ->appendFile('/static/js/jquery-1.3.2.min.js') ->appendFile('/static/js/jquery-ui-1.7.1.min.js') ->appendFile("http://maps.google.com/maps?file=api&v=2&...

How to modify an attribute of a Zend_Form_Element in a Decorator

Is it possible to alter an html attribute of a Zend_Form_Element in a Decorator previously added ? Lets say I have a decorator named RichTextArea. When I add it to a Zend_Form_Element_Textarea, I want the decorator to add the class "rich" to the textarea. The final output should look like this : <textarea name="content" id="content" c...

How to use Zend Framework 1.8 unit testing?

Hello, In Zend Framework 1.8, using Zend_Tool, the framework now generates controllers, actions, etc. automatically. What it does is that it also creates a tests directory when creating a project. quickstart |-- application | |-- Bootstrap.php | |-- configs | | `-- application.ini | |-- controllers | | |-- ErrorControlle...

Is there a way to redirect the browser from the bootstrap in Zend Framework?

I need to redirect according to some conditions in the bootstrap file. It is done AFTER the front controller and routes are defined. How do I do that? (I know I can simply use header('Location: ....) The point is I need to use the Router to build the URL. ...

diacritics problem in project made with Zend Framework

Hi, found a interesting problem during testing our web application. I have application on localhost (Windows) and online testing server (Linux). Both are connected to same DB (on Linux server). When I tried to edit one text field through form in application located on Linux server it crop diacritics from result and save it to DB witho...

Rewrite rule not working

I've done the first steps in Zend Framework with akrabat.com/zend-framework-tutorial/. The Demo-App works fine, but the CSS. I think my rewrite rules are wrong. All hrefs looks like: /~cm/zf-tutorial/public/index.php/index/edit/id/1 /~cm/zf-tutorial/public/index.php/css/site.css The .htaccess is: RewriteEngine On RewriteCond %{REQU...

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. ...