AW: [fw-general] Seeking Zend_Controller_Router_Route_Immutable

2007-07-30 Thread Leo Büttiker | tilllate
Hi Kevin,
Great idea, I'm looking forward to see your proposal. 

But what's about just writing (sub classing) a new Router, which caches just
in the route function. Like if the routes-array do not change since the last
request, take the path infos and look if they allread in the cache, if not
calculate the route and cache them.
Cheers,
Leo   


Von: Kevin McArthur [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 30. Juli 2007 21:45
An: fw-general@lists.zend.com
Betreff: [fw-general] Seeking Zend_Controller_Router_Route_Immutable

I'm currently looking for a solution before putting together a proposal for
a currently non-existant class Zend_Controller_Router_Route_Immutable.
 
This would be a caching solution for routes that would allow you to define a
route as always having the same output for a given input and to cache its
response such that it can bypass the dispatch process completely if it has
been previously generated.
 
$router->addRoute('cached', new
Zend_Controller_Router_Route_Immutable('/route'));
 
This could be a significant performance increase, but I'm looking for an
elegant solution in terms of modifying the actual framework to support it
rather than creating a plugin or something else that occurs -during-
dispatch.
 
Thoughts?
 
Kevin




AW: [fw-general] Best way to utilize Zend_Registry

2007-07-30 Thread Leo Büttiker | tilllate
Hi Brian,
PHP works on a very different way than java does. We call this share nothing
architecture, after the request there are (usually) no data in memory. So
you have a completely different way in PHP, this needs some different
thinking about stuff. 

Zend Registry is unset after the request like every other object. Sure with
some hacks you can make the registry permanent, put this is not the PHP way
(and might be slow as hell).
Cheers,
leo 

-Ursprüngliche Nachricht-
Von: Brian Dittmer [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 30. Juli 2007 21:56
An: fw-general@lists.zend.com
Betreff: [fw-general] Best way to utilize Zend_Registry

Hey guys, I'm fairly new to the Zend Framework and have a few 
questions.  Firstly let me begin by describing the architecture I have 
in place.

I have a set of domain classes, each of which represent a specific table 
in the database.  I'm using a set of service classes I built to populate 
the domain objects.  Pretty standard stuff.  These service and domain 
classes all reside in their own specific lib directory so they can be 
used across our admin, intranet and public facing websites. 

My question is can I utilize the Zend_Registry to provide a single 
instance of each of my Service classes across each app domain (public, 
intranet, admin)?  If so how would I go about initially populating the 
registry?  I come from the Java world and there I'd typically be using 
the Spring framework to inject dependencies into and maintain my service 
classes.  All of that would typically occur on startup of the servlet 
container.  I'll be using a similiar technique to maintain an instance 
of Zend_Config and a few other special classes I have developed.  Any 
help with this would be much appreciated!

Brian Dittmer




Re: [fw-general] zend_acl where should i keep php abcacl.php (class abcacl extends zend_acl)

2007-07-30 Thread Christian Fischer



altaf.samnani wrote:
> 
> zend_acl where should i keep php abcacl.php  (class abcacl extends
> zend_acl) ,nd wat changes i need to make in index.php nd i m having dir
> structure so shud it be fixd or it can be anything as i m new i donne know
> tht much 
>   -sam
> 

Call your Class MyLib_Acl 

MyLib_Acl extens Zend_Acl

and store it in
Library/MyLib/Acl.php

For directors read the manual there is everything described so far.

-- 
View this message in context: 
http://www.nabble.com/zend_acl-where-should-i-keep-php-abcacl.php--%28class-abcacl-extends-zend_acl%29-tf4191005s16154.html#a11918801
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] zend_acl where should i keep php abcacl.php (class abcacl extends zend_acl)

2007-07-30 Thread altaf.samnani

zend_acl where should i keep php abcacl.php  (class abcacl extends zend_acl)
and i m having dir structure so shud it be fixd or it can be anything as i m
new i donne know tht much 
  -sam
-- 
View this message in context: 
http://www.nabble.com/zend_acl-where-should-i-keep-php-abcacl.php--%28class-abcacl-extends-zend_acl%29-tf4191005s16154.html#a11918388
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Zend_Search_Lucene Ranged Queries

2007-07-30 Thread Alexander Veremyev
Hi Jeff,
 
Please don't forget set TextNumeric analyzer as default before indexing and 
search:
-
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new 
Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());

 
With best regards,
   Alexander Veremyev.
 




From: Jeff Kolber [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 31, 2007 2:36 AM
To: Jurriën Stutterheim
Cc: fw-general@lists.zend.com
Subject: Re: [fw-general] Zend_Search_Lucene Ranged Queries


I found that range queries were not working on tokenized fields, at 
least tokenized fields that were all numeric  -- I used fields of type keyword 
and then found that ranges were working. 



Jeff Kolber
Lead Developer
Roubini Global Economics, LLC
131 Varick Street, Suite 1005
New York, NY 10013
Tel: 212-645-0010
Fax:212-645-0023
[EMAIL PROTECTED]
http://www.rgemonitor.com/


On Jul 30, 2007, at 2:15 PM, Jurriën Stutterheim wrote:


Hi all,

I've been trying to get ranged queries to work, but 
unfortunatly with little success.
When I have the following query:

published:1995

It successfully lists all books from 1995.
But when I have a ranged query it returns 0 hits:

published:[1995 TO 1997]

What could be the problem?

Thanks!



Jurriën




[fw-general] Issues with session namespace

2007-07-30 Thread Dan Rossi
Hi there, i seem to be having a problem with a session namespace 
problem, and non cookie and cookie sessions. Basically Im going to a 
"check" action on the script which has a temporary session attached like 
/index/check?client=502850935809325825039523, when I check that the 
session is active however, collect its data , and then destroy it to 
create a permanent cookie session it simply wont work when i redirect 
back to the index controller the cookie session is empty. I had to get 
it working again by using the raw php functions only, the zend session 
classes simply do not work. Code below. Basically the start of check has 
session options for the non cookie session. Then when its destroyed 
another set of session options are made for the cookie session, when its 
redirected , the session is empty but the cookie is set.


public function indexAction()
  {

try {
  $config = Zend_Registry::get('config');
  Zend_Session::setOptions($config->session->toArray());
  Zend_Session::start();
  //Zend_Session::rememberMe(172800);
  } catch (Zend_Session_Exception $e) {
  var_dump($e);
  }
  //Zend_Session::regenerateId();
$this->session = new Zend_Session_Namespace('space');
  if ($this->session->isLocked()) {
  $this->session->unLock();
  }
}

public function checkAction()
  {
  $this->_helper->viewRenderer->setNoRender();

  try {
  $config = Zend_Registry::get('config');

Zend_Session::setOptions($config->keySession->toArray());

  Zend_Session::start();
  $this->session = new Zend_Session_Namespace('client');
  $this->session->setExpirationSeconds(10);
  $this->session->setExpirationHops(1);
  } catch (Zend_Session_Exception $e) {
  var_dump($e);
  }


   if ($this->session->customerID)
  {

   $customerID = $this->session->customerID;

  Zend_Session::destroy(true,false);
 try {
  Zend_Session::setOptions($config->session->toArray());
  Zend_Session::start();
  //Zend_Session::rememberMe(172800);
  //Zend_Session::regenerateId();
$this->session = new 
Zend_Session_Namespace('space');

   if ($this->session->isLocked()) {
  $this->session->unLock();
  }
  //  $this->session->lock();
//} catch (Zend_Session_Exception $e) {
  var_dump($e);
  }
$this->session->customerID = $customerID;
  
  $this->_redirector->gotoUrl('/');

return;
  }

}


Re: [fw-general] Zend Framework 1.0.1 released

2007-07-30 Thread Dan Rossi
Hi, im very new here, is there a PEAR like installer to run the update 
or does it have to be overwritten all the time ?


Andi Gutmans wrote:
Thanks Darby and all the rest for getting this out the door! 

  

-Original Message-
From: Darby Felton [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 30, 2007 1:14 PM

To: [EMAIL PROTECTED]; fw-general@lists.zend.com
Subject: [fw-general] Zend Framework 1.0.1 released

Hi everyone,

It is my pleasure to announce the release of Zend Framework 
1.0.1, available now at http://framework.zend.com.


This mini release includes fixes for 33 issues since the 
1.0.0 release only a month ago. These issues are generally 
bug fixes and improvements, though some feature additions 
have been included with this release.


This release includes enforcement of our new policy of only 
publishing documentation translations that are at least 50% 
complete. At this time the published translations are 
Japanese, German, French, and Russian.


Also noteworthy for the 1.0.1 release are many improvements 
for Zend_Gdata and numerous bug fixes for Zend_Db.


More significant enhancements and feature additions are 
scheduled for the upcoming minor release, 1.1.0, which should 
be in early September.


If you are interested in proposed Zend Framework improvements 
and new Zend Framework components, please check out the 
proposals page:


http://framework.zend.com/wiki/x/Lw

Many thanks to all the Zend Framework contributors who make 
these releases possible!


Best regards,
Darby




  




RE: [fw-general] Zend Framework 1.0.1 released

2007-07-30 Thread Andi Gutmans
Thanks Darby and all the rest for getting this out the door! 

> -Original Message-
> From: Darby Felton [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 30, 2007 1:14 PM
> To: [EMAIL PROTECTED]; fw-general@lists.zend.com
> Subject: [fw-general] Zend Framework 1.0.1 released
> 
> Hi everyone,
> 
> It is my pleasure to announce the release of Zend Framework 
> 1.0.1, available now at http://framework.zend.com.
> 
> This mini release includes fixes for 33 issues since the 
> 1.0.0 release only a month ago. These issues are generally 
> bug fixes and improvements, though some feature additions 
> have been included with this release.
> 
> This release includes enforcement of our new policy of only 
> publishing documentation translations that are at least 50% 
> complete. At this time the published translations are 
> Japanese, German, French, and Russian.
> 
> Also noteworthy for the 1.0.1 release are many improvements 
> for Zend_Gdata and numerous bug fixes for Zend_Db.
> 
> More significant enhancements and feature additions are 
> scheduled for the upcoming minor release, 1.1.0, which should 
> be in early September.
> 
> If you are interested in proposed Zend Framework improvements 
> and new Zend Framework components, please check out the 
> proposals page:
> 
> http://framework.zend.com/wiki/x/Lw
> 
> Many thanks to all the Zend Framework contributors who make 
> these releases possible!
> 
> Best regards,
> Darby
> 


Re: [fw-general] Zend_Db (Table-Row)

2007-07-30 Thread agatone

I'm sorry ... I'll try to explain it a bit better.

Let's say we have table NEWS with fields  id, title, content, rel_author_id,
rel_category_id.

So fetching all news would look something like this:

fetchAll();
?>

Now every news has author, who's name I wanna output too. Solution would be
to call method "findParentRow('Users')" inside of template's foreach (for
every row - news) or to go thru all rows in controller code and get it
there.

What I was thinking is there something to tell what parents (plural is used
cuz news has parent of rel_author_id and rel_category_id) should be fetched. 
For example (I know it's not existing) something like:
autoFetchParents = array('Users', 'Categories');
$newsRowset = $news->fetchAll();
?>
I guess there would be a problem when you'd have some relation inside user
table and you would also need that data at outputing news.
Maybe that would could be solved with MD array .:)
array('Users' => array('Roles'), 'Categories');
and more complex:
array('Users' => array('Roles' => array('subsubRole')), 'Categories');

Sorry ... late hour :)
-- 
View this message in context: 
http://www.nabble.com/Zend_Db-%28Table-Row%29-tf4179879s16154.html#a11900923
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Integrating Smarty with Zend

2007-07-30 Thread Dan Rossi
Hi ive managed to integrate 3 templating engines which are Smarty , 
Template Lite and PEAR's HTML_Template_Flexy which is the best. The 
smarty examples out there are broken and out of date, it took a while to 
find the right one. Let me know if you need a hand with this.


Here is my version, let me know if this is what you are after or if this 
version is aswell out of date 


The problem I may have with this is, an application of ours needs 
templates from different directories from a given session variable ie 
site1, site2, site3 etc so there is no easy way to dynamically change 
the view "script" template location unless there is a way ?


class Zend_View_Smarty extends Zend_View_Abstract
{
   /**
* Smarty object
* @var Smarty
*/
   protected $_smarty;

   /**
* Constructor
*
* Pass it a an array with the following configuration options:
*
* scriptPath: the directory where your templates reside
* compileDir: the directory where you want your compiled templates 
(must be

* writable by the webserver)
* configDir: the directory where your configuration files reside
*
* both scriptPath and compileDir are mandatory options, as Smarty needs
* them. You can't set a cacheDir, if you want caching use Zend_Cache
* instead, adding caching to the view explicitly would alter behaviour
* from Zend_View.
*
* @see Zend_View::__construct
* @param array $config
* @throws Exception
*/
   public function __construct($config = array())
   {
   $this->_smarty = new Smarty();
   //smarty object

   if (!array_key_exists('compileDir', $config)) {
   throw new Exception('compileDir must be set in $config for ' 
. get_class($this));

   } else {
   $this->_smarty->compile_dir = $config['compileDir'];
   }
   //compile dir must be set

   if (array_key_exists('configDir', $config)) {
   $this->_smarty->config_dir = $config['configDir'];
   }
   //configuration files directory

   parent::__construct($config);
   //call parent constructor
   }

   /**
* Return the template engine object
*
* @return Smarty
*/
   public function getEngine()
   {
   return $this->_smarty;
   }

   /**
* fetch a template, echos the result,
*
* @see Zend_View_Abstract::render()
* @param string $name the template
* @return void
*/
   protected function _run()
   {
   $this->strictVars(true);

   $vars = get_object_vars($this);
   foreach ($vars as $key => $value) {
   if ('_' != substr($key, 0, 1)) {
   $this->_smarty->assign($key, $value);
   }
   }
   //assign variables to the template engine
   $this->_smarty->assign_by_ref('this', $this);
   //why 'this'?
   //to emulate standard zend view functionality
   //doesn't mess up smarty in any way

   $path = $this->getScriptPaths();
  
   $file = substr(func_get_arg(0), strlen($path[0]));

   //smarty needs a template_dir, and can only use templates,
   //found in that directory, so we have to strip it from the filename

   $this->_smarty->template_dir = $path[0];
   //set the template diretory as the first directory from the path

   echo $this->_smarty->fetch($file);
   //process the template (and filter the output)
   }
}


mbneto wrote:

Hi,

I've been using Zend with my projects since 0.7 and using a Smarty 
class with the View to allow me to $this->view->render using the 
templates.


I've upgraded to Zend 1.0.0 and all my pages broke with a fatal error 
message


*Fatal error*: Class Foo_View_Smarty contains 3 abstract methods and 
must therefore be declared abstract or implement the remaining methods 
(Zend_View_Interface::getScriptPaths, 
Zend_View_Interface::setBasePath, Zend_View_Interface::addBasePath)


The class code is listed bellow but after searching for a while I saw 
some posts regarding the ViewRenderer.  Since I'll have to recode some 
files I am looking for a 'definitive' way to integrate Smarty with 
Zend without having to wait until Zend_Layout appears...


class Foo_View_Smarty implements Zend_View_Interface
{
protected $_smarty;
  
public function __construct($path = null, array $config = array())
{  
$this->_smarty = new Smarty;
   
if ($path !== null)

{
$this->setScriptPath($path);
}

foreach ($config as $key => $value)
{
$this->_smarty->$key = $value;}
}  


  public function getEngine()
{return $this->_smarty;
}   


  public function setScriptPath($path)
{if (!Zend_Loader::isReadable($path))   
  {throw new Zend_View_Exception("Unable to read 
script path: {$path}");}
  $this->_smarty->template_dir = $path;
}  


  public function __set($key, $value)
{$this->_smarty->assign(

RE: [fw-general] Zend_Db (Table-Row)

2007-07-30 Thread Bill Karwin
I'm not sure I understand the question.  There must be exactly one
parent row in the referenced table.  So there's no reason to specify
anything about what parents are to be fetched.  Either you want that
single row, or you don't.

Fetching dependent rows is another issue -- there can be zero, one, or
more dependent rows, and we have an open feature request to implement a
solution so that you can specify query clauses for fetching dependent
rows.

Regards,
Bill Karwin 

> -Original Message-
> From: agatone [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 30, 2007 4:38 PM
> To: fw-general@lists.zend.com
> Subject: [fw-general] Zend_Db (Table-Row)
> 
> 
> Fetching realted row should be something like this (if i'm 
> not wrong)  $bugsTable = new Bugs();
> $bugsRowset= $bugsTable->fetchAll();
> foreach ($bufRowset as $bug1) {
>   $reporter  = $bug1->findParentAccounts();
> }
> ?>
> 
> My question is: Is there already somekind of function where 
> you can pass what parents are to be fetched or I'm on my own here?
> --
> View this message in context: 
> http://www.nabble.com/Zend_Db-%28Table-Row%29-tf4179879s16154.
> html#a11886141
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> 


[fw-general] Zend_Db (Table-Row)

2007-07-30 Thread agatone

Fetching realted row should be something like this (if i'm not wrong)
fetchAll();
foreach ($bufRowset as $bug1) {
  $reporter  = $bug1->findParentAccounts();
}
?>

My question is: Is there already somekind of function where you can pass
what parents are to be fetched or I'm on my own here?
-- 
View this message in context: 
http://www.nabble.com/Zend_Db-%28Table-Row%29-tf4179879s16154.html#a11886141
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Zend_Search_Lucene performance issue

2007-07-30 Thread Alexander Veremyev
Hi Daniel,

Lucene.NET and Java Lucene both intensively use data caching. It's done
at index objects reading level, so even recreated queries are executed
much more faster.

It's very reasonable for Java and .NET environment where long-running
applications is a common case.
Moreover Java Lucene searching demo (org.apache.lucene.demo.SearchFiles)
starts search time calculation (in a benchmarking mode) only at the
second query execution, so it has query data already cached even for one
iteration.
Java Lucene also skips index loading time from such benchmarks and it's
also correct for common Java environment.

That differs for PHP applications which have to open index and load data
once per request.
Zend_Search_Lucene also uses caching, but only for TermInfo data. So it
has to load other info from index at each find() execution.


Search performance has been one of the major goals during
Zend_Search_Lucene implementation. We made a lot of tests, but saw that
results strongly depended on environment, indexed data (index size,
dictionary, terms selectivity), common queries and so on. Some tests
gave better results for Zend_Search_Lucene and others for Java Lucene
(more often). The major Zend_Search_Lucene problem is large result sets
(thousands and tens of thousands hits).

So there is no any official benchmarks for Zend_Search_Lucene. The only
thing which can be said is that it's reasonable comparable with Java
Lucene.



PS Terms dictionary index is not used if you only add new documents to
the index. So Zend_Search_Lucene loads it at the first find() request.
It's usually major part of search time.
Java Lucene and Lucene.NET load terms dictionary index completely at
index opening time. That's determined by common execution environment.
That also may affect your benchmarking results.

With best regards,
   Alexander Veremyev.


> -Original Message-
> From: Daniel Freudenberger [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 30, 2007 11:38 AM
> To: Alexander Veremyev
> Cc: fw-general@lists.zend.com
> Subject: RE: [fw-general] Zend_Search_Lucene performance issue
> 
> Hi Alexander,
> 
> I'm not 100% sure that I didn't miss anything important but 
> I'm quiet sure, that the .NET result wasn't cached at all. I 
> changed the query several times and the response time was 
> still between 0.001 and 0.005. Two days ago I started the 
> same benchmark with the original java lucene and had response 
> times way less than 0.01 too.
> 
> Best regards,
> Daniel
> 
> -Original Message-
> From: Alexander Veremyev [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 30, 2007 8:05 AM
> To: Daniel Freudenberger
> Cc: fw-general@lists.zend.com
> Subject: Re: [fw-general] Zend_Search_Lucene performance issue
> 
> Hi Daniel,
> 
> Are you sure the testing method you use is correct?
> Ex. are you sure .net version doesn't cache search result?
> 
> 
> With best regards,
> Alexander Veremyev.
> 
> 
> Daniel Freudenberger wrote:
> > -->
> > 
> > Hello,
> > 
> >  
> > 
> > I've started playing around with zend_search_lucene in the 
> morning and 
> > at
> > 
> > first, I was very impressed. After that I've started to 
> index all of 
> > the
> > 
> > relevant items that are stored in the database so far.
> > 
> >  
> > 
> > The index now contains 28069 documents and the find() method takes 
> > ~0.4
> > 
> > seconds to return for a very simple search expression. I've 
> tested the
> same
> > 
> > expression against the same index with the .net lucene port and the
> request
> > 
> > took about 0.001 to 0.005 seconds. I know, I should not compare php 
> > with
> any
> > 
> > .net language (in this case c#) but we're not talking about 
> twice the
> speed
> > 
> > or better, we're talking about the factor 100-400.
> > 
> >  
> > 
> > I just hope I did something wrong or missed an important point in 
> > manual
> > 
> > about performance. Here's the imporant part of my code.
> > 
> >  
> > 
> > $iterations = 100;
> > 
> > $index = new Zend_Search_Lucene('c:\index');
> > 
> > $userQuery = 
> Zend_Search_Lucene_Search_QueryParser::parse('fifa');
> > 
> > $begin = microtime(true);
> > 
> > for($i = 0; $i < $iterations; ++$i) {
> > 
> >   $hits = $index->find($userQuery);
> > 
> > }
> > 
> > echo 'took: '.((microtime(true)-$begin)/$iterations).' seconds';
> > 
> >  
> > 
> > Best regards,
> > 
> > Daniel
> > 
> > 
> > 
> --
> > --
> > 
> > No virus found in this incoming message.
> > Checked by AVG Free Edition. 
> > Version: 7.5.476 / Virus Database: 269.10.22/921 - Release Date:
> 26.07.2007 23:16
> 
> 
> 


Re: [fw-general] Zend_Search_Lucene Ranged Queries

2007-07-30 Thread Jeff Kolber
I found that range queries were not working on tokenized fields, at  
least tokenized fields that were all numeric  -- I used fields of  
type keyword and then found that ranges were working.



Jeff Kolber
Lead Developer
Roubini Global Economics, LLC
131 Varick Street, Suite 1005
New York, NY 10013
Tel: 212-645-0010
Fax:212-645-0023
[EMAIL PROTECTED]
http://www.rgemonitor.com/


On Jul 30, 2007, at 2:15 PM, Jurriën Stutterheim wrote:


Hi all,

I've been trying to get ranged queries to work, but unfortunatly  
with little success.

When I have the following query:

published:1995

It successfully lists all books from 1995.
But when I have a ranged query it returns 0 hits:

published:[1995 TO 1997]

What could be the problem?

Thanks!



Jurriën




RE: [fw-general] Zend_Search_Lucene::find() Exception

2007-07-30 Thread Juan Felipe Alvarez Saldarriaga
Yes, look, I create a class name "Lucene" who is extended to 
Zend_Search_Lucene, so this is the action where I try to make the "find", it's 
not done yet, but thes is the base code:

public function searchAction()
{
// Load Lucene lib.
$objLucene = new Lucene( LUCENE_INDEX_PATH );

// Open Lucene index file and get the Lucene Proxy object from the return.
$objLuceneIndex = $objLucene->open( LUCENE_INDEX_PATH );

// Try to find this text in the Lucene index file.
$objLuceneQueryHits = $objLuceneIndex->find( $this->getRequest()->getPost( 
'text' ) );

// Loop hits and create a common structure to show this data into the view.
foreach ( $objLuceneQueryHits AS $objLuceneHit )
{
// Get Lucene Document object to retrieve data.
$objLuceneDocument = $objLuceneHit->getDocument();

echo "url: " . $objLuceneDocument->getField( 'url' ) . " -- " . 
$objLuceneDocument->getFieldValue( 'url' );
echo "identifier: " . $objLuceneDocument->getField( 'identifier' ) . " 
-- " . $objLuceneDocument->getFieldValue( 'identifier' );
echo "title: " . $objLuceneDocument->getField( 'title' ) . " -- " . 
$objLuceneDocument->getFieldValue( 'title' );
echo "content: " . $objLuceneDocument->getField( 'content' ) . " -- " . 
$objLuceneDocument->getFieldValue( 'content' ) . "";
}

exit();

}

And when I'm adding content to the index I'm just doing like the ZFW manual 
example, but I create a method in my "Lucene" class to set a field with his 
content as a php switch:

 /**
  * Function to set content into Lucene index.
  *
  * @param string $strName Name of the current element to be indexed.
  * @param string $strContent Content to be indexed by Lucene.
  * @param string $strType Lucene field types, text, keyword, unstored.
  * @return void
  *
  * NOTE: More info at 
http://framework.zend.com/manual/en/zend.search.lucene.html.
  */
 public function setLuceneContent( $strName, $strContent, $strType = "text" )
 {
  // Try to open the Lucene index file.
  try
  {
   // Load Lucene index file.
   $objLuceneProxy = self::open( LUCENE_INDEX_PATH );
  }
  catch ( Exception $objError )
  {
   throw new Exception( "Can't open the Lucene index file 
({$objError->getMessage()})" );
  }

  // Get Lucene index document.
  $objLuceneDocument = new Zend_Search_Lucene_Document();

  // Validate if we really have something to be indexed by Lucene.
  if ( false !== empty( $strContent ) )
  {
   throw new Exception( "Content to be indexed by Lucene can't be empty." );
  }

  // If the name is empty, erhhh ERROR!
  if ( false !== empty( $strName ) )
  {
   throw new Exception( "There's not name for the current element to be 
indexed." );
  }

  // Start indexed using a Lucene field type.
  switch ( $strType )
  {
   case "text":
// Add "Text" field to the Lucene index content.
$objLuceneDocument->addField( Zend_Search_Lucene_Field::Text( $strName, 
htmlentities( strip_tags( $strContent ) ) ) );

break;

   case "keyword":
// Add "Keyword" field to the Lucene index content.
$objLuceneDocument->addField( Zend_Search_Lucene_Field::Keyword( $strName, 
htmlentities( strip_tags( $strContent ) ) ) );

break;

   case "unstored":
// Add "UnStored" field to the Lucene index content.
$objLuceneDocument->addField( Zend_Search_Lucene_Field::UnStored( $strName, 
htmlentities( strip_tags( $strContent ) ) ) );

break;

   case "binary":
// Add "UnStored" field to the Lucene index content.
$objLuceneDocument->addField( Zend_Search_Lucene_Field::Binary( $strName, 
htmlentities( strip_tags( $strContent ) ) ) );

break;

   case "unindexed":
// Add "UnStored" field to the Lucene index content.
$objLuceneDocument->addField( Zend_Search_Lucene_Field::UnIndexed( 
$strName, htmlentities( strip_tags( $strContent ) ) ) );

break;

   default:
// Add "Text" field to the Lucene index content.
$objLuceneDocument->addField( Zend_Search_Lucene_Field::Text( $strName, 
htmlentities( strip_tags( $strContent ) ) ) );

break;
  }

  // Try to add fields to the current Lucene document.
  try
  {
   // Add current Lucene field to the Lucebe Document.
   $objLuceneProxy->addDocument( $objLuceneDocument );
  }
  catch ( Exception $objError )
  {
   throw new Exception( "Can't add this field ({$strType}) to the Lucene index 
file ({$objError->getMessage()})" );
  }
 }

So when I want to add data to the Lucene index I just make:

// Try to set the identifier and the page url into Lucene.
try
{
// Set page title as text.
Lucene::setLuceneContent( 'url', PAGE_QUERY_STRING . 
"/{$arrPageData['page']['identifier']}" );

// Set page identifier as a keyword.
Lucene::setLuceneContent( 'identifier', $arrPageData['page']['identifier'], 
'keyword' );
}
catch ( Exception $objError )
{
throw new Exception( "Can't index this content ({$objError->getMessage()})" 
);
}

I really dont know what's the problem, thx for any help.

_

Re: [fw-general] Integrating Smarty with Zend

2007-07-30 Thread mbneto
Hi Matthew,

Thanks for the prompt reply.

Please consider 'definitive' as 'a way to do what I need in a ZendFramework
way without having to wait for a new release' :)

After I posted the message I found another info about using Smarty and
ViewRenderer =>
http://naneau.nl/2007/05/31/using-naneau_view_smarty-with-rc1

I will try that since it seems to work with the current 'way of doing
things'.

Thanks again.


On 7/30/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
>
>
> There was a change to Zend_View_Interface introduced in the 1.0.0RC
> series due to, as you mention, the viewRenderer helper.
>
> > The class code is listed bellow but after searching for a while I saw
> some
> > posts regarding the ViewRenderer.  Since I'll have to recode some files
> I am
> > looking for a 'definitive' way to integrate Smarty with Zend without
> having to
> > wait until Zend_Layout appears...
>
> There likely will never be a "definitive" way to integrate Smarty, as
> it's not part of ZF. ;-)
>
> Another thing to note is that Smarty likes to have all templates grouped
> under a common tree. To work around this in projects I've done, I've
> made addScriptPath(), setBasePath(), and addBasePath() all work on an
> internal path array. Then in render(), I loop over those paths looking
> for the template, and, if not found, simply call fetch() on it,
> indicating it should fetch from the default template path setup at
> Smarty initialization.
>
> So, as an example:
>
>  require_once 'Zend/View/Interface.php';
>
> class Smarty_View implements Zend_View_Interface
> {
> protected $_scriptPath = array();
>
> protected $_smarty;
>
> public function __construct(array $options = null)
> {
> if (null !== $options) {
> if (!isset($options['smarty'])) {
> throw new Exception('Smarty_View requires a Smarty
> instance');
> }
>
> foreach ($options as $key => $value) {
> switch ($key) {
> case 'smarty':
> $this->_smarty = $value;
> break;
> case 'scriptPath':
> $this->setScriptPath($value);
> break;
> default:
> break;
> }
> }
> }
> }
>
> public function __set($key, $value)
> {
> $this->_smarty->assign($key, $value);
> }
>
> public function __get($key)
> {
> return $this->_smarty->get_template_vars($key);
> }
>
> public function __isset($key)
> {
> return (null !== $this->_smarty->get_template_vars($key));
> }
>
> public function __unset($key)
> {
> $this->_smarty->clear_assign($key);
> }
>
> public function getEngine()
> {
> return $this->_smarty;
> }
>
> public function setScriptPath($path)
> {
> $path = (array) $path;
> foreach ($path as $dir) {
> if (!is_dir($dir)) {
> throw new Exception('Invalid script path "' . $dir . '"');
> }
> }
>
> $this->_scriptPath = $path;
> return $this;
> }
>
> public function setBasePath($path, $prefix = 'Zend_View')
> {
> $path = ltrim($path, '/');
> $path .= '/scripts';
> return $this->setScriptPath($path);
> }
>
> public function addScriptPath($path)
> {
> if (!is_string($path) || !is_dir($path)) {
> throw new Exception('Invalid script path "' . $path . '"');
> }
>
> $this->_scriptPath[] = $path;
> return $this;
> }
>
> public function addBasePath($path, $prefix = 'Zend_View')
> {
> $path = rtrim($path, '/');
> $path .= '/scripts';
> return $this->addScriptPath($path);
> }
>
> public function getScriptPath($script)
> {
> return $this->_getScriptPath($script);
> }
>
> public function getScriptPaths()
> {
> return $this->_scriptPath;
> }
>
> public function assign($spec, $value = null)
> {
> if (is_array($spec)) {
> $this->_smarty->assign($spec);
> } elseif (is_string($spec) && (null !== $value)) {
> $this->_smarty->assign($spec, $value);
> } else {
> throw new Exception('Invalid call to assign variables; use
> assoc array or string/value pair');
> }
>
> return $this;
> }
>
> public function clearVars()
> {
> $this->_smarty->clear_all_assign();
> return $this;
> }
>
> public function render($name)
> {
> $name = $this->_getScriptPath($name);
> return $this->_smarty->fetch($name);
> }
>
> protected function _getScriptPath($name)
> {
> if (!file_exists($name) && (!empty($this->_scriptPath))) {
> foreach (array_reverse($this->_scriptPath) as $path) {
> $tmp = 

RE: [fw-general] Zend_Search_Lucene::find() Exception

2007-07-30 Thread Alexander Veremyev
Hi Juan,
 
Could you give an example of your code?
 
With best regards,
   Alexander Veremyev.




From: Juan Felipe Alvarez Saldarriaga
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 31, 2007 1:05 AM
To: fw-general@lists.zend.com
Subject: [fw-general] Zend_Search_Lucene::find() Exception


:)
 
Im trying to retrieve data from my index, but when I try to do
an echo from one of the hits I always get that the field is not found in
the document, in my case I'm adding four fields, url -> text, identifier
-> keyword, content -> unstored and title -> text, but when I print the
hits object I see that the fields are there:
 
... 
   [_fields:private] =>
Array
(
[0] =>
Zend_Search_Lucene_Index_FieldInfo Object
(

[name] => url

[isIndexed] => 1

[number] => 0

[storeTermVector] => 0
)

[1] =>
Zend_Search_Lucene_Index_FieldInfo Object
(

[name] => identifier

[isIndexed] => 1

[number] => 1

[storeTermVector] => 0
)

[2] =>
Zend_Search_Lucene_Index_FieldInfo Object
(

[name] => content

[isIndexed] => 1

[number] => 2

[storeTermVector] => 0
)

[3] =>
Zend_Search_Lucene_Index_FieldInfo Object
(

[name] => title

[isIndexed] => 1

[number] => 3

[storeTermVector] => 0
)

)
...
 
This is waht I got in the folder where I'm storing the Lucene
index:
 
-rw-r--r-- 1 www-data www-data 670 Jul 30 20:56 _d.cfs
-rw-r--r-- 1 www-data www-data 107 Jul 30 20:56 _d.sti
-rw-r--r-- 1 www-data www-data   4 Jul 30 20:44 deletable
-rw-r--r-- 1 www-data www-data   0 Jul 30 20:58 index.lock
-rw-r--r-- 1 www-data www-data   0 Jul 30 20:56
index.optimization.lock
-rw-r--r-- 1 www-data www-data  27 Jul 30 20:56 segments
 
Any help ?



This message contains confidential information and is intended
only for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please notify
the sender immediately by e-mail if you have received this e-mail by
mistake and delete this e-mail from your system. E-mail transmission
cannot be guaranteed to be secure or error-free as information could be
intercepted, corrupted, lost, destroyed, arrive late or incomplete, or
contain viruses. The sender therefore does not accept liability for any
errors or omissions in the contents of this message, which arise as a
result of e-mail transmission. If verification is required please
request a hard-copy version.




RE: [fw-general] Zend_Search_Lucene Ranged Queries

2007-07-30 Thread Alexander Veremyev
It's sign-style notation. 
'+' means 'required' term
'-' means prohibited
no sign means optional term.
 
So, rewrited query is OK
 
Next step. What is the result of:
-
echo Zend_Search_Lucene_Search_QueryParser::parse('published:[1995 TO 
1997]')->rewrite($index)->optimize($index)->__toString() . "\n";
-
 
With best regards,
   Alexander Veremyev.





From: Jurriën Stutterheim [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 30, 2007 11:47 PM
To: Alexander Veremyev
Cc: fw-general@lists.zend.com
Subject: Re: [fw-general] Zend_Search_Lucene Ranged Queries


Hi Alexander, 


The result of the echo is:


(published:1995 published:1996 published:1997)


Seems like two OR's are missing?


As for your second question: yes indeed, I set that analyzer as default 
(for both indexing and searching).


On 30 Jul 2007, at 21:35, Alexander Veremyev wrote:


Hi Jurriën,


1. What is the result of:
-
echo 
Zend_Search_Lucene_Search_QueryParser::parse('published:[1995 TO 
1997]')->rewrite($index)->__toString() . "\n";
-


2. It looks like you set TextNum analyzer correctly, but 
nevertheless I should ask. Did you set TextNume analyzer as default while you 
tested range queries?


With best regards,
   Alexander Veremyev.


-Original Message-
From: Jurriën Stutterheim [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 30, 2007 10:15 PM
To: fw-general@lists.zend.com
Subject: [fw-general] Zend_Search_Lucene Ranged Queries

Hi all,

I've been trying to get ranged queries to work, but 
unfortunatly with little success.
When I have the following query:

published:1995

It successfully lists all books from 1995.
But when I have a ranged query it returns 0 hits:

published:[1995 TO 1997]

What could be the problem?

Thanks!



Jurriën






[fw-general] Unable to get the correct controller/action

2007-07-30 Thread robert mena
Hi there,

I am using ZF but I am facing problems in my production server.   In my
development server everything is fine.

My

I am accessing a url foo.com/projectX/contact/chat but it always goes to
index/index.

My rewrite rule

RewriteEngine on
RewriteBase /projectX/
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

An my rewritelog shows

MY_IP - - [30/Jul/2007:17:31:16 --0600] [
foo.com/sid#9606b88][rid#ad307b0/initial] (2) init rewrite engine with
requested uri /projectX/contact/chat
MY_IP - - [30/Jul/2007:17:31:16 --0600] [
foo.com/sid#9606b88][rid#ad307b0/initial] (1) pass through
/projectX/contact/chat
MY_IP - - [30/Jul/2007:17:31:16 --0600] [
foo.com/sid#9606b88][rid#ad307b0/initial] (2) [per-dir
/var/www/html/foo.com/projectX/] rewrite contact/chat -> index.php


If I understood correctly the var_dump of the controller object tells me it
is using the index controller and index action...
...

["_dispatcher:protected"]=>
  object(Zend_Controller_Dispatcher_Standard)#10 (10) {
["_curDirectory:protected"]=>
NULL
["_curModule:protected"]=>
string(7) "default"
["_defaultAction:protected"]=>
string(5) "index"
["_defaultController:protected"]=>
string(5) "index"
["_defaultModule:protected"]=>
string(7) "default"
["_frontController:protected"]=>
NULL
["_invokeParams:protected"]=>
array(0) {
}
["_pathDelimiter:protected"]=>
string(1) "_"
["_response:protected"]=>
NULL
["_wordDelimiter:protected"]=>
array(2) {
  [0]=>
  string(1) "-"
  [1]=>
  string(1) "."
}
  }



What am I doing wrong?


[fw-general] Zend_Search_Lucene::find() Exception

2007-07-30 Thread Juan Felipe Alvarez Saldarriaga
:)

Im trying to retrieve data from my index, but when I try to do an echo from one 
of the hits I always get that the field is not found in the document, in my 
case I'm adding four fields, url -> text, identifier -> keyword, content -> 
unstored and title -> text, but when I print the hits object I see that the 
fields are there:

...
   [_fields:private] => Array
(
[0] => 
Zend_Search_Lucene_Index_FieldInfo Object
(
[name] => url
[isIndexed] => 1
[number] => 0
[storeTermVector] 
=> 0
)

[1] => 
Zend_Search_Lucene_Index_FieldInfo Object
(
[name] => identifier
[isIndexed] => 1
[number] => 1
[storeTermVector] 
=> 0
)

[2] => 
Zend_Search_Lucene_Index_FieldInfo Object
(
[name] => content
[isIndexed] => 1
[number] => 2
[storeTermVector] 
=> 0
)

[3] => 
Zend_Search_Lucene_Index_FieldInfo Object
(
[name] => title
[isIndexed] => 1
[number] => 3
[storeTermVector] 
=> 0
)

)
...

This is waht I got in the folder where I'm storing the Lucene index:

-rw-r--r-- 1 www-data www-data 670 Jul 30 20:56 _d.cfs
-rw-r--r-- 1 www-data www-data 107 Jul 30 20:56 _d.sti
-rw-r--r-- 1 www-data www-data   4 Jul 30 20:44 deletable
-rw-r--r-- 1 www-data www-data   0 Jul 30 20:58 index.lock
-rw-r--r-- 1 www-data www-data   0 Jul 30 20:56 index.optimization.lock
-rw-r--r-- 1 www-data www-data  27 Jul 30 20:56 segments

Any help ?


This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system. E-mail transmission cannot be guaranteed to be 
secure or error-free as information could be intercepted, corrupted, lost, 
destroyed, arrive late or incomplete, or contain viruses. The sender therefore 
does not accept liability for any errors or omissions in the contents of this 
message, which arise as a result of e-mail transmission. If verification is 
required please request a hard-copy version.


Re: [fw-general] Using Zend Studio 5.5.0 Debugger

2007-07-30 Thread Nathan Wright
Usually Zend Debugger works fine for me, but I've run into some  
strange problems like this too. Could never figure out what was  
actually causing it though.


Once it happened when I extended Zend_Controller_Action. I got the  
same 'Cannot redeclare class' error even when using  
Zend_Loader::registerAutoload(). Eventually I tried adding the Zend  
folder itself to the root of my ZDE project and it worked.


Another time I was trying out the proposal code of Zend_View  
Enhanced. I renamed everything to Zps_View but once again I got a  
'cannot redeclare class' error with Zend_View_Abstract as the  
culprit. I stepped through the code, and it was occurring in Zps/View/ 
Abstract.php declaring Zps_View_Abstract. This time, adding the Zend  
and Zps folders to the root did nothing. I tried rebuilding  
inspection data but that didn't help any either.


I'm using ZDE 5.2.0 on OSX.

ncw

On 30-Jul-07, at 10:33 AM, Liao, Kexiao wrote:


Dear Zend Framework Development Team,
 I am trying to use Zend Studio 5.5.0 IDE to Debug the demo codes  
(ZFGridDemo) from zend.com/webinar. Following error message show up  
when I try to execute following statement from zfgrid/document_root/ 
index.php file:


$db = Zend_Db::factory(
$config->database->adapter,
$config->database->params->toArray()
);
 Fatal error: Cannot redeclare class Zend_Db_Adapter_Abstract in / 
home/liaok/wwwroot/ZendFramework-1.0.0/library/Zend/Db/Adapter/ 
Abstract.php on line 51


 The Demo codes work well without using Zend Studio 5.5.0 Debugger  
function.
Does that mean that Zend Studio 5.5.0 Debugger can not work for  
Zend Framework? Thanks for your comment.

 Kevin


=== Cleveland Clinic is ranked one  
of the top hospitals in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for a complete  
listing of our services, staff and locations. Confidentiality Note:  
This message is intended for use only by the individual or entity  
to which it is addressed and may contain information that is  
privileged, confidential, and exempt from disclosure under  
applicable law. If the reader of this message is not the intended  
recipient or the employee or agent responsible for delivering the  
message to the intended recipient, you are hereby notified that any  
dissemination, distribution or copying of this communication is  
strictly prohibited. If you have received this communication in  
error, please contact the sender immediately and destroy the  
material in its entirety, whether electronic or hard copy. Thank you.






[fw-general] Zend Framework 1.0.1 released

2007-07-30 Thread Darby Felton
Hi everyone,

It is my pleasure to announce the release of Zend Framework 1.0.1,
available now at http://framework.zend.com.

This mini release includes fixes for 33 issues since the 1.0.0 release
only a month ago. These issues are generally bug fixes and improvements,
though some feature additions have been included with this release.

This release includes enforcement of our new policy of only publishing
documentation translations that are at least 50% complete. At this time
the published translations are Japanese, German, French, and Russian.

Also noteworthy for the 1.0.1 release are many improvements for
Zend_Gdata and numerous bug fixes for Zend_Db.

More significant enhancements and feature additions are scheduled for
the upcoming minor release, 1.1.0, which should be in early September.

If you are interested in proposed Zend Framework improvements and new
Zend Framework components, please check out the proposals page:

http://framework.zend.com/wiki/x/Lw

Many thanks to all the Zend Framework contributors who make these
releases possible!

Best regards,
Darby


Re: [fw-general] Seeking Zend_Controller_Router_Route_Immutable

2007-07-30 Thread Ralph Schindler
I think this is a great idea, and I imagine it would be best implemented 
as a Controller plugin.  By hooking the routeStartup() and 
routeShutdown(), can you then set the isDispatched flag to not dispatch. 
 Then at dispatchLoopShutdown(), the response object can be populated 
with the cache contents (and perhaps headers as well when 
Zend_Cache_Frontends_Page decides to implement them ;)  )


-ralph

Kevin McArthur wrote:
I'm currently looking for a solution before putting together a proposal 
for a currently non-existant class Zend_Controller_Router_Route_Immutable.
 
This would be a caching solution for routes that would allow you to 
define a route as always having the same output for a given input and to 
cache its response such that it can bypass the dispatch process 
completely if it has been previously generated.
 
$router->addRoute('cached', new 
Zend_Controller_Router_Route_Immutable('/route'));
 
This could be a significant performance increase, but I'm looking for an 
elegant solution in terms of modifying the actual framework to support 
it rather than creating a plugin or something else that occurs -during- 
dispatch.
 
Thoughts?
 
Kevin




Re: [fw-general] Integrating Smarty with Zend

2007-07-30 Thread Matthew Weier O'Phinney
-- mbneto <[EMAIL PROTECTED]> wrote
(on Monday, 30 July 2007, 03:37 PM -0400):
> I've been using Zend with my projects since 0.7 and using a Smarty class with
> the View to allow me to $this->view->render using the templates.
> 
> I've upgraded to Zend 1.0.0 and all my pages broke with a fatal error message
> 
> Fatal error: Class Foo_View_Smarty contains 3 abstract methods and must
> therefore be declared abstract or implement the remaining methods
> (Zend_View_Interface::getScriptPaths, Zend_View_Interface::setBasePath,
> Zend_View_Interface::addBasePath)

There was a change to Zend_View_Interface introduced in the 1.0.0RC
series due to, as you mention, the viewRenderer helper.

> The class code is listed bellow but after searching for a while I saw some
> posts regarding the ViewRenderer.  Since I'll have to recode some files I am
> looking for a 'definitive' way to integrate Smarty with Zend without having to
> wait until Zend_Layout appears...

There likely will never be a "definitive" way to integrate Smarty, as
it's not part of ZF. ;-)

Another thing to note is that Smarty likes to have all templates grouped
under a common tree. To work around this in projects I've done, I've
made addScriptPath(), setBasePath(), and addBasePath() all work on an
internal path array. Then in render(), I loop over those paths looking
for the template, and, if not found, simply call fetch() on it,
indicating it should fetch from the default template path setup at
Smarty initialization.

So, as an example:

 $value) {
switch ($key) {
case 'smarty':
$this->_smarty = $value;
break;
case 'scriptPath':
$this->setScriptPath($value);
break;
default:
break;
}
}
}
}

public function __set($key, $value)
{
$this->_smarty->assign($key, $value);
}

public function __get($key)
{
return $this->_smarty->get_template_vars($key);
}

public function __isset($key)
{
return (null !== $this->_smarty->get_template_vars($key));
}

public function __unset($key)
{
$this->_smarty->clear_assign($key);
}

public function getEngine()
{
return $this->_smarty;
}

public function setScriptPath($path)
{
$path = (array) $path;
foreach ($path as $dir) {
if (!is_dir($dir)) {
throw new Exception('Invalid script path "' . $dir . '"');
}
}

$this->_scriptPath = $path;
return $this;
}

public function setBasePath($path, $prefix = 'Zend_View')
{
$path = ltrim($path, '/');
$path .= '/scripts';
return $this->setScriptPath($path);
}

public function addScriptPath($path)
{
if (!is_string($path) || !is_dir($path)) {
throw new Exception('Invalid script path "' . $path . '"');
}

$this->_scriptPath[] = $path;
return $this;
}

public function addBasePath($path, $prefix = 'Zend_View')
{
$path = rtrim($path, '/');
$path .= '/scripts';
return $this->addScriptPath($path);
}

public function getScriptPath($script)
{
return $this->_getScriptPath($script);
}

public function getScriptPaths()
{
return $this->_scriptPath;
}

public function assign($spec, $value = null)
{
if (is_array($spec)) {
$this->_smarty->assign($spec);
} elseif (is_string($spec) && (null !== $value)) {
$this->_smarty->assign($spec, $value);
} else {
throw new Exception('Invalid call to assign variables; use assoc 
array or string/value pair');
}

return $this;
}

public function clearVars()
{
$this->_smarty->clear_all_assign();
return $this;
}

public function render($name)
{
$name = $this->_getScriptPath($name);
return $this->_smarty->fetch($name);
}

protected function _getScriptPath($name)
{
if (!file_exists($name) && (!empty($this->_scriptPath))) {
foreach (array_reverse($this->_scriptPath) as $path) {
$tmp = $path . DIRECTORY_SEPARATOR . $name;
if (file_exists($tmp)) {
$name = $tmp;
break;
}
}
}

return $name;
}
}

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Best way to utilize Zend_Registry

2007-07-30 Thread Brian Dittmer
Hey guys, I'm fairly new to the Zend Framework and have a few 
questions.  Firstly let me begin by describing the architecture I have 
in place.


I have a set of domain classes, each of which represent a specific table 
in the database.  I'm using a set of service classes I built to populate 
the domain objects.  Pretty standard stuff.  These service and domain 
classes all reside in their own specific lib directory so they can be 
used across our admin, intranet and public facing websites. 

My question is can I utilize the Zend_Registry to provide a single 
instance of each of my Service classes across each app domain (public, 
intranet, admin)?  If so how would I go about initially populating the 
registry?  I come from the Java world and there I'd typically be using 
the Spring framework to inject dependencies into and maintain my service 
classes.  All of that would typically occur on startup of the servlet 
container.  I'll be using a similiar technique to maintain an instance 
of Zend_Config and a few other special classes I have developed.  Any 
help with this would be much appreciated!


Brian Dittmer


Re: [fw-general] Zend_Search_Lucene Ranged Queries

2007-07-30 Thread Jurriën Stutterheim

Hi Alexander,

The result of the echo is:

(published:1995 published:1996 published:1997)

Seems like two OR's are missing?

As for your second question: yes indeed, I set that analyzer as  
default (for both indexing and searching).


On 30 Jul 2007, at 21:35, Alexander Veremyev wrote:


Hi Jurriën,

1. What is the result of:
-
echo Zend_Search_Lucene_Search_QueryParser::parse('published:[1995  
TO 1997]')->rewrite($index)->__toString() . "\n";

-

2. It looks like you set TextNum analyzer correctly, but  
nevertheless I should ask. Did you set TextNume analyzer as default  
while you tested range queries?



With best regards,
   Alexander Veremyev.


-Original Message-
From: Jurriën Stutterheim [mailto:[EMAIL PROTECTED]
Sent: Monday, July 30, 2007 10:15 PM
To: fw-general@lists.zend.com
Subject: [fw-general] Zend_Search_Lucene Ranged Queries

Hi all,

I've been trying to get ranged queries to work, but
unfortunatly with little success.
When I have the following query:

published:1995

It successfully lists all books from 1995.
But when I have a ranged query it returns 0 hits:

published:[1995 TO 1997]

What could be the problem?

Thanks!



Jurriën







[fw-general] Seeking Zend_Controller_Router_Route_Immutable

2007-07-30 Thread Kevin McArthur
I'm currently looking for a solution before putting together a proposal for a 
currently non-existant class Zend_Controller_Router_Route_Immutable.

This would be a caching solution for routes that would allow you to define a 
route as always having the same output for a given input and to cache its 
response such that it can bypass the dispatch process completely if it has been 
previously generated.

$router->addRoute('cached', new 
Zend_Controller_Router_Route_Immutable('/route'));

This could be a significant performance increase, but I'm looking for an 
elegant solution in terms of modifying the actual framework to support it 
rather than creating a plugin or something else that occurs -during- dispatch.

Thoughts?

Kevin

[fw-general] Integrating Smarty with Zend

2007-07-30 Thread mbneto
Hi,

I've been using Zend with my projects since 0.7 and using a Smarty class
with the View to allow me to $this->view->render using the templates.

I've upgraded to Zend 1.0.0 and all my pages broke with a fatal error
message

*Fatal error*: Class Foo_View_Smarty contains 3 abstract methods and must
therefore be declared abstract or implement the remaining methods
(Zend_View_Interface::getScriptPaths, Zend_View_Interface::setBasePath,
Zend_View_Interface::addBasePath)

The class code is listed bellow but after searching for a while I saw some
posts regarding the ViewRenderer.  Since I'll have to recode some files I am
looking for a 'definitive' way to integrate Smarty with Zend without having
to wait until Zend_Layout appears...

class Foo_View_Smarty implements Zend_View_Interface
{
protected $_smarty;

public function __construct($path = null, array $config = array())
{
$this->_smarty = new Smarty;

if ($path !== null)
{
$this->setScriptPath($path);
}

foreach ($config as $key => $value)
{
$this->_smarty->$key = $value;}
}

  public function getEngine()
{return $this->_smarty;
}

  public function setScriptPath($path)
{if (!Zend_Loader::isReadable($path))
  {throw new Zend_View_Exception("Unable to read script
path: {$path}");}
  $this->_smarty->template_dir = $path;
}

  public function __set($key, $value)
{$this->_smarty->assign($key, $value);
}

   public function __get($key)
{
return $this->_smarty->get_template_vars($key);
}

public function __isset($key)
{
return $this->_smarty->get_template_vars($key) !== null;
}

public function __unset($key)
{
$this->_smarty->clear_assign($key);
}

public function assign($spec, $value = null)
{

if (is_array($spec))
{
$this->_smarty->assign($spec);
}
else
{
$this->_smarty->assign($spec, $value);
}
}

public function clearVars()
{
$this->_smarty->clear_all_assign();
}

public function render($name)
{
return $this->_smarty->fetch($name);
}

public function fetch($name)
{
return $this->_smarty->fetch($name);
}
}


RE: [fw-general] Zend_Search_Lucene Ranged Queries

2007-07-30 Thread Alexander Veremyev
Hi Jurriën,

1. What is the result of:
-
echo Zend_Search_Lucene_Search_QueryParser::parse('published:[1995 TO 
1997]')->rewrite($index)->__toString() . "\n";
-

2. It looks like you set TextNum analyzer correctly, but nevertheless I should 
ask. Did you set TextNume analyzer as default while you tested range queries?


With best regards,
   Alexander Veremyev.

> -Original Message-
> From: Jurriën Stutterheim [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 30, 2007 10:15 PM
> To: fw-general@lists.zend.com
> Subject: [fw-general] Zend_Search_Lucene Ranged Queries
> 
> Hi all,
> 
> I've been trying to get ranged queries to work, but 
> unfortunatly with little success.
> When I have the following query:
> 
> published:1995
> 
> It successfully lists all books from 1995.
> But when I have a ranged query it returns 0 hits:
> 
> published:[1995 TO 1997]
> 
> What could be the problem?
> 
> Thanks!
> 
> 
> 
> Jurriën
> 


Re: [fw-general] Error messages again

2007-07-30 Thread Tony Harrison
Of course, but parse errors won't, regardless of where it's called.

Matthew Weier O'Phinney wrote:
> -- Tony Harrison <[EMAIL PROTECTED]> wrote
> (on Monday, 30 July 2007, 05:22 PM +0100):
>   
>> Setting the display_errors directive using ini_set() is no good for fatal
>> errors. You should change the ini file or set it from an apache config file.
>> 
>
> Um, yes, it *will* display fatal errors, so long as it is called *prior*
> to the fatal error occuring.
>
>
>   
>> Joó Ádám wrote:
>>
>> It was already there, but I've qouted the value... :$
>> Thank you, Matthew!
>>
>>
>> Ádám
>>
>> On 7/30/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
>>
>>
>> Add this to your bootstrap:
>>
>> error_reporting(E_ALL|E_STRICT);
>> ini_set('display_errors', true);
>> 
>
>   



Re: [fw-general] Error messages again

2007-07-30 Thread Mark
Not if it is an error during compilation (I think)

On Monday 30 July 2007 17:51, Matthew Weier O'Phinney wrote:
> -- Tony Harrison <[EMAIL PROTECTED]> wrote
>
> (on Monday, 30 July 2007, 05:22 PM +0100):
> > Setting the display_errors directive using ini_set() is no good for fatal
> > errors. You should change the ini file or set it from an apache config
> > file.
>
> Um, yes, it *will* display fatal errors, so long as it is called *prior*
> to the fatal error occuring.
>
> > Joó Ádám wrote:
> >
> > It was already there, but I've qouted the value... :$
> > Thank you, Matthew!
> >
> >
> > Ádám
> >
> > On 7/30/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
> >
> >
> > Add this to your bootstrap:
> >
> > error_reporting(E_ALL|E_STRICT);
> > ini_set('display_errors', true);



[fw-general] Zend_Search_Lucene Ranged Queries

2007-07-30 Thread Jurriën Stutterheim

Hi all,

I've been trying to get ranged queries to work, but unfortunatly with  
little success.

When I have the following query:

published:1995

It successfully lists all books from 1995.
But when I have a ranged query it returns 0 hits:

published:[1995 TO 1997]

What could be the problem?

Thanks!



Jurriën

[fw-general] Zend_Session_SaveHandler_Db, we've got working code and unit tests

2007-07-30 Thread Jordan Raub
please see
http://framework.zend.com/wiki/display/ZFPROP/Zend_Session_SaveHandler_Db

Jordan



[fw-general] Using Zend Studio 5.5.0 Debugger

2007-07-30 Thread Liao, Kexiao
Dear Zend Framework Development Team,
 I am trying to use Zend Studio 5.5.0 IDE to Debug the demo codes
(ZFGridDemo) from zend.com/webinar. Following error message show up when
I try to execute following statement from zfgrid/document_root/index.php
file: 
$db = Zend_Db::factory(
$config->database->adapter,
$config->database->params->toArray()
);
 Fatal error: Cannot redeclare class Zend_Db_Adapter_Abstract in
/home/liaok/wwwroot/ZendFramework-1.0.0/library/Zend/Db/Adapter/Abstract
.php on line 51
 The Demo codes work well without using Zend Studio 5.5.0 Debugger
function. 
Does that mean that Zend Studio 5.5.0 Debugger can not work for Zend
Framework? Thanks for your comment.
 Kevin


===

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.




Re: [fw-general] Error messages again

2007-07-30 Thread Matthew Weier O'Phinney
-- Tony Harrison <[EMAIL PROTECTED]> wrote
(on Monday, 30 July 2007, 05:22 PM +0100):
> Setting the display_errors directive using ini_set() is no good for fatal
> errors. You should change the ini file or set it from an apache config file.

Um, yes, it *will* display fatal errors, so long as it is called *prior*
to the fatal error occuring.


> Joó Ádám wrote:
> 
> It was already there, but I've qouted the value... :$
> Thank you, Matthew!
> 
> 
> Ádám
> 
> On 7/30/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
> 
> 
> Add this to your bootstrap:
> 
> error_reporting(E_ALL|E_STRICT);
> ini_set('display_errors', true);

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] Error messages again

2007-07-30 Thread Tony Harrison
Setting the display_errors directive using ini_set() is no good for
fatal errors. You should change the ini file or set it from an apache
config file.

Tony.

Joó Ádám wrote:
> It was already there, but I've qouted the value... :$
> Thank you, Matthew!
>
>
> Ádám
>
> On 7/30/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
>   
>> Add this to your bootstrap:
>>
>> error_reporting(E_ALL|E_STRICT);
>> ini_set('display_errors', true);
>> 
>> 
>>
>> Internal Virus Database is out-of-date.
>> Checked by AVG Free Edition. 
>> Version: 7.5.476 / Virus Database: 269.10.9/907 - Release Date: 18/07/2007 
>> 15:30
>> 



Re: [fw-general] Error messages again

2007-07-30 Thread Joó Ádám
It was already there, but I've qouted the value... :$
Thank you, Matthew!


Ádám

On 7/30/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
> Add this to your bootstrap:
>
> error_reporting(E_ALL|E_STRICT);
> ini_set('display_errors', true);


Re: [fw-general] Error messages again

2007-07-30 Thread Matthew Weier O'Phinney
-- Joó Ádám <[EMAIL PROTECTED]> wrote
(on Monday, 30 July 2007, 04:54 PM +0200):
> there was already some conversation about this. I just cannot see any
> error messages when I have a typo or other bug in my controllers.
> I have this in my bootstrap:

Add this to your bootstrap:

error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', true);


-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Error messages again

2007-07-30 Thread Joó Ádám
Hello,

there was already some conversation about this. I just cannot see any
error messages when I have a typo or other bug in my controllers.
I have this in my bootstrap:

$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory('./application/controllers');
$front->throwExceptions(true);
try {
$front->dispatch();
} catch (Exception $e)
{
echo 'Caught exception: ' . $e->getMessage();
}

As I can see exceptions are handled as expected but PHP errors vanish:
there's nothing just blank, white screen - development is really
frustrating this way :)
What should I do, to get those error messages?


Thanks,
Ádám


[fw-general] Question about View helper attribute support

2007-07-30 Thread KMiller

Any reason that only some of the helpers support the 'id' attribute and
others don't as in:

FormButton.php:   . ' id="' . $this->view->escape($id) .
'"';
FormCheckbox.php:   . ' id="' . $this->view->escape($id) .
'"'
FormFile.php:   . ' id="' . $this->view->escape($id) . '"'
FormImage.php:   . ' id="' . $this->view->escape($id) . '"'
FormPassword.php:   . ' id="' . $this->view->escape($id) .
'"'
FormReset.php:   . ' id="' . $this->view->escape($id) . '"';
FormSelect.php:   . ' id="' . $this->view->escape($id) . '"'
FormSubmit.php:   . ' id="' . $this->view->escape($id) . '"';
FormText.php:   . ' id="' . $this->view->escape($id) . '"'
FormTextarea.php:   . ' id="' . $this->view->escape($id) .
'"'

do support it while

 FormLabel.php*
 FormNote.php*
 FormRadio.php*

do not?

-km

-- 
View this message in context: 
http://www.nabble.com/Question-about-View-helper-attribute-support-tf4170670s16154.html#a11865079
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] unclear example of using of zend registry

2007-07-30 Thread Felix Jendrusch

http://framework.zend.com/manual/en/zend.controller.front.html#zend.controller.front.methods.primary
(7.3.2.4.):

Zend_Controller_Front::run($path) is a static method taking simply a path to
a directory containing controllers. It fetches a front controller instance
(via getInstance(), registers the path provided via
setControllerDirectory(), and finally dispatches.


I haven't tested it but it seems very logical that you can't access
registers in your controllers that are not defined before the dispatch
process is started. Define your registers before calling
Zend_Controller_Front::run($path) or take a closer look at how the front
controller works: http://framework.zend.com/manual/en/zend.controller.html
-- 
View this message in context: 
http://www.nabble.com/unclear-example-of-using-of-zend-registry-tf3425165s16154.html#a11863442
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] unclear example of using of zend registry

2007-07-30 Thread dinobrago



ZegeeDotCom wrote:
> 
> Can someone give me an example of how I use the zend registry. I upgraded
> to ZF 0.9 and my zend registry is not working.
> 

Did you ever get this working? I am running into the same problem w zf1.0.0
but it's not clear to me from the thread what actually worked in the end. 

Dean

-- 
View this message in context: 
http://www.nabble.com/unclear-example-of-using-of-zend-registry-tf3425165s16154.html#a11863123
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Date Active Directory formats

2007-07-30 Thread Teemu Välimäki
Hi

I'm quite sure Zend_Date does not support at least two AD date format. I'd be 
very glad if these would be supported. There's example code so it shouldn't 
be a problem to implement them.

LDAP Active Directory Last Logon (lastlogon).
http://php.net/manual/en/ref.ldap.php#61144

"accountexpires" attribute
http://fi2.php.net/manual/en/ref.ldap.php#57855

There might be others too but these are the ones I found using more often.

-- 
Teemu Valimaki


Re: [fw-general] form preperation

2007-07-30 Thread Tobias Gies
Using View Helpers. See
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial

2007/7/30, sachindoijad1 <[EMAIL PROTECTED]>:
>
>
> How to add the text box,buttons  using zend framework
> --
> View this message in context:
> http://www.nabble.com/form-preperation-tf4168911s16154.html#a11860577
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


[fw-general] What is the best approach for using Zend_Translate?

2007-07-30 Thread ashish.sharma

Hi ALL,

I am new to zend and still in learning process. Currently I am working on
Zend_Translate and would like to know the best approach to use the
Zend_Translate.


I am able to create .mo files and getting the translated content. Now, I
would like to know the best way of getting the translated text so that i can
use the same easily into my views.



Earlier I have created the Translate object into the controller and then
assign the translated value to a view variable to get it displayed. 

Code : 

$this->view->lang = $this_request->getParam('lang');

Zend_Loader::loadClass('Zend_Translate');   
$translationFilePath = '../languages/' . $this->view->lang .
'/LC_MESSAGES/source-' . $this->view->lang . '.mo';
$translate = new Zend_Translate('gettext', $translationFilePath);

$this->view->welcomeText = $translate->_('Welcome User');

But if I use the above code then I have to use the same code in each
controller for almost each view and this is what I don't want.

Then I have created a View helper having a function "translate", taking
messageString as an argument. This function loads the .mo files and return
the translated string. But I don't think that it is a good approach as it
loads the .mo file each time i call translate() function :confused:

Can anyone suggest the best approach of doing this task?

1. What if i load the .mo file in the bootstrap file and store it's object
into Registry to use it latter? Is it ok? Considering that I am having some
large data for translation.

Please suggest!

Ashish Sharma
-- 
View this message in context: 
http://www.nabble.com/What-is-the-best-approach-for-using-Zend_Translate--tf4168938s16154.html#a11860632
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] form preperation

2007-07-30 Thread sachindoijad1

How to add the text box,buttons  using zend framework
-- 
View this message in context: 
http://www.nabble.com/form-preperation-tf4168911s16154.html#a11860577
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Problem with ZF helper

2007-07-30 Thread minglee

Hi, guys.
I wrote a helper class (extends Zend_Controller_Action_Helper_Abstract), and
put it in 'wwwroot/zf/application/helpers/', named as MyHelper.
Then I add
'Zend_Controller_Action_HelperBroker::addPath('/zf/application/helpers/',
'MyHelper');'  in init() method of my controller class, 
and called the helper using '$this->_helper->MyHelper($help);', but error
occurred showing 'cannot find the helper'. 
I tried path './application/helpers/' also, but failed.
I think it's a path error but how should I set the path? Or should put My
Helper in the same folder as the default ? Or should put the helper
registration in bootstrap file?
Could anybody answer my question?!
Thanks!
-- 
View this message in context: 
http://www.nabble.com/Problem-with-ZF-helper-tf4168559s16154.html#a11859580
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Jabber proposal is ready for comments

2007-07-30 Thread Sergej

Sorry for such a long response time. I don't know if this make things happen
faster or no, but this morning I finaly managed to move my Zend_Jabber
proposal to the "Ready for Review" section. 

I am wery excited to hear your  reviews.
-- 
View this message in context: 
http://www.nabble.com/Zend_Jabber-proposal-is-ready-for-comments-tf4121333s16154.html#a11859470
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Zend_Search_Lucene performance issue

2007-07-30 Thread Daniel Freudenberger
Hi Alexander,

I'm not 100% sure that I didn't miss anything important but I'm quiet sure,
that the .NET result wasn't cached at all. I changed the query several times
and the response time was still between 0.001 and 0.005. Two days ago I
started the same benchmark with the original java lucene and had response
times way less than 0.01 too.

Best regards,
Daniel

-Original Message-
From: Alexander Veremyev [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 30, 2007 8:05 AM
To: Daniel Freudenberger
Cc: fw-general@lists.zend.com
Subject: Re: [fw-general] Zend_Search_Lucene performance issue

Hi Daniel,

Are you sure the testing method you use is correct?
Ex. are you sure .net version doesn't cache search result?


With best regards,
Alexander Veremyev.


Daniel Freudenberger wrote:
> -->
> 
> Hello,
> 
>  
> 
> I've started playing around with zend_search_lucene in the morning and at
> 
> first, I was very impressed. After that I've started to index all of the
> 
> relevant items that are stored in the database so far.
> 
>  
> 
> The index now contains 28069 documents and the find() method takes ~0.4
> 
> seconds to return for a very simple search expression. I've tested the
same
> 
> expression against the same index with the .net lucene port and the
request
> 
> took about 0.001 to 0.005 seconds. I know, I should not compare php with
any
> 
> .net language (in this case c#) but we're not talking about twice the
speed
> 
> or better, we're talking about the factor 100-400.
> 
>  
> 
> I just hope I did something wrong or missed an important point in manual
> 
> about performance. Here's the imporant part of my code.
> 
>  
> 
> $iterations = 100;
> 
> $index = new Zend_Search_Lucene('c:\index');
> 
> $userQuery = Zend_Search_Lucene_Search_QueryParser::parse('fifa');
> 
> $begin = microtime(true);
> 
> for($i = 0; $i < $iterations; ++$i) {
> 
>   $hits = $index->find($userQuery);
> 
> }
> 
> echo 'took: '.((microtime(true)-$begin)/$iterations).' seconds';
> 
>  
> 
> Best regards,
> 
> Daniel
> 
> 
> 
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.476 / Virus Database: 269.10.22/921 - Release Date:
26.07.2007 23:16