Zend Framework user messaging system

There are many ways to notify users of error, information or warning messages. one very simple way is to define a notify method that creates an array of messages for the view. But Zend Framework also provides the Flash Messenger action helper that allows messaging to a redirected page.  We find on Sean"s blog a Prority Messenger that extends this concept to various types of messages. Part of the trick is to follow the DRY convention : Don't Repeat Yourself, e.g. avoid duplicating code.

Developping Tables with Zend_PDF

Generating PDF with Zend is not the best option : fpdf does a real good job at tables especially, including functions that transform HTML tables to PDF. Wonderful. If you still want to go with ZEND_PDF and make tables in yur PDF well you'll have to search the internet for specific classes that do the job.

integrate wordpress feeds in magento

There are a few extensions that integrate magento and wordpress in magento connect extension repository. Price is not high -in fact fishpig wordpress integration extension is free - but if you happen to have a specific oldie version of Magento (1.2), this extension comes with no guarantee.

  • RSS reading :  a manual installation of an extensionis distributed by Sonassi here, which comes with RSS reader code and template files
  • A simpler technique incolves reading a wordpress generated HTML page. Check out this one from Addoa Creative

Windows Explorer Image Thumbnail RAW Preview

If you're working a PC with MAC background, you're probably disappointed with the lack of specific image format preview in the explorer. Professionnals use Adobe Bridge browsing  but it's expensive. Even though serious imaging work  often requires  the Adobe suite, you might be tempted to go with cheaper or opensource solutions such as the famous GIMP for image manipulation, or inkscape for vector drawing. Image browsing is a feature windows explorer only provides for specific formats : jpg, gif, bmp. Raw files require specific add ons

  • Quick / most famous : FastPicture Viewer / includes support for all raw formats, DNG, Photoshop PSD
  • less famous but development still active : MysticThumb
  • Thumbnail display depends on specific dlls that can be installed for specific formats, such as

Zend Framework Paypal Website Payments Standard Form

Website Payments Standard uses a HTML form to send a payment proposal to paypal. This tehnique is a reliable implementation of IPN, which notifies your web site when the payment has been processed. The class below requires Zend Framework and uses ZendForm to generate the form. If you' re using the debug sandbox mode,the form generates text fields, otherwise it generates hidden fields. More info about Paypal Website Payment Standard Form.

Usage

  • in your controller : create the paymentAction, and also paymentNotifyAction (for IPN notifications), and the payementReturn action (for return and confirmation on your website). The code below uses user object with email and id attributes
public function paypal()
 {
$paypal=new Wb_Paypal_Standard(true);
$paypal->setBusinessEmail("business@owner.com");
 $paypal->setPayer($user->email, $user->id);
 $paypal->setAmount("50");
$paypal->setControllerUrl("http://" . $this->getRequest()->getHttpHost() . $this->view->url()    );
return $paypal;
}
public function paymentAction()
  {
$this->view->paypalForm=  $this->paypal()->form();
  }
public function paymentnotifyAction()
{
      $this->_helper->viewRenderer->setNoRender(); 
    $this->_helper->layout->disableLayout();

    try{
    if ($this->paypal()->validateNotify($this->getRequest()->getPost()))
    {

          $dbUserPayment=new Model_DbTable_Users_Payments()   ;
        $dbUserPayment->insert( array("ifv_user_id"=>$arrPost["payer_id"],"txn_id"=>$arrPost["txn_id"], "credits"=>$arrPost["custom"]));
      }
    }
    catch (Exception $e){PoleOuest_Log::error($e->getMessage());}

}
public function paymentreturnAction()
{
}
  • views : payment.phtml
    <?= $this->paypalForm ?>

Class : Wb_Paypal_Standard.php

<?php
class WB_Paypal_Standard
{
{
var $paypalUrlLive="https://www.paypal.com/cgi-bin/webscr";
var $paypalUrlTest="https://www.sandbox.paypal.com/cgi-bin/webscr";
var $currencyCode="EUR";
var $cmd="_xclick";
var $sandbox=false;

var $paypalData=array();
public function __construct($sandbox=false)
{
 $this->sandbox=$sandbox;
 if ($this->sandbox)
 $this->paypalData['url']= $this->paypalUrlTest;
 else    $this->paypalData['url']= $this->paypalUrlLive;
 }

public function form()
{
 if (!isset($this->paypalData['businessEmail'])) throw new Exception('Please specify paypal business account email ');
 if (!isset($this->paypalData['notifyUrl'])) throw new Exception('Please specify return url for ipn ');  
 if (!isset( $this->paypalData['payer_email'])) throw new Exception('Please specify payer email ');       
 if (!isset($this->paypalData['amount'])) throw new Exception('Please specify amount ');   
 $this->frm=new Zend_Form();
 $this->frm->setAttrib("id","frmPaypal");
 $this->frm->setAction($this->paypalData['url']) ;

 $this->addFormField("cmd", $this->cmd);
 $this->addFormField("business", $this->paypalData['businessEmail']);
 $this->addFormField("receiver",  $this->paypalData['businessEmail']);
 $this->addFormField("charset", "utf-8")  ;
 $this->addFormField("notify_url", $this->paypalData['notifyUrl']);     
 $this->addFormField("return", $this->paypalData['returnUrl']);
 $this->addFormField("payer_email", $this->paypalData['payer_email']);
 $this->addFormField("payer_id",$this->paypalData['payer_id']);   
 $this->addFormField("amount", $this->paypalData['amount']);  
 $this->addFormField("custom",$this->paypalData['custom']);
 $this->addFormField("currency_code", $this->currencyCode);
 foreach($this->arrItem as $k=>$v)        
 {
 $i="_" .($k+1);
 if ($this->cmd=="_xclick") $i="";
 $this->addFormField("item_name" . $i, $v['item_name']);
 if ($i!==""){ $this->addFormField("item_amount" . $i, $v['amount']);
 $this->addFormField("quantity" . $i, $v['quantity']);         }
 }
 $elt = $this->frm->createElement('submit','submitButton');
 $elt->setLabel('PAY');      $this->frm->addElement($elt);     
 return $this->frm;
}
public function addItem($arrItem)
{
 $this->arrItem[]=$arrItem;
}
public function addFormField($name, $value="")
{
 if ($this->sandbox) $fieldType="text"; else $field_type="hidden";  
 $elt=$this->frm->createElement($fieldType,$name)->setValue($value);
 if ($this->sandbox) $elt->setLabel($elt->getName());
 $this->frm->addElement($elt);   
}
public function validateNotify($arrPost)
{
 $client = new Zend_Http_Client($this->paypalData['url']);
 $client->setMethod(Zend_Http_Client::POST);
 $client->setParameterPost(array_merge(array('cmd' => '_notify-validate'),$arrPost));
 $response = $client->request();

 if ($response->getBody() != 'VERIFIED') throw new Exception('Invalid IPN Transaction : ' . $response->getBody());   
 elseif($arrPost["mc_gross"]=="") throw new Exception('Invalid IPN mcgross :  not set');   
 elseif($arrPost["payment_status"]!="Completed") throw new Exception('Invalid IPN payment_status : ' .  $arrPost["payment_status"]);   
 elseif($arrPost["txn_id"]=="") throw new Exception('Invalid IPN txn_id : not set ');   
 else return true;
}
public function setBusinessEmail($businessEmail){     $this->paypalData['businessEmail']=$businessEmail;}
public function setAmount($amount){      $this->paypalData['amount']=$amount;}
public function setCustom($custom){      $this->paypalData['custom']=$custom;}
public function setControllerUrl($controllerUrl)
{      
 $this->paypalData["notifyUrl"]=$controllerUrl . "notify";
 $this->paypalData['returnUrl']=$controllerUrl . "return";
}
public function setPayer($payer_email, $payer_id)
{
 $this->paypalData["payer_email"]=$payer_email;  
 $this->paypalData["payer_id"]=$payer_id;
}
}?>
public function paymentnotifyAction()
{
$this->prepareAjaxResponse();

try{
if ($this->paypal()->validateNotify($this->getRequest()->getPost()))
{

$dbUserPayment=new Model_DbTable_Users_Payments()   ;
$dbUserPayment->insert( array("ifv_user_id"=>$arrPost["payer_id"],"txn_id"=>$arrPost["txn_id"], "credits"=>$arrPost["custom"]));
}
}
catch (Exception $e){PoleOuest_Log::error($e->getMessage());}

}

OpenSource Task list managers

home-portal-web

A typical workgroup and/or CRM applications comes with  full featured applications : sugarcrm, tine2.0 come with much more than contact management, task tracking, customer relation ship, and are conceived to integrate third party developments (plugins). But if you only need to track work to do, might have a look at simpler web based php applications :

  • myTinyTodo is so small and simple - yet ajax powered-  you'd love it at first sight
  • TaskFreak is the free version of a much more advanced applicatin, can be enough for a lot of small freelance  projects.
  • PlanCake is a nice hosted  job tracking application that can also be downloaded and installed on your server. Nice for testing before adopting.
  • todoyu (picture above) is the most advanced of our selection, with advanced features : manage multiple projects with team members but also clients online, overview your customer's data, assign tasks to team member and external staff, share files within your work group, schedule events in a shared calendar, check and meet the deadlines

Carrington for WordPress makes CMS easier

Sounds too good to be true : the Carrington wordpress theme framework, developped by Colorado based CrowdFavorite, implements what we've all been waiting  for :  AJAX/ drag & drop  wysiywg page structure management. It builds on the existing core WordPress theme structure and functionality and uses core WordPress theme functions for easy adoption by experienced theme authors.

Magento : find out which xml fails

If you've been working with Magento extensions or layout, you might have encountered the frustration of trying to find out which XML generates the following error, potentially harming the whole magento installation :

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 61: parser error : StartTag: invalid element name  in C:\aa_work\RueDeSiam\www\lib\Varien\Simplexml\Config.php on line 502

#0 C:\aa_work\RueDeSiam\www\lib\Varien\Simplexml\Config.php(502): mageCoreErrorHandler(2, 'simplexml_load_...', 'C:\aa_work\RueD...', 502, Array)
#1 C:\aa_work\RueDeSiam\www\lib\Varien\Simplexml\Config.php(489): Varien_Simplexml_Config->loadString('?????? ...', 'Mage_Core_Model...')
#2 C:\aa_work\RueDeSiam\www\app\code\core\Mage\Adminhtml\Model\Config.php(102): Varien_Simplexml_Config->loadFile('?????? ...', 'Mage_Core_Model...')
#3 C:\aa_work\RueDeSiam\www\app\code\core\Mage\Adminhtml\Model\Config.php(63): Mage_Adminhtml_Model_Config->_initSectionsAndTabs('C:\aa_work\RueD...')
#4 C:\aa_work\RueDeSiam\www\app\code\core\Mage\Adminhtml\controllers\System\ConfigController.php(70): Mage_Adminhtml_Model_Config->getSections()
#5 C:\aa_work\RueDeSiam\www\app\code\core\Mage\Core\Controller\Varien\Action.php(367): Mage_Adminhtml_System_ConfigController->editAction(NULL)
#6 C:\aa_work\RueDeSiam\www\app\code\core\Mage\Core\Controller\Varien\Router\Admin.php(143): Mage_Core_Controller_Varien_Action->dispatch()
#7 C:\aa_work\RueDeSiam\www\app\code\core\Mage\Core\Controller\Varien\Front.php(158): Mage_Core_Controller_Varien_Router_Admin->match('edit')
#8 C:\aa_work\RueDeSiam\www\app\Mage.php(457): Mage_Core_Controller_Varien_Front->dispatch(Object(Mage_Core_Controller_Request_Http))
#9 C:\aa_work\RueDeSiam\www\index.php(66): Mage::run()
#10 {main}

the problem with this kind of error is that it doesn't tell you which file is causing the error. To find out, work with your local installation

  • set the developer mode in index.php : Mage::setIsDeveloperMode(true);
  • open the app/code/core/Mage/Adminhtml/Model/Config.php and let the _initSectionsAndTabs tell you which xml is being loaded in the modules loop, just after $configFile is defined : echo $configFile;
  • the last file that pops before the error is thrown out is likely to cause the breakout !!

PHP development framework comparison : symfony, Zend Framework, Code Igniter

Before starting development on a new project, I need to investigate 3 popular PHP development frameworks. I would say if you need to choose, stick to the one you know already. I you don't know a framework already then you're in trouble and you need advice. Here a few things I would look for.

Beyond the code and standarts : what's available

MVC is a nice idea but it's only an idea and even if it's useful to structure the code the power of frameworks are in their community.

  • Look for application samples.
    • Zend framework used to have a good application sample, distributed free as DodoApp. Unfortunately it's not available any more but other applications are out there to get you started if you need code samples, check out our article. In general I have been looking a lot and it's hard to find a starter application for Zend Framework
    • Symfony has a lot of opensource applications, the list is here
    • Code Igniter is simpler to learn apparently but you'll find it hard to find good sample applications .We 've listed two of them in a previous article
  • Look for available code snippets
    • Zend framework code snippets can be found all over the web but you have to know the framework really well to integrate them in your application
    • Code igniter snippets are displayed on the forum but not categorized
    • symfony snippets are organized and tagged in the plugin repository, easily available from Symfony's official web site,  and I have to say that's a real sign of good community work

The conclusion is make your life and your own choice. I was using Zend framework but a few minutes investigation convince me I should look into symfony.

Publish wordpress posts to social networks

Header_Share

Worpdress is great for quick publishing and a variety of plugins are available that let users publish to various platforms. The image above, extracted from the gigya website, illustrates the versatily of social networks. Gigya itself provides a plugin for WordPress. The technique is commonly described as cross posting, meaning one post on wordpress notifyes various social networks. Cross post plugins include:

  • WordBook : cross-post your blog posts to your Facebook Wall.
  • Same for wordbooker
  • WordPress to myspace publishes  posts to myspace
  • Ping FM is a free  service that publishes posts to social networks. WordPress has a few plugins that integrate with ping.fm, check this out

Statistics are an important part of social networking : no point developping web presence without knowing where you go

  • Facebook Share Stats : provides charts and numbers  on your posts shared on Facebook, with statistics and charts about the number of "like", comments and clicks received.

Interesting links

Jquery wysiwyg editing

image.axd

Out of smart combination of powerful jquery plugins and functions comes the Minibar, contextual editing menu that pops up in windows Office 2007 fashion. The demo provided works with standard textarea editor but we'd like to see it implemented within tinymce or fckeditor, for instance : no doubt this is coming in the next few hours !!

WordPress : Upload images in post meta

verve-meta-boxes

Word press image upload is nice and perfectly integrated in the wysiwyg editor. If you need to specify clearly where the image will appear, you can use the post thumnbail feature that attaches a specific image to a post. But if you need to duisplay more than image per post, then you're better off using custom fields, and a few plugins are available to let you upload image directly to a custom field

Bonus : Custom Field Template Hack  displays full size image on custom image thumbnail in post / page edit in backend and additional function to automate image display in templates

Read more

SEO Toaster CMS

SEO Toaster was introduced last week and it comes with a set of features that puts that solution right in place for competing with other famous systems. It's also nice to note that the technology behind it is the Zend Framework.

add-edit-page

Inline editing : all administration is performed within the actual site, the admin area does not exist. This is a particularly challenging choice of development but tends to please users when correctly designed. Visually the green & blue theme for the sidebar admin is not the best but is functionnal.

I particularly like the page creation form (image above) which allows the content manager to specify all page information, including SEO related, page title and header image, in one shot.

File Management uses the famous swfupload which is now a minimum requirement for CMS practise. Images are automatically resized and the upload process allows uploading and editing within the same screen which is a recipe for content efficiency. Jquery lightbox is provided in the distribution and resized images link to the original image automatically.

Form maker is integrated in the distribution too but only with the email sender feature, no database integration yet

http://www.seotoaster.com/

Multilingual wordpress with wpml plugin

wpml is a wonderful plugin that has so many  it takes a while to get used to its power.

A new beta version of the multilingual plugin has been published for early adopters who have already switched to 3.0

What I've tested is interesting and allows quick setting of multilingual website

  • Flag displaying is almost instant thanks to dedicated functions or specific coding as documented here. Urls paths are well preserved and extended with the 2 letter language prefix.
  • Post translation is well implemented in the admin, each language displays a + button on the columns of the post / page
  • Posts can share common custom values or images, technique described here
  • all strings thath use the _e function in templates are translatable in the admin or in a mo file
  • as of today the wordpress 3.0 menu and custom post types do not work well with wpml but work is ongoing

wbFurnitureShop : premium wordpress cms theme

wbFurnitureShop is a wordpress template that is an extremely simplified theme for using wordpress as a cms for making a presentation site. Exazmple is provided here in the form a furniture store template designed to use standard wordpress distribution to display a product line, content pages and a jquery  slider that is configured via the standard wordpress content management  interface.
wbFurnitureShop wordpress template was specially developped for latest version of wordpress 3 , which is now available as beta on wordpress.org.
Get in touch now : for less than an hours work you get  fully configured web site with easy admin and wordpress CMS features and full 24hours support for life !


screenshot

Main home page screenshot

widgetSidebar

specific admin widget sidebar

customslide1

Custom post type for products


  • wbFurnitureShop template is a customization of wordpress 3.0  template and includes :
    • the  home page with jquery slider (uses carousel) implemented as custom posts type,
    • the page and post templates : use the page for content and posts for products
    • custom query that  displays lastests posts as products thumbnails  with link to permalink.
    • Sidebar and footer use content widgets for maximum content management.
  • General layout features
    • fixed 750 px Layout (change width in style : #wrapper)
    • cufont enabled, distributed with Champagne & Limousine
    • drop down menu enabled
  • Content display features
    • two column layout on homepage and product pages
    • single column layout on content pages
    • Lastest products remain on bottom of all pages for best user experience and internal site navigation
  • WordPress features
    • thumbnail enabled
    • menu enabled (new function wp_nav_menu)
    • custom type for slide images
    • widget ready ( sidebar  + footer) - use textwidget to display text
  • Goodies
    • is distributed in a zip that contains
      • ttf or otf  font file, cufont, jquery,
      • sample images for testing and working with the template
      • PSD for the top logo and first slide
    • included : PDF install intructions wbFurnitureShopTemplateInstallInstructions

BUY NOW on webmasterbulletin.net/shop

WordPress password protected pages / blog

as of version 3 of WordPress, posts and pages have three options for visibility  :

  • public : everyone sees the post,  in the list and directly from the permalink
  • password protected  post title is displayed only,  permalink works but content protected by password
  • private : not displayed in the list for guests (non connecte) visitors, permalink returns 404

What we're looking for today is a solution that hides the post from the list but allows certain users to see it via permalink. Of course you can give the permalink and tell the user to identify via the wp-login page, but this can be complex for beginners. Ideally you would give the permalink of a private page and if not connecetd the visitor will be presented a login prompt. Here's a review of available  solutions, tips and plugins

  • Tip : post specific template that redirects user to standard login form
    http://www.rlmseo.com/blog/require-login-for-wordpress-pages/
    found also at  : http://www.marketingtechblog.com/wordpress/login-content-wordpress-page-template/
  • a specific option allows coder to redirect user to a page after login  : http://brockangelo.com/2009/12/17/redirect-users-back-to-page-they-were-on/
  • wp private plugin displays a login form in place of the restricted part of the article
  • Member Access plugin overrides wordpress default settings in a new menu, and redirects the restricted pages to the login screen. Indeed, does the job perfectly but the fact that it doesn't use the default wordpress might compromize compatibility with future versions. For the moment  I've tested it on v3.0 beta and works fine.
  • User Access Manager plugin does the same job but I haven't tested it and seems to be inactive
  • UserBase Access Control looks like a new promising development

Other privacy options and plugins are available for WordPress. We've tested for our intranet project some pugins that restrict the whole blog to registered users.

Webmasterbulletin on your IPhone

webmasterbulletiniphone

We've alerady covered the most innovative iphone / itouch applications for web content managers.  Webmasterbulletin now features accessible content from your iphone : if you are viewing this blog from a standard browser you won't notice a break, but get out and run webmasterbulletin.net from your iphone. The standard webmaterbulletin theme is conv erted to a very specific IPHONE application with AJAX calls for quicker use of the device. Thanks WPTOUCH, #1 plugin at the SanFrancisco WordPress Camp 2009.

vosao CMS

vosao CMS is a java based CMS for google apps engine : meaning free web host for this free opensource CMS. Not a lot top say on the interface side, the project is notable because it works for Google App Engine. Vosao CMS features include visual (WYSIWYG) editing, friendly URLs, internationalization, parent/child page structure, nested and programmable templates, commenting (with moderation), site import/export, content versioning, security and group management, resource management, captcha, Google Analytics, plugins, input forms, SEO URLs, and more, along with free hosting on the Google cloud.

Ionize CMS : create, publish , enjoy

ionizecms

Built from the Code Igniter template, Ionize CMS comes with a lot of features we love : drag & drop tree structure, multi tyope content (images gallery a just a tab away from the page / article editor), multilingual structure, and a flash based file uploader. Interactions are performed by the mochaUI library, a clean and original Mootools project .  Ionize Project is still young and not very active, and is  a live example of an opensource application  that can afford to survive  without a user forum, even though the Code Igniter forum follows it closely. But we believe with a form maker module Ionize CMS would quickly surpass other simple CMS alternatives such as our beloved silverstripe.

version 0.92 is opensource and version 1 has been released privately

Link : http://www.ionizecms.com/en/