zend-framework

Zend - static and dynamic route

╄→гoц情女王★ 提交于 2020-01-16 19:58:06
问题 How should I prepare my routes to deal with it, instead of addictional parts in url? $routes = array( /** * Static */ 'news' => new Zend_Controller_Router_Route('news/:page', array('controller' => 'news', 'action' => 'index', 'page' => 1 ) ), /** * Dynamic */ 'thread' => new Zend_Controller_Router_Route(':slug/:page', array('controller' => 'Thread', 'action' => 'index', 'page' => 1 ) ), e.g. example.com/ thread-name-slug it shows thread with slug thread-name-slug but when I visit example.com/

Can't access controller nore action in Zend Framework

余生颓废 提交于 2020-01-16 19:16:15
问题 In my Zend Framework project I have the following base URL http://domain/~myFolder If I access it like so, I can access the indexAction with no problem but if I try to access it explicitly like so: http://domain/~myFolder/index I can't, nore can I access different controllers or actions. It always says /public/index.php was not found on this server. How can I access the different controllers and actions in my project? Do I need to add a route? 回答1: Change the contents of the .htaccess file

Zend Framework Questions

房东的猫 提交于 2020-01-16 14:04:04
问题 I have two questions. First, I am in need of having a referral in my site. In PHP it would look like this: www.mysite.com/join?ref=100 and then on the page you would $_get(ref); Zend does not like this, so how do I implement this. The second question is how can I have a subdomain on my site with the framework. I want to put a forum on my site, and tried a subdomain and loaded it, but it will not work as Zend pushes everything through the index.php . So how do I make it exist on the same site.

Zend Framework Questions

℡╲_俬逩灬. 提交于 2020-01-16 14:02:14
问题 I have two questions. First, I am in need of having a referral in my site. In PHP it would look like this: www.mysite.com/join?ref=100 and then on the page you would $_get(ref); Zend does not like this, so how do I implement this. The second question is how can I have a subdomain on my site with the framework. I want to put a forum on my site, and tried a subdomain and loaded it, but it will not work as Zend pushes everything through the index.php . So how do I make it exist on the same site.

Zend Form Custom Validation Path issues

人走茶凉 提交于 2020-01-16 13:22:08
问题 The issue: Plugin by name 'Spam' was not found in the registry; used paths: Zend_Validate_: Zend/Validate/ I have this on my bootstrap.php file (it's NOT a class): include_once 'config_root.php'; set_include_path ( $PATH ); require_once 'Initializer.php'; require_once "Zend/Loader.php"; require_once 'Zend/Loader/Autoloader.php'; // Set up autoload. $loader = Zend_Loader_Autoloader::getInstance (); $loader->setFallbackAutoloader ( true ); $loader->suppressNotFoundWarnings ( false ); //resource

Unit Testing With SimpleTest in PHP keeping getting file directory errors from relative paths?

删除回忆录丶 提交于 2020-01-16 08:45:48
问题 I am using Zend Framework MVC and unit-testing with SimpleTest library. I have a specific model that keeps failing because it uses Zend Cache and the cache directory is a relative path I was wondering if anyone has seen a problem like this b4. Thanks. 回答1: I had to make an absolute path using $_SERVER['DOCUMENT_ROOT'] that way no matter what file structure I am on it works. a Truly relative path. lol. 来源: https://stackoverflow.com/questions/1463557/unit-testing-with-simpletest-in-php-keeping

Zend Framework 2 Db: Make a part of the query negative using Predicate objects

一个人想着一个人 提交于 2020-01-16 04:50:07
问题 How do you negate a part of the query using Zend Framework 2? I'm trying to do the Zend\Db equivalent of this dynamic MySQL query-part: NOT (`a` = 1 AND `b`IS NULL AND `c` LIKE 'foo') Right now I have the three query-parts as Predicate objects (Operator, IsNull and Like objects) . How can I negate these and put in the where? Is it possible to convert a Predicate object (like an Operator or IsNull object) to a Sql String? 回答1: Zend dose not have a out of box solution for this , I wrote a class

How should changes to MVC objects be propagated?

泪湿孤枕 提交于 2020-01-16 04:45:11
问题 This is a follow-up to a previous question: Should sub-objects be fetched in the Model or the Model Mapper? Let's say a User can have one or more PhoneNumber objects. According to the answer in the above question, these sub-objects will be fetched upon instantiation of the User. If I were to delete a PhoneNumber from the User's phoneNumbers property (an array of PhoneNumbers), or modify one of the PhoneNumber objects, where should this change be propagated? Should I manually delete/update the

Problems with zend-tool reporting that providers are not valid

孤人 提交于 2020-01-16 04:19:09
问题 I have recently setup XAMPP 1.7.3 and ZendFramework 1.10.4 on a new computer and many of the commands that I normally use now fail. Here are the steps I used to setup and test ZF. First I added the ZF library folder (C:\xampp\php\ZendFramework-1.10.4\library) to the include path in php.ini. Then I added the ZF bin folder (C:\xampp\php\ZendFramework-1.10.4\bin) to my Path system variable. To test that everything is configured correctly I ran the command "zf show version" from the command line.

Prepare MySQL statement with IN() function

空扰寡人 提交于 2020-01-16 00:51:12
问题 Now I do: $params = array(1,2,3); $sql = 'select * from foo where bar in (%s)'; $sql = sprintf($sql, implode(',', $params) ); $params is supplied by a user so it's obviously unsafe. How can I fix this? I would prefer using a framework like Zend. 回答1: You could use prepared statements with PDO: $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass); $params = array(1,2,3); $values = implode(',', array_fill(0, count($params), '?')); // ?,?,? $sql = "select * from foo where bar in (