Search Results

Search found 4834 results on 194 pages for 'zend route'.

Page 8/194 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Split horizon, route filtering, and having RIPv2 announce a non-attached route to host

    - by Paul
    Routers A, B & C live at 10.1.1.1, 10.1.1.2 and 10.1.1.3 on a /24 metro Ethernet subnet. Each router also has its own private subnet on another interface. Router B's private subnet links thru a firewall to a 10.20.20.0 network at another organization. Router B redistributes to A and C several static routes for hosts on 10.20.20.0. However, a new host 10.20.20.5/32 must be reached via a different path that goes through router C. I know that C can advertise this host-based route with no problem, but I'd like to keep all my 10.20.20.x static routes in one place. So, how can B tell A via RIPv2 to send packets for 10.20.20.5/32 to C? So far it looks like I need no ip split-horizon on router B's 10.1.1.2 interface, perhaps because B has already learned from C other routes with a next hop of 10.1.1.3. But how does RIPv2 split horizon with no auto-summary and network 10.0.0.0 really work? If B learns a route to ANY 10.x.x.x network or host from A or C, is that enough for split horizon to keep it from redistributing ip route 10.20.20.5 255.255.255.255 10.1.1.3? And if I want to suspend split horizon only for this one new host, how do I filter out the mess of regurgitated routes that B advertises when I try no ip split-horizon? Thanks much.

    Read the article

  • Report generation in PHP (formats required pdf,xls,doc,csv)

    - by Ish Kumar
    I need to generate reports in my PHP website (in zend framework) Formats required: PDF (with tables & images) // presently using Zend_Pdf XLS (with tables & images) DOC (with tables & images) CSV (only tables) Please recommend robust and fast solution for generating reports in PHP. Platform: Zend Framework on LAMP I know there are some tricky solutions for creating such reports, i wonder is there any open source report generation utility that can be used with LAMP environment

    Read the article

  • Easier ASP.NET MVC Routing

    - by Steve Wilkes
    I've recently refactored the way Routes are declared in an ASP.NET MVC application I'm working on, and I wanted to share part of the system I came up with; a really easy way to declare and keep track of ASP.NET MVC Routes, which then allows you to find the name of the Route which has been selected for the current request. Traditional MVC Route Declaration Traditionally, ASP.NET MVC Routes are added to the application's RouteCollection using overloads of the RouteCollection.MapRoute() method; for example, this is the standard way the default Route which matches /controller/action URLs is created: routes.MapRoute(     "Default",     "{controller}/{action}/{id}",     new { controller = "Home", action = "Index", id = UrlParameter.Optional }); The first argument declares that this Route is to be named 'Default', the second specifies the Route's URL pattern, and the third contains the URL pattern segments' default values. To then write a link to a URL which matches the default Route in a View, you can use the HtmlHelper.RouteLink() method, like this: @ this.Html.RouteLink("Default", new { controller = "Orders", action = "Index" }) ...that substitutes 'Orders' into the {controller} segment of the default Route's URL pattern, and 'Index' into the {action} segment. The {Id} segment was declared optional and isn't specified here. That's about the most basic thing you can do with MVC routing, and I already have reservations: I've duplicated the magic string "Default" between the Route declaration and the use of RouteLink(). This isn't likely to cause a problem for the default Route, but once you get to dozens of Routes the duplication is a pain. There's no easy way to get from the RouteLink() method call to the declaration of the Route itself, so getting the names of the Route's URL parameters correct requires some effort. The call to MapRoute() is quite verbose; with dozens of Routes this gets pretty ugly. If at some point during a request I want to find out the name of the Route has been matched.... and I can't. To get around these issues, I wanted to achieve the following: Make declaring a Route very easy, using as little code as possible. Introduce a direct link between where a Route is declared, where the Route is defined and where the Route's name is used, so I can use Visual Studio's Go To Definition to get from a call to RouteLink() to the declaration of the Route I'm using, making it easier to make sure I use the correct URL parameters. Create a way to access the currently-selected Route's name during the execution of a request. My first step was to come up with a quick and easy syntax for declaring Routes. 1 . An Easy Route Declaration Syntax I figured the easiest way of declaring a route was to put all the information in a single string with a special syntax. For example, the default MVC route would be declared like this: "{controller:Home}/{action:Index}/{Id}*" This contains the same information as the regular way of defining a Route, but is far more compact: The default values for each URL segment are specified in a colon-separated section after the segment name The {Id} segment is declared as optional simply by placing a * after it That's the default route - a pretty simple example - so how about this? routes.MapRoute(     "CustomerOrderList",     "Orders/{customerRef}/{pageNo}",     new { controller = "Orders", action = "List", pageNo = UrlParameter.Optional },     new { customerRef = "^[a-zA-Z0-9]+$", pageNo = "^[0-9]+$" }); This maps to the List action on the Orders controller URLs which: Start with the string Orders/ Then have a {customerRef} set of characters and numbers Then optionally a numeric {pageNo}. And again, it’s quite verbose. Here's my alternative: "Orders/{customerRef:^[a-zA-Z0-9]+$}/{pageNo:^[0-9]+$}*->Orders/List" Quite a bit more brief, and again, containing the same information as the regular way of declaring Routes: Regular expression constraints are declared after the colon separator, the same as default values The target controller and action are specified after the -> The {pageNo} is defined as optional by placing a * after it With an appropriate parser that gave me a nice, compact and clear way to declare routes. Next I wanted to have a single place where Routes were declared and accessed. 2. A Central Place to Declare and Access Routes I wanted all my Routes declared in one, dedicated place, which I would also use for Route names when calling RouteLink(). With this in mind I made a single class named Routes with a series of public, constant fields, each one relating to a particular Route. With this done, I figured a good place to actually declare each Route was in an attribute on the field defining the Route’s name; the attribute would parse the Route definition string and make the resulting Route object available as a property. I then made the Routes class examine its own fields during its static setup, and cache all the attribute-created Route objects in an internal Dictionary. Finally I made Routes use that cache to register the Routes when requested, and to access them later when required. So the Routes class declares its named Routes like this: public static class Routes{     [RouteDefinition("Orders/{customerName}->Orders/Index")]     public const string OrdersCustomerIndex = "OrdersCustomerIndex";     [RouteDefinition("Orders/{customerName}/{orderId:^([0-9]+)$}->Orders/Details")]     public const string OrdersDetails = "OrdersDetails";     [RouteDefinition("{controller:Home}*/{action:Index}*")]     public const string Default = "Default"; } ...which are then used like this: @ this.Html.RouteLink(Routes.Default, new { controller = "Orders", action = "Index" }) Now that using Go To Definition on the Routes.Default constant takes me to where the Route is actually defined, it's nice and easy to quickly check on the parameter names when using RouteLink(). Finally, I wanted to be able to access the name of the current Route during a request. 3. Recovering the Route Name The RouteDefinitionAttribute creates a NamedRoute class; a simple derivative of Route, but with a Name property. When the Routes class examines its fields and caches all the defined Routes, it has access to the name of the Route through the name of the field against which it is defined. It was therefore a pretty easy matter to have Routes give NamedRoute its name when it creates its cache of Routes. This means that the Route which is found in RequestContext.RouteData.Route is now a NamedRoute, and I can recover the Route's name during a request. For visibility, I made NamedRoute.ToString() return the Route name and URL pattern, like this: The screenshot is from an example project I’ve made on bitbucket; it contains all the named route classes and an MVC 3 application which demonstrates their use. I’ve found this way of defining and using Routes much tidier than the default MVC system, and you find it useful too

    Read the article

  • Can't route specific subnet thru VPN in ubuntu

    - by Disco
    I'm having issues routing traffic thru VPN. Here's my setup I have 3 hosts, let's call them A, B and Z B and Z have a VPN connection in the 10.10.10.x SUBNET A and B have a direct connection in the 10.10.12.x SUBNET I want to be able to route traffic from A to Z, like : A <= 10.10.12.254 [LAN] 10.10.12.111 => B <= 10.10.10.152 [VPN] 10.10.10.10 => Z On host B, i have set up ip_forwarding : net.ipv4.ip_forward = 1 and routing on host B: [root@hostA: ~]# ip route 10.10.10.10 dev ppp0 proto kernel scope link src 10.10.10.152 10.10.12.0/24 dev eth1 proto kernel scope link src 10.10.12.111 10.10.10.0/24 dev ppp0 scope link 169.254.0.0/16 dev eth1 scope link routing on host A: [root@hostA: ~]# ip route 10.10.10.0 via 10.10.12.111 dev eth1 10.10.12.0/24 dev eth1 proto kernel scope link src 10.10.12.254 169.254.0.0/16 dev eth1 scope link default via 192.168.1.1 dev eth0 But still not able to ping 10.10.10.10 from host A. Any idea ? I'm pulling my hairs out.

    Read the article

  • Cisco ASA 5505 site to site IPSEC VPN won't route from multiple LANs

    - by franklundy
    Hi I've set up a standard site to site VPN between 2 ASA 5505s (using the wizard in ASDM) and have the VPN working fine for traffic between Site A and Site B on the directly connected LANs. But this VPN is actually to be used for data originating on LAN subnets that are one hop away from the directly connected LANs. So actually there is another router connected to each ASA (LAN side) that then route to two completely different LAN ranges, where the clients and servers reside. At the moment, any traffic that gets to the ASA that has not originated from the directly connected LAN gets sent straight to the default gateway, and not through the VPN. I've tried adding the additional subnets to the "Protected Networks" on the VPN, but that has no effect. I have also tried adding a static route to each ASA trying to point the traffic to the other side, but again this hasn't worked. Here is the config for one of the sites. This works for traffic to/from the 192.168.144.x subnets perfectly. What I need is to be able to route traffic from 10.1.0.0/24 to 10.2.0.0/24 for example. ASA Version 8.0(3) ! hostname Site1 enable password ** encrypted names name 192.168.144.4 Site2 ! interface Vlan1 nameif inside security-level 100 ip address 192.168.144.2 255.255.255.252 ! interface Vlan2 nameif outside security-level 0 ip address 10.78.254.70 255.255.255.252 (this is a private WAN circuit) ! interface Ethernet0/0 switchport access vlan 2 ! interface Ethernet0/1 ! interface Ethernet0/2 ! interface Ethernet0/3 ! interface Ethernet0/4 ! interface Ethernet0/5 ! interface Ethernet0/6 ! interface Ethernet0/7 ! passwd ** encrypted ftp mode passive access-list inside_access_in extended permit ip any any access-list outside_access_in extended permit icmp any any echo-reply access-list outside_1_cryptomap extended permit ip 192.168.144.0 255.255.255.252 Site2 255.255.255.252 access-list inside_nat0_outbound extended permit ip 192.168.144.0 255.255.255.252 Site2 255.255.255.252 pager lines 24 logging enable logging asdm informational mtu inside 1500 mtu outside 1500 icmp unreachable rate-limit 1 burst-size 1 asdm image disk0:/asdm-603.bin no asdm history enable arp timeout 14400 global (outside) 1 interface nat (inside) 0 access-list inside_nat0_outbound nat (inside) 1 0.0.0.0 0.0.0.0 access-group inside_access_in in interface inside access-group outside_access_in in interface outside route outside 0.0.0.0 0.0.0.0 10.78.254.69 1 timeout xlate 3:00:00 timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02 timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00 timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00 timeout uauth 0:05:00 absolute dynamic-access-policy-record DfltAccessPolicy aaa authentication ssh console LOCAL http server enable http 0.0.0.0 0.0.0.0 outside http 192.168.1.0 255.255.255.0 inside no snmp-server location no snmp-server contact snmp-server enable traps snmp authentication linkup linkdown coldstart crypto ipsec transform-set ESP-3DES-SHA esp-3des esp-sha-hmac crypto map outside_map 1 match address outside_1_cryptomap crypto map outside_map 1 set pfs crypto map outside_map 1 set peer 10.78.254.66 crypto map outside_map 1 set transform-set ESP-3DES-SHA crypto map outside_map interface outside crypto isakmp enable outside crypto isakmp policy 10 authentication pre-share encryption 3des hash sha group 2 lifetime 86400 no crypto isakmp nat-traversal telnet timeout 5 ssh 0.0.0.0 0.0.0.0 outside ssh timeout 5 console timeout 0 management-access inside threat-detection basic-threat threat-detection statistics port threat-detection statistics protocol threat-detection statistics access-list group-policy DfltGrpPolicy attributes vpn-idle-timeout none username enadmin password * encrypted privilege 15 tunnel-group 10.78.254.66 type ipsec-l2l tunnel-group 10.78.254.66 ipsec-attributes pre-shared-key * ! ! prompt hostname context

    Read the article

  • [Zend Framework - Ubuntu10.04- Lamp- First Project] i get 500 error on http://localhost/zftutorial/p

    - by meyosef
    Hi I new in Zend and Lamp, my software: Zend Framework, Ubuntu10.04,Lamp. I made my first Zend Project with Zend tool (according this tutorial http://akrabat.com/wp-content/uploads/Getting-Started-with-Zend-Framework.pdf) But when i go to http://localhost/zftutorial/public i get 500 error. My $ dir -l of zftutorial: drwxr-xr-x 6 root root 4096 2010-06-01 23:54 application drwxr-xr-x 2 root root 4096 2010-06-01 23:54 docs drwxr-xr-x 3 root root 4096 2010-06-02 00:23 library drwxr-xr-x 3 root root 4096 2010-06-02 00:00 nbproject drwxr-xr-x 2 root root 4096 2010-06-01 23:54 public drwxr-xr-x 4 root root 4096 2010-06-01 23:54 tests my:/etc/apache2/sites-available/default <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> Thanks,

    Read the article

  • PHP web application can't connect mysql installed with Zend Server CE on Mac OSX

    - by Kane
    I'm setting up development environment on Mac OSX. However the PHP web application can't connect the mysql server installed with Zend Server CE. The error information is below, [Type] dbnot_connect [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 61 Mysql database can be accessed via phpAdmin installed with Zend Server CE as well. The same code works well on Windows or Linux in Zend Server CE.

    Read the article

  • Trouble getting PHP, Apache, and Zend talking to eachother (localhost)

    - by Joel
    Hi guys, I've searched through several other questions, but haven't found my solution. THe main reason is that I'm not even sure if I have all these things properly installed. I have a hosting account, and have always just deployed everything into the internets, but I'm finally trying to figure out how to get my desktop set up right for learning Zend Framework. I have Apache Server 2.2, PHP, And Zend Framework installed. I'm trying to do this tutorial: http://akrabat.com/wp-content/uploads/Getting-Started-with-Zend-Framework.pdf The problem is when I click on the link: http://localhost/zf-tutorial/public I get an Error 404. If I type in http://www.localhost I get "It Works!" in the browser. I'm thinking this means I have Apache installed correctly, but am not pointing correctly to the Zend tutorial? Thanks for any help!

    Read the article

  • Zend form and dynamic file upload

    - by DoomStone
    Hello there i'm trying to create a form with Zend_Form that will enable my user to upload a unlited number of files to my site, witch is done by javascript. Something like <script type="text/javascript"> $(document).ready(function(){ var image_uploade_i = 0; $('#upload_more').click(function() { image_uploade_i++; $('#upload_list').append('<div id="image_uploade_id_'+image_uploade_i+'" style="display: none;"><input type="file" name="image[]" /><br /></a>'); $('#image_uploade_id_'+image_uploade_i).slideDown('slow'); }); }); </script> <?=$this->translate('Add images')?> <form action="" method="post" enctype="multipart/form-data"> <div id="upload_list"> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> </div> <a href="#" id="upload_more"><?=$this->translate('Upload another image')?></a><br /> <input type="submit" name="image_uploade" value="<?=$this->translate('Upload images')?>" /> </form> But i'm am unable to find out how i can create something like this with Zend_From, the only reason i want to use Zend_Form on this thoug is for validation of the uploadet files. $element = new Zend_Form_Element_File('image'); $element->setRequired(true) ->setLabel('Profile image') ->setDestination($store) ->setValueDisabled(true) ->addValidator(new Zend_Validate_File_ImageSize(array( 'minheight' => 100, 'minwidth' => 150, 'maxheight' => 1920, 'maxwidth' => 1200))) // File must be below 1.5 Mb ->addValidator(new Zend_Validate_File_FilesSize(array('max' => 1572864))) ->addValidator(new Zend_Validate_File_IsImage()); If any 1 can help me set this up would i be verry great full :D

    Read the article

  • Problem with addDisplayGroup in the Zend Form

    - by ulduz114
    Hi all, I have a form same the following code: public function init(){ $id=$this->createElement('hidden','cf_id'); $id->setDecorators($this->elementDecorators); $id->setOrder(1); $this->addElement($id); $firstName=$this->createElement('text','firstName'); $firstName->setDecorators($this->elementDecorators); $firstName->setLabel('name :'); $firstName->setOrder(2); $firstName->setAttrib('class','textbox'); $firstName->setAttrib('disabled',true); $this->addElement($firstName); $lastname=$this->createElement('text','family'); $lastname->setLabel(' family:'); $lastname->setDecorators($this->elementDecorators); $lastname->setOrder(3); $lastname->setAttrib('class','textbox'); $lastname->setAttrib('disabled',true); $this->addElement($lastname); $this->addElement('button', 'cancel', array( 'label' => 'Cancel Button', 'class'=>'button', 'decorators' => array( 'ViewHelper', ), )); $this->addElement('button', 'submit', array( 'label' => 'Submit Button', 'class'=>'button', 'decorators' => array( 'ViewHelper', ), )); $this->addDisplayGroup(array('submit', 'cancel',), 'submitButtons', array( 'order'=>4, 'decorators' => array( 'FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'element')), ), )); } In this form there are some elements and two buttons. In display page, the buttons are shown above form before other elements. How can I put these buttons at the bottom of all elemnts? Thanks.

    Read the article

  • Extending Zend View Helper Placeholder

    - by Sonny
    I was reading the manual about basic placeholder usage, and it has this example: class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { // ... protected function _initSidebar() { $this->bootstrap('View'); $view = $this->getResource('View'); $view->placeholder('sidebar') // "prefix" -> markup to emit once before all items in collection ->setPrefix("<div class=\"sidebar\">\n <div class=\"block\">\n") // "separator" -> markup to emit between items in a collection ->setSeparator("</div>\n <div class=\"block\">\n") // "postfix" -> markup to emit once after all items in a collection ->setPostfix("</div>\n</div>"); } // ... } I want to acommplish almost exactly that, but I'd like to conditionally add more class values to the repeating divs, at time of rendering if possible, when all the content is in the placeholder. One thing I specifically want to do is add the class of "first" to the first element and "last" to the last element. I assume that I'll have to extend the Zend_View_Helper_Placeholder class to accomplish this.

    Read the article

  • Zend Framework problems using Element, sub-forms and belongsTo

    - by wiseguydigital
    Still pulling my hair out with Zend_Form and any elements that need to be placed in a sub-array. form-populate() does not work when working with elements within a sub-form that have been set to a parent array using belongsTo() - I think it is actually a bug in Zend_Form-setDefaults() but just wanted to see if anyone else has a) had the same problem and b) managed to work around it...

    Read the article

  • Zend - unable to catch exception [closed]

    - by coder3
    This still throw an uncaught exception.. Any insight why this isn't working? protected function login() { $cart = $this->getHelper('GetCurrentCart'); $returnValue = false; if ($this->view->form->isValid($this->_getAllParams())) { $values = $this->view->form->getValues(); try { $this->goreg = $this->goregFactory->create($this->config->goreg->service_url); if ($this->goreg->login($values['username'], $values['password']) && $this->goregSession->isLoggedIn()) { $returnValue = true; } else { echo 'success 1'; } } catch (Exception $e) { echo 'error 1'; } catch (Zend_Exception $e) { echo 'error 2'; } catch (Zend_Http_Client_Exception $e) { echo 'error 3'; } } return $returnValue; }

    Read the article

  • How to search inbox using zend mail

    - by Bob Cavezza
    The following is a function from zend_mail_protocol_imap. i read that to search emails, I would want to override it using zend_mail_storage_imap (which is what I'm using now to grab email from gmail). I copy and pasted the following function into zend_mail_storage_imap, but I'm having issues with the params. I can't find documentation on what to use for the array $params. I initially thought it was the search term before reading it more thoroughly. I'm out of ideas. Here's the function... /** * do a search request * * This method is currently marked as internal as the API might change and is not * safe if you don't take precautions. * * @internal * @return array message ids */ public function search(array $params) { $response = $this->requestAndResponse('SEARCH', $params); if (!$response) { return $response; } foreach ($response as $ids) { if ($ids[0] == 'SEARCH') { array_shift($ids); return $ids; } } return array(); } Initially I thought this would do the trick... $storage = new Zend_Mail_Storage_Imap($imap); $searchresults = $storage->search('search term'); But nope, I need to send the info in an array. Any ideas?

    Read the article

  • Zend Framework Zend_Form Decorators: <span> Inside Button Element?

    - by leek
    I have a button element that I've created like so: $submit = new Zend_Form_Element_Button('submit'); $submit->setLabel('My Button'); $submit->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'li')) )); $submit->setAttrib('type', 'submit'); This generates the following HTML: <li> <label for="submit" class="optional">My Button</label> <button name="submit" id="submit" type="submit">My Button</button> </li> I would like to wrap the inside of the button with a <span, like this: <button...><span>My Button</span></button> What is the best way to do this using Zend_Form?

    Read the article

  • Zend Framework: Autoloading module resources in config.ini?

    - by Olagato
    Is it possible, to configure the following behaviour in application.ini? <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initAdminModuleAutoloader() { $this->_resourceLoader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'Admin', 'basePath' => APPLICATION_PATH . '/modules/admin', )); $this->_resourceLoader->addResourceTypes(array( 'model' => array( 'namespace' => 'Model', 'path' => 'models' ) )); } } ?> If so, can you please show us an example? Thanks.

    Read the article

  • Zend Framework: Zend_DB Error

    - by Sergio E.
    I'm trying to learn ZF, but got strange error after 20 minutes :) Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'Configuration array must have a key for 'dbname' that names the database instance' What does this error mean? I got DB information in my config file: resources.db.adapter=pdo_mysql resources.db.host=localhost resources.db.username=name resources.db.password=pass resources.db.dbname=name Any suggestions? EDIT: This is my model file /app/models/DbTable/Bands.php: class Model_DbTable_Bands extends Zend_Db_Table_Abstract { protected $_name = 'zend_bands'; } Index controller action: public function indexAction() { $albums = new Model_DbTable_Bands(); $this->view->albums = $albums->fetchAll(); } EDIT All codes: bootstrap.php protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => '', 'basePath' => dirname(__FILE__), )); return $autoloader; } protected function _initDoctype() { $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype('XHTML1_STRICT'); } public static function setupDatabase() { $config = self::$registry->configuration; $db = Zend_Db::factory($config->db); $db->query("SET NAMES 'utf8'"); self::$registry->database = $db; Zend_Db_Table::setDefaultAdapter($db); Zend_Db_Table_Abstract::setDefaultAdapter($db); } IndexController.php class IndexController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { $albums = new Model_DbTable_Bands(); $this->view->albums = $albums->fetchAll(); } } configs/application.ini, changed database and provided password: [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 db.adapter = PDO_MYSQL db.params.host = localhost db.params.username = root db.params.password = pedro db.params.dbname = test models/DbTable/Bands.php class Model_DbTable_Bands extends Zend_Db_Table_Abstract { protected $_name = 'cakephp_bands'; public function getAlbum($id) { $id = (int)$id; $row = $this->fetchRow('id = ' . $id); if (!$row) { throw new Exception("Count not find row $id"); } return $row->toArray(); } }

    Read the article

  • How do I reuse code in Zend Framework

    - by Mario
    I am working on a web application which requires the user to login before they see or do anything. No part of this app should be accessible without being logged in. (Except of course, the login controller) Currently I am using sessions to handle the authentication and I have put code in each controller in the init() function to check if their session is valid. This was a temporary workaround, but it is redundant and inefficient. I would like my init() function to be similar to the following, but I am not sure how to achieve it: public function init() { // If user not logged in redirect to login controller $myLibrary = Zend_Library_MyLibrary(); $myLibrary->CheckAuth(); } So my question really has two parts: Where is the best place to store code that will be used in multiple controllers? How do I then call that function from a controller? Thanks.

    Read the article

  • Zend Framework - Database Table Singleton

    - by Sonny
    I have found myself doing this in my code to 'cache' the work done when instantiating my Zend_Db_Table models: if (Zend_Registry::isRegistered('x_table')) { $x_table = Zend_Registry::get('x_table'); } else { $x_table = new Default_Model_DbTable_X; Zend_Registry::set('x_table', $x_table); } It bothered me that this method isn't very DRY and it dawned on me today that a singleton pattern would probably be a better way to do this. Problem is, I've never written a singleton class. When I did some web searches, I found some offhand comments about Zend_Db_Table singletons, but no real examples. I already have meta-data caching configured. How do I make my Zend_Db_Table models singletons? Are there pitfalls or downsides?

    Read the article

  • Can't retrieve more than 2 gmail messages using Zend framework imap access - server dies - doens't r

    - by Ali
    Hi guys I'm working on a google apps application. Basically I've set it up so users can add multiple gmail addresses and check on their inboxes in the application. It works fine with a google apps email address however when I add a gmail address it just dies out. I'm using this code here: $mail = new Zend_Mail_Storage_Imap($mail_options); $all_messages = array(); $page = isset($_GET['page'])?$_GET['page']:1; $limit = isset($_GET['limit'])?$_GET['limit']:20; $offset = (($page-1)*$limit)+1; $end = ($page*$limit)>$c?$c:($page*$limit); for ($i=$offset;$i<=$end;$i++){ $h2t = new html2text(); $h2t->set_allowed_tags('<a>'); if(!$mail[$i]) break; else{ $one_message = $mail->getMessage($i); $one_message->id = $i; $one_message->UID = $mail->getUniqueId($i); $one_message->parts = array(); $one_message->body = ''; $count = 1; foreach (new RecursiveIteratorIterator($mail->getMessage($i)) as $ii=>$part) { try { $tpart = $part; //$tpart->_content = ''; $one_message->parts[$count] = $tpart; $count++; // check for html body if (strtok($part->contentType, ';') == 'text/html') { $b = $part->getContent(); if($part->contentTransferEncoding == 'quoted-printable') $b = quoted_printable_decode($b); $one_message->html_body = $b; $h2t->set_html($b); $one_message->body = $h2t->get_text(); } //check for text body if (strtok($part->contentType, ';') == 'text/plain') { $b = $part->getContent(); if($part->contentTransferEncoding == 'quoted-printable') $b = quoted_printable_decode($b); $one_message->text_body = $b; $one_message->body = $b;//$part->getContent(); } } catch (Zend_Mail_Exception $e) { // ignore } } $all_messages[] = $one_message; } } No matter what the emails it dies out on retrieving just 2 emails... whats going on here?

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >