Archive for 'Zend Framework'

Insert processing istruction to Zend View Helper Navigation Sitemap dom object

What if you want to associate a xslt stylesheet to the sitemap generated by Zend_View_Helper_Navigation_Sitemap. I did it by adding a xml-stylesheet processing instruction to the view helper dom object. Here is the code:

class SitemapController extends Zend_Controller_Action
{
public function indexAction ()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender("true");

$pages = array();

// generate the pages array somehow
$someservice = new My_Serivce_PageGenerator();
$pages = $someservice->fetchAllMyWebsitePages();

// generate sitemap xml
$xml = $this->_generateSitemapXml($pages);

$response = $this->getResponse();
$response->setHeader('Cache-Control', 'public', true);
$response->setHeader('Content-Type', 'text/xml', true);
$response->appendBody($xml);

}

private function _generateSitemapXml ($pages)
{

$sitemap = new Zend_View_Helper_Navigation_Sitemap();

$sitemap->setView($this->view);
$sitemap->setUseSitemapValidators(false);
$sitemap->setMinDepth(0);
$sitemap->setMaxDepth(0);

$container = new Zend_Navigation();
$container->addPages($pages);

$sitemap->setContainer($container);


// get the dom object
$dom = $sitemap->getDomSitemap();

// define path to xslt stylesheet
$xslt_file_path = '/sitemap_style.xsl';

// create processing instruction
$xslt = $dom->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="' . $xslt_file_path . '"');

// add it to the dom
$urlset = $dom->getElementsByTagName('urlset');
$dom->insertBefore($xslt, $urlset->item(0));

// instead of using the render method we use this:
$xml = $sitemap->getUseXmlDeclaration() ? $dom->saveXML() : $dom->saveXML($dom->documentElement);

return rtrim($xml, PHP_EOL);


}

}

Magento for Developers: Part 1 Introduction to Magento

What is Magento? It’s the most powerful online eCommerce platform in the universe and is changing the face of eCommerce forever.

Of course, you already know that. What you may not realize is Magento is also an object-oriented PHP Framework that can be used to develop modern, dynamic web applications that tap into Magento’s powerful eCommerce features.

This is the first in a series of articles in which we’re going to go on a whirlwind tour of Magento’s programming framework features. Don’t worry if you don’t follow everything immediately. As you study the system more everything in this article will start to make sense, and you’ll soon be the envy of your colleagues stuck working with more primitive PHP systems.

Magento “Knowledge Base” Magento for Developers: Part 1 “Introduction to Magento” eCommerce Software for Growth

Zend, Microsoft, IBM join forces to simplify cloud-app devlopment for PHP coders | All about Microsoft | ZDNet.com

As this article says all the right buzzwords are part of a newly unveiled Simple API for Cloud Application Services. It’s an open-source initiative that currently includes Zend, Microsoft, IBM, Nirvanix, Rackspace and GoGrid as the founding members. (No Google and no Amazon, however.) Here you can read more : Zend, Microsoft, IBM join forces to simplify cloud-app devlopment for PHP coders | All about Microsoft | ZDNet.com.

Open Programming Laboratory

This is good place for zend framework samples

SEO and Url Rewriting

This is interesting discussion about url rewriting.  Here is the link .

Zend Framework

Zend came up with their own framework