Jump to content

Ravani

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by Ravani

  1. Hi everyone, I have developed a CMS with Zend but I'm not really happy with my plugins structure and I have decided to change it. I just like to know if it is easy to achieve what I want. This is the application structure: -- Application --- configs --- controllers --- forms --- models --- modules ---- admin ----- controllers ----- models ----- views ----- bootstrap.php --- views --- bootstrap.php What I want to do is add a directory named plugins under the map application and create a plugin structure like this: --- plugins ---- pages ----- contact ------ backend ------- ContactBackendController.php ------- views ------ frontend ------- ContactFrontEndController.php ------- views When you want to add a normal page you just go to admin/page/add , however when you want to add a contact page you will be redirected to the add action in the ContactBackendController. Is that possible and is that a smart way to handle this or are there better ways?
  2. You're right, however I'm getting this error: Fatal error: Declaration of LoginController::__construct() must be compatible with that of Zend_Controller_Action_Interface::__construct() in Seems like I need to add some arguments in the constructor but I don't really know which one.
  3. Thanks a constructor would be a good solution indeed, however it seems that the Zend Framework has trouble with that. So using DB_Object::getInstance() will be a good solution as well?
  4. Hi everyone, I was discussing this topic with one of my friends and both of us can't give a real answer to this. Example: class test { function a(){ $obj = new DB_TableObject(); //blabla bla $this->b($obj); } function b($object){ $object->getResults(); } } class test { function a(){ $obj = new DB_TableObject(); //blabla bla $this->b($obj); } function b(){ $obj = new DB_TableObject(); $object->getResults(); } } Which one is better? The first or the second solution?
  5. Thanks, do you have a simple example of that?
  6. Hi, I was wondering if anyone here has experience with the best way to preview a form? I want two buttons on the bottom of my form: submit and preview. When a visitor clicks on preview he will be given a preview of the submitted values where he can go back to make changes or click on submit to commit the values. Anyone has an idea to do this? Thanks!
  7. Ok thanks, I read the documentation and came to the conclusion that this is the easiest way for me to use it: function replaceContent($sContent) { $sContent = preg_replace_callback("'\[MENU-CARD\](.*?)\[/MENU-CARD\]'is", array($this,'loadMenuCard'), $sContent); $sContent = preg_replace_callback("'\[CONTACT-FORM\]'is", array($this,'loadContactForm'), $sContent); return $sContent; }
  8. Ok I solved the problem by putting loadMenuCard inside the replaceContent function. This way I can call the function without using $this-> However I'm not sure if this is a good solution though. If hope one of you guys know a better solution
  9. @MrAdam, I'm using your advice now however I'm getting an error. This is what I have now function replaceContent($sContent) { $aReplaceTags = array( "'\[MENU-CARD\](.*?)\[/MENU-CARD\]'is", "'\[CONTACT-FORM\]'is", ); $oLoadMenu = '$this->loadMenuCard'; //$oContactForm = 'process'; foreach($aReplaceTags as $aTag){ if($aTag == "'\[MENU-CARD\](.*?)\[/MENU-CARD\]'is"){ $sContent = preg_replace_callback($aTag, $oLoadMenu, $sContent); } } return $sContent; } And this is what I'm getting: Warning: preg_replace_callback() [function.preg-replace-callback]: Requires argument 2, '$this->loadMenuCard', to be a valid callback in C:\wamp\www\SamandCMS\application\views\helpers\ReplaceContent.php on line 39
  10. I saw it in an example. However I changed it into one backslash, it works for a simple output: "/\[MENU-CARD\](\w+)\[\/MENU-CARD\]/e" => '\1', This gives 2 as output but the output inside the function will be \1 again when using this: "/\[MENU-CARD\](\w+)\[\/MENU-CARD\]/e" => $this->loadMenuCard('\1'), When I output the $aReplaceTags array I get: Array ( [/\[MENU-CARD\](\w+)\[\/MENU-CARD\]/e] => \1 ['\[CONTACT-FORM\]'is] => Contactformulier ) That \1 should be 2 though.
  11. Thanks for the replies, I'm confused now. I tried the example: $aReplaceTags = array( "/\[MENU-CARD\](\w+)\[\/MENU-CARD\]/e" => $this->loadMenuCard('\\1'.strtoupper('\\2').'\\3'), "'\[CONTACT-FORM\]'is" => "Contactformulier", ); I still get the same result. If I output this value '\\1'.strtoupper('\\2').'\\3' outside of the function it gives me 2 which is correct however when I use the loadMenuCard function it gives me '\1\2\3' as output.
  12. I'm trying to use preg_replace but I can't get it working. function replaceContent($sContent) { $aReplaceTags = array( "'\[MENU-CARD\](.*?)\[/MENU-CARD\]'is" => '\\1', "'\[CONTACT-FORM\]'is" => "Contactform", ); return preg_replace(array_keys($aReplaceTags), array_values($aReplaceTags), $sContent); } This works great however when I change '\\1' into a function the output of '\\1' will always be 1. function replaceContent($sContent) { $aReplaceTags = array( "'\[MENU-CARD\](.*?)\[/MENU-CARD\]'is" => $this->loadMenuCard('\\1'), "'\[CONTACT-FORM\]'is" => "Contactform", ); return preg_replace(array_keys($aReplaceTags), array_values($aReplaceTags), $sContent); } Anyone knows what I am doing wrong?
  13. For those who are interested, the solution was quite simple. I deleted the local db parameters from the ini file and editted my _initDbRegistry function inside the bootstrap into: public function _initDbRegistry() { $this->bootstrap('multidb'); $multidb = $this->getPluginResource('multidb'); $dbName = $this->loadDatabase('customer'); $dbCustomer = array('host' => 'localhost', 'username' => 'root', 'password' => '', 'dbname' => $dbName, 'default' => true,); $dbCustomerAdapter = new Zend_Db_Adapter_Pdo_Mysql($dbCustomer); Zend_Db_Table::setDefaultAdapter($dbCustomerAdapter); Zend_Registry::set('db_local', $dbCustomerAdapter); Zend_Registry::set('db_remote', $multidb->getDb('remote')); }
  14. Hi everyone, I'm working on a Zend Framework project and I need to use two databases. I was wondering if it is possible to change the database configuration of application.ini within the bootstrap. This is what I am using at the moment: Bootstrap public function _initDbRegistry() { $this->bootstrap('multidb'); $multidb = $this->getPluginResource('multidb'); Zend_Registry::set('db_local', $multidb->getDb('local')); Zend_Registry::set('db_remote', $multidb->getDb('remote')); } application.ini resources.multidb.local.adapter = pdo_mysql resources.multidb.local.host = localhost resources.multidb.local.username = root resources.multidb.local.password = resources.multidb.local.dbname = system resources.multidb.local.default = true resources.multidb.remote.adapter = pdo_mysql resources.multidb.remote.host = localhost resources.multidb.remote.username = root resources.multidb.remote.password = resources.multidb.remote.dbname = customer resources.multidb.remote.default = false Ok the problem is that I want to change the dbname of remote. Is there any way of doing that? Is it possible to add the remote db configuration within the bootstrap? Why I want this is because the dbname needs to be variable. Anyone here with a solution?? Thanks!
  15. At the moment I am busy with two of my business partners with programming a CMS application with the Zend Framework. Despite thinking a lot about the development of the application I was having my doubts about the performance of it in future. The thing is that we want to have one CMS application hosted on our webserver and this will be used by all of our customers. Inside the application we can add customers and the application will then check which domain has requested the application so the information and pages of that domain will be showed to the visitor. This all sounds possible and we know how to create this application, but I wanted to know if there are any disadvantages that we didn't think about? The reason why we don't have a CMS system for each of our customer is because we want to be able to keep everything in control and this way its easier for us to upgrade the system.
  16. Could be 100 or more. Thanks, our initial plan was the one I provided in the topic start, but we had a long discussion about it yesterday and we decided to go for one database for our standard CMS and one database for our customers, so same solution as yours. We worked out the database model for our CMS and tomorrow we will work out the database model for our customers.
  17. Hello everyone, At the moment I am busy with developing a CMS application. This CMS application will be hosted on my own server and it will be used for multiple sites. The reason why I want to keep it all with myself is because all sites have the same functionalities so the CMS doesn't need any changes. Now I wanted to hear your opinions about the database model. I was thinking about the possibilities of using one database for all the websites that are going to use this CMS application. However I'd like to know if there are any disadvantages to do this and if you guys have better alternative ideas? What I was thinking about was something like this: Table Customers ID: 1, Name: X ID: 2, Name: Y Table Content ID: 1, Title: test, Customer_id: 1 ID: 2, Title: test2, Customer_id: 2 ID: 3, Title: test3, Customer_id: 2 This would be a good solution for myself, because I'm planning to use some of the database content to generate statistics of all the websites. However when I think about this solution, it just looks too simple and with lots of sites it will create lots of rows in one table, which could cause a problem (I think?). So I'd like to hear what you all think about it
×
×
  • 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.