Search code examples
zend-frameworkmodel-view-controllerzend-framework-mvc

Assigning View Helpers ZF 1.12


I can't get view helpers to work. This is what I've done so far:

I added this in application.ini

resources.view.helperPath.My_View_Helper = APPLICATION_PATH "/helpers"

In directory application/helpers I put the file findurl.php

Inside findurl.php I put

<?php
class My_View_Helper_findurl extends Zend_View_Helper_Abstract
{
    public function findUrl($url){
         $url = $url;
         return htmlspecialchars($url);
    }
}
?>

Then in a view.phtml file I tried $this->findurl("http://google.com"); and got no luck, page goes blank.

I know I'm probably getting naming conventions wrong, could anyone help me out? Thank you.

I also tried this in view.phtml

$helper = $this->_helper->getHelper('findurl');
echo $helper->findUrl("http://google.com");

Solution

  • Try:

    $this->findurl('url');
    

    http://framework.zend.com/manual/1.12/en/zend.view.helpers.html