Skip to content
General Revolution Evolution Add-ons International
Login | Register | MODX.com
MODX Open Source Content Management System, Framework, Platform and More.
Find a Partner | Hosts + SaaS | Jobs | Donate
  • RegisterSign Up with the MODX Community
  • LoginUse Your MODX.com Account
  • MODX Community Forums
  • General
  • Tips & Tricks
  •  
  • Using Zend Framework from within MODx#

  • 964
    11

    alexatkeplar Reply #1, 1 year, 10 months ago

    Reply
    • Link to this post#1
    Hi,

    I didn't find a post on how to use Zend Framework libraries from within MODx (Evo), so thought I would just post a quick howto here:

    1. DL the Zend Framework libraries from http://framework.zend.com/download/latest (you just need the Minimal install)

    2. Unzip them to a path e.g. /var/www/libraries/Zend (you just need the contents of the library folder from the zip)

    3. Create a new snippet called zend.inc.php in a folder called zend with the following contents:

    <?php
    /**
     * This is a Zend Framework loader for MODx Evolution
     * Author: Alex Dean @alexatkeplar
     */
    
    define('LIBRARY_PATH', '/var/www/libraries/'); // Update as appropriate
    
    // First make sure the Zend library is in the include path:
    ini_set('include_path',
    ini_get('include_path') . PATH_SEPARATOR . LIBRARY_PATH);
    
    // Then require the Autoloader class:
    require_once 'Zend/Loader/Autoloader.php';
    
    // Instantiate the loader
    $loader = Zend_Loader_Autoloader::getInstance();
    


    4. Now in a MODx snippet you can use Zend like so:

    <?php
    require_once($modx->config['base_path'] . 'assets/snippets/zend/zend.inc.php');
    
    $userLocale = new Zend_Locale(Zend_Locale::BROWSER); // Or whatever...
    $userLanguage = $userLocale->getLanguage();
    


    Hope this is helpful! Let me know if it is and I'll post another howto on integrating MaxMind geo-IP with MODx...


  • 26931
    2,262
    fancypants menu: http://modxcms.com/forums/index.php/topic,31940.0.html

    sharkbait Reply #2, 1 year, 10 months ago

    Reply
    • Link to this post#2
    alexatkeplar, thanks for sharing!


  • 4310
    2,276
    Snippets : eForm 1.4.4.7 with SMTP & PMS's security fixes | PHC Results | EasyNewsletter from CSV

    Wiki Articles : Custom DB table to placeholders | Manager Locked Out?

    Websites : Work - U.K. based MODx development  |  Hobby - Free interactive education resources for teaching 4 - 11 year olds

    Hosting : One Smart Host - Professional MODx hosting 

    bunk58 Reply #3, 1 year, 10 months ago

    Reply
    • Link to this post#3
    Interested to see the MaxMind geo-IP with MODx integration.
    Thanks for the howto.


  • 964
    11

    alexatkeplar Reply #4, 1 year, 10 months ago

    Reply
    • Link to this post#4
    Quote from: bunk58 at Jun 23, 2010, 05:09 AM
    Interested to see the MaxMind geo-IP with MODx integration.

    Please find it here: http://modxcms.com/forums/index.php/topic,50853.0.html


  • 37099
    138
    http://onsitenow.co.uk

    thingstodo Reply #5, 1 year, 10 months ago

    Reply
    • Link to this post#5
    What sort of things do you use Zend for in ModX? I've used it for HTML emails so far, but that's all.

    Mike


  • 473
    60

    Adhi Reply #6, 1 year, 10 months ago

    Reply
    • Link to this post#6
    thanks for lexatkeplar, I propose to be used as a standard library folder so that third-party libraries such as Zend Framework, phpThumb, MaxMind, eZ Components and others can be used in other snippets, plug-in, or module without duplication. Probably better in the folder assets/libraries/


  • 36756
    7

    strochli Reply #7, 4 months, 1 week ago

    Reply
    • Link to this post#7
    I use the LiveDocx Service in the Zend Framework for creating docx and .pdf documents + data from 3rd party database tables. Works like a charm.





Actions

Login to Post

Other Support Options

To file a bug or make a feature request visit our issue tracker, or you can also purchase commercial support.

Love MODX?

If you build sites for a living with MODX or just love using it, why not give back?

Information

Posted in this thread:
adhiarta, alexatkeplar, bunk58, icebear, sharkbait, thingstodo

 
Back to Top

MODX Global HQ

1333 N Stemmons Fwy, Ste 110
Dallas, TX 75207
United States

+1 (469) 777-MODX (6639)

The MODX Company

  • Contact
  • Media Center
  • Careers at MODX
  • Wall of Fame
  • The MODX Blog

Sponsors

SoftLayer Firehost: Secure Cloud Hosting

Stay Connected

Read our previous email newsletters.

Twitter Facebook Google+ LinkedIn github Feeds

Privacy Policy | Terms of Service | Pixels by AKTA Web Studio© 2005-2012 MODX. All rights reserved. Trademark Policy