Jump to content

simpli

Members
  • Posts

    165
  • Joined

  • Last visited

    Never

Everything posted by simpli

  1. Hi, I am progressing in my exploring of the MVC model. Now I have a conceptual question about the view that needs to be answered before I move on. Let's say I want to build a rich user interface application which will basically be one page where the user will be operating. I want on the left side to be a tree and whenever the user clicks on an item on the tree, I would display the relevant information about that item on the right side of the screen. I simplify a lot but I would have two divs (divTree and divDetails and they would each be one part of the screen. My question is how would I proceed? Should I have one big view that incorporates all that or should I have several smaller more modular views. Also, so far I have been working in silos where I would make one model, it's controller and one view. But it's not really realistic. If I have itemA and itemB they may map to each with their own controller, they may map to the same view. How do I adress that? Thanks for any input. JR
  2. ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' will do it.
  3. There is no constructor for Model_DbTable_CostTreePath(). I have a tree and I'm using a closure table to save the path of the items in my tree so along the tree comes a treepath and it's that variable that I'm trying to initialize in the tree class. This is the beginning of the class. After that I just have its method. Is that what you want to see? JR class Model_DbTable_CostTreePath extends Zend_Db_Table_Abstract { protected $_schema = 'test-company'; //Implementer registry et aller chercher le nom de la db pour chaque compagnie dans le registry protected $_name = 'CostTreePath'; protected $_primary = array('ancestor_id','descendant_id'); protected $_referenceMap = array( 'Ancestor' => array( 'columns' => 'ancestor_id', 'refTableClass' => 'Model_DbTable_Tree', 'refColumns' => 'node_id' ), 'Descendant' => array( 'columns' => 'descendant_id', 'refTableClass' => 'Model_DbTable_Tree', 'refColumns' => 'node_id' ), ); ....
  4. Hi, I am running leopard and I would like to know how I can output the list of a directory's structure to a file. When I get configuration problems, it's always useful to show my directory structure and I spent 30 minutes trying to find a program or a command that would allow me to obtain that to no avail. Anyone can help? Thanks, JR
  5. Hi, I am trying to create a class constructor to initialize some properties like this. class Model_DbTable_Tree extends Zend_Db_Table_Abstract { protected $_treePath; public function __construct() { $this->$_treePath = new Model_DbTable_CostTreePath(); } I unfortunately get an error I am working with ZF 1.8. Can anyone point to a possible solution? Thanks, JR
  6. Hi, thank you for the precision. It seems there's no way to declare a const array: I get the error message: Is there a workaround to that? Thanks, JR
  7. Hi, I want to declare an array constant to use as JSON header. I do the following but I get an error. class Model_DbTable_Tree extends Zend_Db_Table_Abstract { protected $_name = 'tree'; protected $_primary = 'node_id'; const $_JSON_HEADER = array("label" => "node_name", "identifier" => "node_id"); but I get an error message: I'm using Zend 1.8. Can anyone tell me how to declare that constant properly? Thanks, JR
  8. Hi, I have a starting and I want to concatenate some arrays to it. I use the newly discovered array_merge. The state of my original array is the following (from print_r) I then proceed to add one array at a time to it ( I am extracting the arrays from a database table). When I print_r that array, I see that it's in a different format than the first one. What Ihave is If you copy the different in a text editor you will be able to see them more clearly and see how they are structurally different. Now that I'm writing this post, as I am formatting the information I can see that the format is probably what's causing my error. Anyway when I merge_array the arrays, I get the following result: . The two set of arrays are really rows from the same table and I get the same columns for them both. so I expect to be able to merge. Can anyone tell me why it's not working? P.S. I obtain The first set with Zend db's fetchAll($select)->toArray(). The second I obtain through Zend db's $row->toArray(); One returns a rowset that I convert to array and the second a single row that I also convert to array. How can I add the rows that are returned to the first array (which seems to be an array of array). Thanks for any help clarifying. JR
  9. Hi, I am having trouble concatenating arrays. It's just not working. I have the following code: $rootItems = array(); foreach ($scenarios as $scenario) { $rootItems[] = $_treePath->getImmediateDescendants($scenario["node_id"]); } getImmediateDescendants returns an associative array as a result. When I get out of the loop, I expect $rooItems to hold an associative array that is the concatenation. For example if I have scenarios 1 and 2, I expect $rootItems to hold the cumulative information of the two scenarios. I was expecting an operation like $rootItems = rootItems + $_treePath->getImmediateDescendants($scenario["node_id"]); to allow me to do that but the documentation seems to be saying otherwise. I'm using php5 with a mysql database I'm pulling information from. Anyone can help? Thanks, JR
  10. Hi, I have a naive tree structure with a closure table under that format, where the first column is the parent and the second isthe children. this is in a table in my database. Can anyone tell me how to turn this into a hierarchical tree that can be displayed with dojo's tree widget? Thanks, JR
  11. Hi, I am using Zend 1.8. I have two tables, one parent and one dependant. The inferential integrity is defined at the table level. I do a couple of select and everything works fine. When I try to get the dependantrowset however, I get an error. In the 'findDependentRowset' method, I'm supposed to tell it the name of the class of the dependant table. The name of that class is Model_DbTable_CostTreePath and it's in the Models folder in my structure. I get an error message in the logs saying: I know it's trying to find the file corresponding to the class of my dependant table. I'm not quite sure how to do this however. Can anyone shed some light on this? Thanks in advance. here's the relevant extract of my code: ( I don't need to declare dependant table as I do that at the database level) Parent table: class Model_DbTable_Tree extends Zend_Db_Table_Abstract { protected $_schema = 'test-company'; //Implementer registry et aller chercher le nom de la db pour chaque compagnie dans le registry protected $_name = 'tree'; protected $_primary = 'node_id'; protected $_sequence = true; ...... dependant table: class Model_DbTable_CostTreePath extends Zend_Db_Table_Abstract { protected $_schema = 'test-company'; //Implementer registry et aller chercher le nom de la db pour chaque compagnie dans le registry protected $_name = 'CostTreePath'; protected $_primary = array('ancestor_id','descendant_id'); protected $_referenceMap = array( 'Ancestor' => array( 'columns' => 'ancestor_id', 'refTableClass' => 'tree', 'refColumns' => 'node_id' ), 'Descendant' => array( 'columns' => 'descendant_id', 'refTableClass' => 'tree', 'refColumns' => 'node_id' ), ); ........ The dependant table's model's controller: <?php class CostTreePathController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { $this->view->title = "Budget Objects - TreePath view"; $this->view->headTitle($this->view->title, 'PREPEND'); $tree = new Model_DbTable_Tree(); $Rowsetnew = $tree->find(5); $Row1 = $Rowsetnew->current(); $relatedRows = $Row1->findDependentRowset('Model_DbTable_CostTreePath', 'Ancestor'); $this->view->treePath = $treepath; } }
  12. simpli

    Camel Case

    Hi, I tought I wrote this post and posted it but I can't see it in the forums so here goes: I have a class called model called CostTreePath. I have to have my classes name like that as I find costtreepath to be unreadable. I also name my controller CostTreePath. From Zend's documentation I read that I should have access to my controller by entering the /applicationpath/cost-tree-path or /applicationpath/cost.tree.path. This doesn't work however. I get an error message when I enter this path. When I go to /applicationpath/costtreepath, my stuff is there and it works. This is a direct quote from the ZF doc. Is there something I understood wrong? Can anyone clarify why it's not the expected path that's working? Thanks JR
  13. Hi, I have some records that I return through a function as a rowset. I want to go through each row and echo it. I used zend's toarray function to turn the rowset into an set of arrays that I loop through. It was my understanding that this <td><?php echo $treePathRow->ancestor_id;?></td> would allow me to access the column ancestor_id of an row ( or in this case the array corresponding to it). In fact this it is that notation that works <td><?php echo $this->escape($treePathRow["ancestor_id"]);?></td> Isn't the '->' a valid way to get access to the data of an associative array? Thanks for clarifying. JR
  14. Thank you for your help. At least now I understand what's going on. I have set up the proper charset/collation on either side. I only have to do it for php. Unfortunately I am using Zend Framework, which I'm quite new at so I don't know how to specify this. I tried adding resources.db.charset = "utf8" to my application.ini code but with no success. Can anyone tell me how I should go about specifying this to php? As said before I am using an appplication.ini file for configuration. Here is my (stripped from private information) application.ini [production] phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" phpSettings.date.timezone = "EST" resources.db.adapter = PDO_MYSQL resources.db.params.host = localhost resources.db.params.username = uphpdev resources.db.params.password = asdewq resources.db.params.dbname = test-company resources.db.charset = "utf8" resources.layout.layoutpath = APPLICATION_PATH "/layouts" [staging : production] [testing : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1
  15. Hi, I have an error in my application but I cannot debug it because the exception capturing seems to be broken. Before, when there was a problem I would get a whole trace that would help me pinpoint where the error occured. Now all I get is message ?> Exception information: Message: exception->getMessage() ?> Stack trace: exception->getTraceAsString() ?> Request Parameters: request->getParams()) ?> I started nothing this when I installed Marc Liyanage's Php5 package. When I call zf from the command line (to create a controller or an action) I get the following message Warning: PHP Startup: Unable to load dynamic library './pdo.so' - (null) in Unknown on line 0 Do you think the two problems are related? How can I get a full stack? It's impossible for me to debug without. Thanks JR
  16. Hi, I am using phpmyadmin 3.1.5. Zend Framework with mysql 5.1.34. I have created fields that I want to be able to receive accented characters (french but other western accented characters as well). Firstly, in phpmyadmin, you use to be able to set the charset and the collation separately but now I only see a collation field where you have tons of options some of them look like charset options. My problem is if I enter accented characters through the web site, I see them fine in the browser but when I look in the database it comes out as jibberish (as if the browser wasnt reading the utf characters). When I look at the view page info with phpmyadmin, it's in UTF but the content language meta tag is not set so I guess that's why I don't see the data as I expect it. I also looked at the raw data with navicat. It still shows as jiberish. I was ready to assume that the data is stored ok and that both Navicat and phpmyadmin aren't showing it properly but I did one last test: I entered accented data directly in the database and showed it on the web page. To my surprise, the data that is entered and shows accented in the database shows up as gibberish on the web page. Can anyone tell me how I can ensure my data shows fine on both ends? Also, what is the proper way to enter the charset in phpmyadmin 3.1.5? Thanks for any help. JR
  17. Solved it by downloading Marc Liyanage's entropy. done configuring. Imma start coding.
  18. Hi, I've been going quite an adventure trying to use Zend with mysql on a mac. I didn't have the driver so after much googling, I found a site that gave me the instructions on how to compile the driver. Everything seems ok. phpinfo shows that mysql is enabled for pdo but when I try to run my action that retrieves data from the database I have an epic crash with the following error: Message: SQLSTATE[HY000]: General error: 2036 I followed the instructions at this page to compile the pdo driver http://discussions.apple.com/thread.jspa?threadID=1539743 My settings: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7l DAV/2 PHP/5.2.8 PDO: 5.0.67 mysql: 5.0.67 I would be truly eternally grateful to whoever could help me find the source of this problem. I can't wait to stop configuring and start coding. pdo_mysql PDO Driver for MySQL, client library version 5.0.67 and PDO drivers sqlite2, sqlite, mysql and mysql MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version 5.0.67 MYSQL_MODULE_TYPE external MYSQL_SOCKET /var/mysql/mysql.sock MYSQL_INCLUDE -I/usr/include/mysql MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient
  19. I run apache2 with php5 on Mac OS X Leopard. JR
  20. Hi, I am running an application with the Zend framework and it requires pdo_mysql. I got an error message saying the driver is not installed. When I check with phpinfo, the driver is indeed not installed. Can anyone tell me how to install or to activate the mysql pdo driver? Thanks, JR
  21. Hi, I tought I had solved my virtual server issue but I guess not. Here's my problem. I have defined two virtual hosts. The second one does not work except when I comment out the first one. In my log I see the following error message, which I have no idea how to deal with: VirtualHost 127.0.0.1:0 overlaps with VirtualHost 127.0.0.1:0, the first has precedence, perhaps you need a NameVirtualHost directive Here is my virtual hosts information (httpd.conf) NameVirtualHost * <VirtualHost 127.0.0.1> ServerName budgetobjects DocumentRoot /library/WebServer/Documents/budgetObjects/public ErrorLog /var/log/budgetobjects/errors.log CustomLog /var/log/budgetobjects/access.log common <Directory /library/WebServer/Documents/budgetObjects/public/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> <VirtualHost 127.0.0.1> ServerName zf-tutorial DocumentRoot /library/WebServer/Documents/zf-tutorial/public ErrorLog /var/log/zf-tutorial/errors.log CustomLog /var/log/zf-tutorial/access.log common <Directory "/library/WebServer/Documents/zf-tutorial/public"> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> This is my hosts file 127.0.0.1 localhost 127.0.0.1 budgetobjects 127.0.0.1 zf-tutorial 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost Can anyone tell me what is wrong with my config so I cannot have two virtual hosts working at same time? Thanks, JR
  22. I have tried that before and just did again, to no avail. I get the exaact same error message. JR
  23. I have told my bootstrap to use the default namespace <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initDoctype() { $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype('XHTML1_STRICT'); } protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'Default_', 'basePath' => dirname(__FILE__), )); return $autoloader; } } this is my application.ini file ( I am in the development environment) [production] [staging : production] [testing : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.db.params.dbname = APPLICATION_PATH "/../data/db/guestbook-testing.db" [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" resources.frontController.controllerDirectory = APPLICATION_PATH "/default/Controllers" resources.layout.layoutPath = APPLICATION_PATH "/default/layouts/scripts" resources.view[] = and this is my tree structure. I remove all the cases in the class name, even in the file name. I still get the error. the error i get is the following: Exception information: Message: Invalid controller class ("CompanyinfoController") Stack trace: #0 /Library/WebServer/Documents/Zend/library/Zend/Controller/Dispatcher/Standard.php(255): Zend_Controller_Dispatcher_Standard->loadClass('CompanyinfoCont...') #1 /Library/WebServer/Documents/Zend/library/Zend/Controller/Front.php(936): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #2 /Library/WebServer/Documents/Zend/library/Zend/Application/Bootstrap/Bootstrap.php(77): Zend_Controller_Front->dispatch() #3 /Library/WebServer/Documents/Zend/library/Zend/Application.php(303): Zend_Application_Bootstrap_Bootstrap->run() #4 /Library/WebServer/Documents/budgetObjects/public/index.php(26): Zend_Application->run() #5 {main} Request Parameters: array(3) { ["controller"]=> string(11) "companyinfo" ["action"]=> string(5) "index" ["module"]=> string(7) "default" } Do you notice that loadclass statement? It seems to still be looking for a CompanyinfoCon.. instead of companyinfo... Here is my tree structure. |____.DS_Store |____.zfproject.xml |____application | |____.DS_Store | |____Bootstrap.php | |____configs | | |____application.ini | |____default | | |____.DS_Store | | |____controllers | | | |____companyinfoController.php | | | |____ErrorController.php | | | |____IndexController.php | | |____layouts | | | |____.DS_Store | | | |____scripts | | | | |____layout.phtml | | |____models | | | |____.DS_Store | | | |____companiesInformation.php | | | |____companiesInformationMapper.php | | | |____DBTable | | | | |____companies_information.php | | |____views | | | |____.DS_Store | | | |____helpers | | | |____scripts | | | | |____.DS_Store | | | | |____companyinfo | | | | | |____index.phtml | | | | |____error | | | | | |____error.phtml | | | | |____index | | | | | |____index.phtml |____index.php |____js | |____test.js |____library | |____zend |____public | |____.htaccess | |____bkp simpleindex.php | |____index.php |____tests | |____application | | |____bootstrap.php | | |____controllers | | | |____CompanyInfoControllerTest.php | |____library | | |____bootstrap.php | |____phpunit.xml Thanks for any help
  24. Hi, I am trying to use my controller. When I put the path "http://budgetobjects/index.php" I get what I'm supposed to get. When I put http://budgetobjects/companyInfo, I get a Message: Invalid controller class ("CompanyinfoController"). I have the following class described in the CompanyInfoController.php file. <?php // application/controllers/CompanyinfoController.php class default_CompanyInfoController extends Zend_Controller_Action { public function indexAction() { $companyInfo = new Default_companiesInformation(); $this->view->entries = $companyInfo->fetchAll(); } } Can anyone tell me what is wrong with my code? Thanks, JR
  25. It works! Thanks,
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.