Re: [fw-general] Zend_Navigation in application.ini in ralphschindler's webninar

2009-12-11 Thread mezoni

Just say that I do not know how it would be bad or good.
But I think that if you add in zf possibility of creating separate
configuration files for different resources.
So this would make some options for certain resources in separate files.
Naturally, at the request of the application developer.
This would simplify the writing, reading and understanding of the long
descriptions of the settings.
The structure of these configurations could be easier.
Since the configuration in a single file is intended only for a single
resource, you not need to write long lines in this file is not needed.

For example, Zend_Naviagtion instead of the next line.

resources.navigation.pages.home.label = "Home"

Should be written in the file "configs/resources/navigation.ini".

pages.home.label = "Home"

That is, without resources.name_of_resource.

The structure of the sections remain the same as application.ini.

And information from the configuration file of resources combined with the
main configuration file application.ini.

Of course, the settings should be loaded automatically when you boot
resource.

Maybe it's not very good, but I do not insist that this is a reasonable
solution.
-- 
View this message in context: 
http://n4.nabble.com/Zend-Navigation-in-application-ini-in-ralphschindler-s-webninar-tp661093p961442.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Navigation in application.ini in ralphschindler's webninar

2009-12-11 Thread mezoni

You are themselves complicates the work.
Do you think, why in the zf added Zend_Application_Resource_[Some resource]
?
This is done for ease of configuration.
Why write extra code settings, if you can do this declaratively?
I think that sometimes just need to get acquainted with the fact as it is
implemented in the framework.
Continue to use their knowledge.
After all, these features are supported by developers.
As the saying goes, "Why reinvent the wheel".
-- 
View this message in context: 
http://n4.nabble.com/Zend-Navigation-in-application-ini-in-ralphschindler-s-webninar-tp661093p961397.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Navigation in application.ini in ralphschindler's webninar

2009-12-11 Thread mezoni

This code is not needed if you move navigation configuration directly into
application.ini.

//$config = new Zend_Config_Ini(APPLICATION_PATH .
'/configs/navigation_uri.ini');
//$navigation = new Zend_Navigation($config);
//$view->navigation($navigation);

Because Navigation will be bootsraped automaticaly via
Zend_Application_Resource_Navigation.

Simple move your navigation configuration into application.ini.
Add into application.ini this line.
resources.navigation.storage.registry[] =

Later, if needed you can access navigation container from your action
controllers through Zend_Registry::get('Zend_Navigation').

Finally edit your navigation configuration like this.

resources.navigation.pages.home.label = Home
resources.navigation.pages.home.uri   = /
resources.navigation.pages.products.label = Products
resources.navigation.pages.products.uri   = /products
resources.navigation.pages.products.pages.widgets.label = Widgets
resources.navigation.pages.products.pages.widgets.uri   = /products/widgets
resources.navigation.pages.products.pages.sprockets.label = Sprockets
resources.navigation.pages.products.pages.sprockets.uri   =
/products/prockets
resources.navigation.pages.aboutus.label = About Us
resources.navigation.pages.aboutus.uri   = /company/aboutus

And all will be work fine.
-- 
View this message in context: 
http://n4.nabble.com/Zend-Navigation-in-application-ini-in-ralphschindler-s-webninar-tp661093p961345.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Zend View Navigation Helpers. Solving typical problems.

2009-11-30 Thread mezoni

Zend View Navigation Helpers. Solving typical problems.

Suppose you want to display the following navigation elements.
Main menu
Submenu of main menu
Breadcrumbs

Solution for main menu clear.
navigation()->menu()->setMaxDepth(0) ?>

Possible solution for submenu of main menu could be so.
navigation()->menu()->setMaxDepth(1)->SetMinDepth(1)->setOnlyActiveBranch(true)
?>

Now a few of the breadcrumbs.

Suppose that we want to see breadcrumbs of the next request
/catalog/products/view/id/1
as
Catalog > Categories -> Product category > Product 1

As retreat.
We don't declare '/catalog/products' in application.ini as page.
And we don't want display breadcrumbs as
'Catalog > Products > Product 1'
And we don't want display '/catalog/products' in submenu.
Since '/catalog/products' is minor.
'/catalog/products/index' simple redirects to '/catalog/categories'.

Possible solution.

class Catalog_ProductsController extends Zend_Controller_Action

public function init()
{
$this->navigation = $this->_helper->getHelper('Navigation');
}

public function viewAction()
{
$product = ... // find product

// Navigation
$this->navigation->addTo('id', 'catalog-categories', 'm', array(
'id' => 'catalog-categories-view',
'label' => $product['category_name'],
'controller' => 'categories',
'action' => 'view',
'params' => array('id' => $product['category_id'])));

$this->navigation->addTo('id', 'catalog-categories-view', 'mcap', array(
'id' => 'catalog-products-view',
'label' => $product['name']));

And finaly little helper code.

_container = $navigation;
}
}
}

public function addTo($property, $value, $fillFlags, $options)  
{
if(null == $this->_container)
{
return;
}   

if(!$page = $this->_container->findOneBy($property, $value))
{
return;
}

$flags = str_split(strtolower(strval($fillFlags)));

foreach($flags as $flag)
{
$request = $this->getFrontController()->getRequest();   


switch($flag)
{
case 'a':
$options['action'] = 
$request->getActionName();
break;
case 'c':
$options['controller'] = 
$request->getControllerName();
break;
case 'm':
$options['module'] = 
$request->getModuleName();
break;
case 'p':
$options['params'] = 
$request->getParams();
break;
}
}

$page->AddPage(Zend_Navigation_Page::factory($options));
}

public function direct($property, $value, $flags, $options)
{
$this->addTo($property, $value, $flags, $options);
}
}
-- 
View this message in context: 
http://n4.nabble.com/Zend-View-Navigation-Helpers-Solving-typical-problems-tp931602p931602.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Why this is only one option to set visibility of Zend_Navigation_Page?

2009-11-27 Thread mezoni

Why this is only one option to set visibility of Zend_Navigation_Page?
Why option 'visible' is pretty simple?
To be or not to be? True or false and nothing more...
You need to add more flexible option like 'visibility'.
Possible value of this option may be value or array of
[menu|sitemap|breadcrumbs|always].

By example.
$page = Zend_Navigation_Page::factory(
  array(
'module' => 'catalog',
'controller' => 'categories',
'action' => 'view',
'label' => 'Category 5',
'visibility' => 'breadcrumbs', // or array('breadcrumbs'),
'params' => array('id' => 5)));

What you think about that?
-- 
View this message in context: 
http://n4.nabble.com/Why-this-is-only-one-option-to-set-visibility-of-Zend-Navigation-Page-tp796007p796007.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Re: Re: Re[fw-general] comendation to solve problem with ZendJsonExprFinder in Zend_Json::encode()

2009-01-12 Thread mezoni

Hello, Benjamin!

Problem not in keys. Problem with UTF.
Expression may also have contain UTF chars.
json_encode encode UTF chars in both keys and expression.

I have question for you.
Why ZendExprFIndExpr feature enabled by default?
This will decrease overall performance where this not realy need.
Why don't turn off this by default?

By eg.
class ZendJson
{
public static function encode($valueToEncode, $cycleCheck = false, 
$options
= array())
{
if(isset($options['enableJsonFindExpr']) && 
$options['enableJsonFindExpr']
== true) {
// here we enable pre-processing js expressions
}
}


class ZendJsonExpr
{
public static function encode($valueToEncode, $cycleCheck = false, 
$options
= array())
{
// turn this option on
$options['enableJsonFindExpr'] == true;
return ZendJson::encode($valueToEncode, $cycleCheck, $options);
}
}

Simple replace code form
ZendJson::encode($value);
to
ZendJsonExpr::encode($value);
in components that realy need this feature. By e.g. in ZendX_Jquery
components.
-- 
View this message in context: 
http://www.nabble.com/Recomendation-to-solve-problem-with-ZendJsonExprFinder-in-Zend_Json%3A%3Aencode%28%29-tp21405959p21412476.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Re: Re[fw-general] comendation to solve problem with ZendJsonExprFinder in Zend_Json::encode()

2009-01-11 Thread mezoni

These code will be passed to json_encode

{"modal":true,"buttons":{"Zend_Json_Expression_Index_0":"Zend_Json_Expression_Value_0","Zend_Json_Expression_Index_1":"Zend_Json_Expression_Value_1","Zend_Json_Expression_Index_2":"Zend_Json_Expression_Value_2"}}

str_replace() work with this patterns fine.
-- 
View this message in context: 
http://www.nabble.com/Recomendation-to-solve-problem-with-ZendJsonExprFinder-in-Zend_Json%3A%3Aencode%28%29-tp21405959p21406038.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Re[fw-general] comendation to solve problem with ZendJsonExprFinder in Zend_Json::encode()

2009-01-11 Thread mezoni

The problem with UTF keys and diffirence with them before call json_encode
and after.
Code Example:

dialogContainer('dialogTest', '1',
array(
'modal' => true,
'buttons' => array(
'Отмена 3' => new Zend_Json_Expr('function(){ alert("Cancel 3");
$(this).dialog("close") }'),
'Latin 2' => new Zend_Json_Expr('function(){ alert("Latin 2");
$(this).dialog("close") }'),
'Добавить 1' => new Zend_Json_Expr('function(){ alert("Add 1");
$(this).dialog("close") }')
)),
array('title' => 'ZendJsonExprFinder Test Multilangual Dialog'))
?>

Code generated by current Zend_Json::encode() implementation:



[fw-general] What is best practice to imlement Web Controls?

2008-12-31 Thread mezoni

What is best practice to imlement Web Controls with callbacks?
I want that controls will be accessible in controllers and in views.

Example:

IndexController.php

class IndexController extends extends Zend_Controller_Action
{
  function indexAction()
  {
 $this->myCoolControl1 = new My_WebControls_CoolControl();
 $this->mySuperCoolControl1 = new My_WebControls_SuperCoolControl();

 $this->myCoolControl1->param1 = 'someParam';
 $this->myCoolControl1->onClick = array($this,
'_myCoolControl1OnClick');
 $this->myCoolControl1->prepare(); // or init() or ???

 $this->view->myCoolControl1 = $myCoolControl1;
 $this->view->mySuperCoolControl1 = $mySuperCoolControl1;
  }

  protected function _myCoolControl1OnClick() // may be with params?
  {
 $this->mySuperCoolControl1->text = 'Clicked!';
  }
}

index.phtml

myCoolControl1 ?>
mySuperCoolControl1 ?>
-- 
View this message in context: 
http://www.nabble.com/What-is-best-practice-to-imlement-Web-Controls--tp21232254p21232254.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Trouble with Zend_Layout

2008-10-04 Thread mezoni

No problems!

After some corrections in Zend_Loader_PluginLoader this problem will be
fixed.
Good job!
-- 
View this message in context: 
http://www.nabble.com/Trouble-with-Zend_Layout-tp19802825p19812091.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Trouble with Zend_Layout

2008-10-03 Thread mezoni

PluginLoader cannot load Zend_Layout.

In my bootstrap.ph I use the following code:

require_once "Zend/Layout.php";
Zend_Layout::startMvc(array('layoutPath' => self::$path .
'/application/modules/default/views/scripts'));
Zend_Layout::getMvcInstance()->getView()->addScriptPath(self::$path
. '/application/modules/default/views/scripts');

But in layout.phtm at this line...

layout()->content ?>

...PluginLoader to do the following...

Zend_Loader::loadFile($classFile, $paths);

...and Zend_Loader add to paths paths from get_include_path()

An I get the error

Cannot redeclare class Zend_Layout
-- 
View this message in context: 
http://www.nabble.com/Trouble-with-Zend_Layout-tp19802825p19802825.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Is ZF Teem planned official user plugin repository?

2008-09-25 Thread mezoni

Is ZF Teem planned official user plugin repository?
-- 
View this message in context: 
http://www.nabble.com/Is-ZF-Teem-planned-official-user-plugin-repository--tp19673010p19673010.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Simple menu on every page

2008-03-18 Thread mezoni

index.php

// Configuration
require_once 'Zend/Config/Ini.php';
require_once 'Zend/Registry.php';
Zend_Registry::set('config', new Zend_Config_Ini('config.ini'));

layout.phtml

action('menu', 'navigation', 'internal') ?>
action('submenu', 'navigation', 'internal') ?>

It is only my exprience...
-- 
View this message in context: 
http://www.nabble.com/Simple-menu-on-every-page-tp16121967s16154p16124806.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Simple menu on every page

2008-03-18 Thread mezoni

menu.phtm, submenu.phtm


items as $item): ?>

href="" title="escape($item['description'])
?>">
escape($item['title']) ?>





config.ini

[navigation]
modules.default.title = Главная
modules.default.description = Главная страница
modules.catalog.title = Каталог
modules.catalog.description = Каталог товаров
modules.personal.title = Персональное
modules.personal.description = Персональный раздел
modules.default.controllers.index.title = Главная страница
modules.catalog.controllers.index.title = Каталог товаров
modules.catalog.controllers.categories.title = Категории товаров
modules.personal.controllers.index.title = Персональный раздел
modules.personal.controllers.shoppingcart.title = Корзина
modules.personal.controllers.quotes.title = Заявки
-- 
View this message in context: 
http://www.nabble.com/Simple-menu-on-every-page-tp16121967s16154p16124585.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Simple menu on every page

2008-03-18 Thread mezoni

I try experience like this:

navigation->toArray();

self::$front = $this->getFrontController();
self::$request = self::$front->getRequest();

self::$action = self::$request->getActionName();
self::$controller = self::$request->getControllerName();
self::$module = self::$request->getModuleName();

self::$defaultAction = self::$front->getDefaultAction();
self::$defaultController =
self::$front->getDefaultControllerName();
self::$defaultModule = self::$front->getDefaultModule();

self::$initialized = true;
}
}

public function breadcrumbsAction()
{
$items = array();

if(1) {
}

return $items;
}

public function menuAction()
{
$items = array();

$modules = $this->getModules();

foreach($modules as $key => $module) {
$module['url'] = '/';

if($key != self::$defaultModule) {
$module['url'] = '/' . $key;
}

$module['current'] = $key == self::$module;

$items[] = $module;
}

$this->view->items = $items;
}

public function submenuAction()
{
$items = array();

$moduleName = self::$module;

$controllers = $this->getControllers($moduleName);

foreach($controllers as $key => $controller) {

$url = array();

if($moduleName != self::$defaultModule) {
$url[] = $moduleName;
}

if($key != self::$defaultController) {
$url[] = $key;
}

$controller['url'] = '/' . implode('/', $url);
$controller['current'] = $key == self::$controller;

$items[] = $controller;
}

$this->view->items = $items;
}

protected function getControllers($module)
{
$items = array();
$attributes  = array('title', 'description');

if(!isset(self::$map['modules'][$module]['controllers']) ||
   !is_array(self::$map['modules'][$module]['controllers'])) {
return $items;
}

foreach(self::$map['modules'][$module]['controllers'] as $key =>
$controller) {
if(!is_array($controller)) {
continue;
}

$item = $controller;

foreach($attributes as $attribute) {
if(!isset($controller[$attribute])) {
$item[$attribute] = $key;
}
}

$items[$key] = $item;
}

return $items;
}

protected function getModule()
{
$module = false;
}

protected function getModules()
{
$items = array();
$attributes  = array('title', 'description');

if(isset(self::$map['modules']) && is_array(self::$map['modules']))
{
foreach(self::$map['modules'] as $key => $module) {
if(!is_array($module)) {
continue;
}

$item = $module;

foreach($attributes as $attribute) {
if(!isset($module[$attribute])) {
$item[$attribute] = $key;
}
}

$items[$key] = $item;
}
}

return $items;
}
}
-- 
View this message in context: 
http://www.nabble.com/Simple-menu-on-every-page-tp16121967s16154p16124527.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] This is a bug or feature?

2008-01-31 Thread mezoni

I have a controller named 'ShoppingCartController'.
When I reaquest this action like this http://mysite/s-h-o-p-p-i-n-g-c-a-r-t
I get the following error:
Uncaught exception 'Zend_View_Exception' with message
'script 's-h-o-p-p-i-n-g-c-a-r-t/index.phtml' not found in path
(.\application\modules\default\views\scripts\)'
in Y:\home\test1.ru\www\library\Zend\View\Abstract.php:853

Why?

I'm not have the 'S-h-o-p-p-i-n-g-c-a-r-tController'...

Why I not get the following error?
Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message
'Invalid controller specified (s-h-o-p-p-i-n-g-c-a-r-t)'
in Y:\home\test1.ru\www\library\Zend\Controller\Dispatcher\Standard.php:198

I'm sorry for my English...
-- 
View this message in context: 
http://www.nabble.com/This-is-a-bug-or-feature--tp15214302s16154p15214302.html
Sent from the Zend Framework mailing list archive at Nabble.com.