Re: [fw-general] Best practices for managing ZF2 modules and dependencies

2015-02-11 Thread Vincent Caggiari
Hello,

We tried exactly the same thing (same modules for different clients) but
things got so complicated to manage that we stopped to build websites this
way.
Why it became so complicated :

   - Same code base for different clients doesn't allow you to customize
   them so when a client has a specific use case/need, you can't do it (and
   don't tell me that you will create a new module for this client which will
   override the first one for the parts you need to customize because you will
   have 2 modules doing the same thing and when you will have to do some
   changes, you will not remember in which one to look).
   - You MUST have one repository per module, it's easier to manage and see
   what your developers are doing. If you need to update only one module (i.e
   patch), you can then update your project easily with only the change you
   need (so you don't pull changes made on another module which can introduce
   bugs for a specific client or some merging headache).


At this time, we have one repository per module. Each module for each
client is forked from our module core codebase so when a change is made
for a client and can be used by another (generic change), you update your
client module, then make a pull request to the module core codebase which
is then approved and incorporated.
Then, when you need to work on another client which use the same module,
you update your client's one by pulling the module core codebase, merge
the changes with the customized one, test and voila.

Regards,
CAGGIARI Vincent.


[fw-general] Re: [zf-contributors] New Unit Testing tutorial

2013-02-21 Thread Vincent BLANCHON
Hi all,

I think the doc is not up to date.
The second part of Bootstrapping your tests is useless, the application
bootstraping is make by Zend\Test\PHPUnit\AbstractControllerTestCase.

I write this doc on unit tests, but i think there is a bad merge ?

*

Vincent BLANCHON
Expert PHP  Zend Framework
Ausy pour Orange Portail

https://github.com/blanchonvincent
http://developpeur-zend-framework.fr
*


2013/2/21 Robert Basic robertbasic@gmail.com

 Hi all!

 I got a couple of questions about this week, so here it is for everyone:

 The Unit Testing sections from the User Guide aka Akrabat's Album
 tutorial have been moved to a completely new tutorial on unit testing:
 http://www.framework.zend.com/manual/2.1/en/tutorials/unittesting.html

 Hope it's better than the previous version, I did my best with it. You
 can see my original reasoning for this here:
 https://github.com/zendframework/zf2-documentation/issues/348

 And I would like to take this opportunity to bring attention to this
 issue on zf-web: https://github.com/zendframework/zf-web/issues/80 it
 took me a while to figure what is happening with the manual.

 And for those who don't know it, you can always reach the latest
 version of the documentation on http://zf2.readthedocs.org/en/latest/
 I believe it still is automatically updated after pushes to master.
 Someone will correct me if this is not the case any more.

 Have a nice day!

 --
 ~Robert Basic;
 http://robertbasic.com/



RE: [fw-general] [ZF2] Set default encoding to ISO in Zend Framework 2

2012-10-22 Thread Vincent de Lau
 - Database tables stay encoded using latin1
 - The new ZF2 functionality uses completely utf-8
 - Doctrine is initialized with utf-8:
 $entityManager-getEventManager()-addEventSubscriber(new
 \Doctrine\DBAL\Event\Listeners\MysqlSessionInit('utf8',
 'utf8_unicode_ci'));
 
 = the data, especially umlauts, seem to get correctly inserted and read
 from the database. Hopefully I can follow this approach not needing to
 write
 data mappers.

This should indeed be the proper approach. As long as the data in the tables
is encoded properly, MySQL can and will convert the data back and forth
depending on the session character set. I'm not sure how a UTF-8 to Latin1
mismatch will be handled though.

See also: http://dev.mysql.com/doc/refman/5.5/en/charset-connection.html

Regards,

Vincent de Lau
 vinc...@delau.nl


-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




RE: [fw-general] ZFApp?

2010-11-24 Thread Vincent de Lau
From your URL:

http://framework.zend.com/svn/framework/laboratory/Primitus/

Vincent de Lau
 vinc...@delau.nl

-Oorspronkelijk bericht-
Van: Mike A [mailto:mik...@hotmail.co.uk] 
Verzonden: woensdag 24 november 2010 17:29
Aan: fw-general@lists.zend.com
Onderwerp: [fw-general] ZFApp?

Saw this released today: 
http://docs.google.com/viewer?a=vq=cache:852AJoQlyHoJ:framework.zend.com/sv
n/framework/laboratory/Primitus/docs/ZFApp-preview-intro.ppt+zend+error+cont
roller+parametershl=enpid=blsrcid=ADGEESjwuKIVWrhgEs_SEFJB6F2poaLjt_l3H-o
8tnv1_AaaVeDzuo7J7gYJgz97onrp-GFiL7e019bJ1B6xbA7cEQroYLhsG9g7ieUS1BHkKq3iyOk
0glLsIVXej2utrq0wB83XrPT5sig=AHIEtbTIb9e9Adqg98X_nu8Qxrei7Cadqw

It seems to come from Zend labs but I do not see it listed in 
http://framework.zend.com/svn/framework/laboratory/.

Interesting stuff - is there more about it?

Mike A.



RE: [fw-general] How can I render a Zend_Barcode inside a html page?

2010-10-20 Thread Vincent de Lau
Van: Laurens van Vliet [mailto:laur...@herinneringenoplinnen.nl] 

 ...
  div
?php echo $this-action('barcode', 'label', null, array()); ?
  /div
 ...


This is probably not what you want... The action helper (labeled as evil)
includes the output of another action inside the view.

You would want somthing like

img src=?php echo $this-action(array('controller' = 'barcode', 'action'
= 'label', 'default'); ? alt=barcode /

Vincent de Lau
 vinc...@delau.nl



RE: [fw-general] Re: [zf-contributors] Poll: Should underscore prefixing of non-public elements be dropped?

2010-08-13 Thread Vincent de Lau
 -Oorspronkelijk bericht-
 Van: Matthew Weier O'Phinney [mailto:matt...@zend.com]
 Verzonden: vrijdag 13 augustus 2010 18:27
 Aan: fw-general@lists.zend.com; zf-contribut...@lists.zend.com
 Onderwerp: Re: [fw-general] Re: [zf-contributors] Poll: Should underscore
 prefixing of non-public elements be dropped?
 
 -- D. J. info...@gmail.com wrote
 (on Friday, 13 August 2010, 11:16 PM +0800):
  BTW, I would like to let you know that the vote link is blocked in my
  country in case you don't think votes from my country don't make
  difference.
 
 Can you try going to the canonical URL, then:
 
 
 https://spreadsheets.google.com/viewform?formkey=dEZOTGpMdjhzZDlmZGNMZVF0WnFTV
 2c6MQ
 
 If you cannot reach that, let me know.

Vote by mail ;)

Vincent



RE: [fw-general] Team Development

2010-08-11 Thread Vincent de Lau
 Van: Matthew Weier O'Phinney [mailto:matt...@zend.com]
 
  * On Zend Server on my ubuntu install, I had to do a few things to
enable FastCGI:
 
% cd /etc/apache2/mods-enabled
% sudo ln -s ../mods-available/fastcgi.load .
% sudo ln -s ../mods-available/fastcgi.conf .
% sudo ln -s ../mods-available/actions.load .
% sudo ln -s ../mods-available/actions.conf .

There is a Debian/Ubuntu tool for this, a2enmod (accompanied by a2dismod,
a2ensite and a2dissite)

% sudo a2enmod fastcgi
% sudo a2enmod actions
% sudo /etc/init.d/apache2 restart

It's quicker and more fool proof.

Vincent de Lau
 vinc...@delau.nl



RE: [fw-general] Help with development of high traffic application (replication / media management) with ZF

2010-07-20 Thread Vincent de Lau


 -Oorspronkelijk bericht-
 Van: robert mena [mailto:robert.m...@gmail.com]

 a) database

 Should I use regular databases?  In my case MySQL with the master -
 slave situation.  Or should I try Mongo/Cassandra because of the
 auto-sharding features?   This is something that I don't need right now
 but some sort future planning.

I don't have enough experience to advice on this, however: MySQL also
supports a cluster mode, NDB. It should work transparently but will spread
the storage and query workload across multiple nodes.

 b) content management
 
 in my app I have to upload files (images) besides text.  The text is
 stored in the database so If I stick with the database replication I'll
 be fine.  But how about the other files?  I think I need to control
 which files have been uploaded to the management node and if they were
 correctly replicated to all the client nodes.
 
 Since the database changes are small (in size) when compared with the
 media files I think that ideally I should wait until the files are
 replicated before the database is replicated (or at least that record).
 
 Is this reasonable?  Should I try to do this (or any other approach)
 from ZF or use another tool?
 
 For the replication of the files I am considering some sort of queue to
 generate a list of files and call rsync to do the actual transfer.

Do you need ZF when accessing the files or are they purely static? If they
are completely static, I'd consider creating separate nodes for static
content. Replication can be done using RSYNC, but maybe a network file
system might be useful. Redundancy might become a problem however.

Another solution might be to have a 404 handler that triggers an update
somehow. For some systems we use, files are stored in the database and
cached on the node on first access.


I hope these few cents are helpful.

Vincent de Lau
 vinc...@delau.nl



RE: [fw-general] Question about SQL (not ZF related, sorry)

2010-07-01 Thread Vincent de Lau
Hi Andrew,

Just jumping in, here is another approach:

SELECT P.product_id, P.product_name, P.price
FROM  
  products AS P
INNER JOIN  product_tags AS PT
ON  P.product_id = PT.product_id
INNER JOIN  tags AS T
ON  T.tag_id = PT.tag_id AND T.tag IN ( 'foo', 'bar', 'baz', 
'floob', 'widget' )
GROUP BYP.product_id
HAVING  COUNT(DISTINCT T.tag_id) = 5

Theoretically, this should result in a smaller temporary table, since moving 
the IN check to the join condition will limit the records stored in a temporary 
table. Also, assuming that product_id is a primary key, you should be save in 
grouping on just P.product_id.

Related to this, I recently had a curious issue. While rewriting a subquery 
into a join, performance dropped dramatically. My hypothesis was that the 
amount of columns MySQL had to store in the temporary table was so large, that 
creating a reduced set of columns with a subquery was actually beneficial.

Vincent de Lau
 vinc...@delau.nl



 -Oorspronkelijk bericht-
 Van: Andrew Ballard [mailto:aball...@gmail.com]
 Verzonden: donderdag 1 juli 2010 17:36
 Aan: Bill Karwin
 CC: fw-general@lists.zend.com
 Onderwerp: Re: [fw-general] Question about SQL (not ZF related, sorry)
 
 On Wed, Jun 30, 2010 at 4:46 PM, Bill Karwin b...@karwin.com wrote:
  Common wisdom says that one join is always better than three or six,
 but
  this actually performs much *worse* (if you use MySQL), because
 virtually
  any query using GROUP BY uses a temporary table, which kills
 performance
  because disk I/O is expensive, and temporary tables usually write to
 disk.
 
  This might not be such a bad solution if you use some other brand of
  database that optimizes GROUP BY better than MySQL.  So you should
 analyze
  queries with EXPLAIN (or equivalent) and profile carefully with
 sample data
  of realistic size.
 
  Regards,
  Bill Karwin
 
 
 Interesting. I'll defer to you on MySQL since you know it much better
 than I (and I don't have anything running on MySQL that I could test
 quickly right now anyway). Still, the idea left me somewhat curious,
 so I ran a test on one of our SQL Server databases to see how some
 different strategies compared.
 
 In the interest of disclosure, the actual tables I used (renamed in
 the examples below) are not very large as databases go. The products
 table has almost 54000 rows, the tags table has almost 350, and the
 product_tags table has about 132000 rows. (The nature of the real
 tables that I tested is that each row in the products table has at
 least one row in the product_tags table and only six distinct values
 from tags have been used so far in product_tags.)
 
 I compared three different query strategies (shown below). Of these,
 METHOD 1 had the lowest overall cost in resources, followed closely by
 METHOD 3 (although the total elapsed time for METHOD3 was slightly
 faster than that for METHOD 1). I did notice that METHOD 3 grew more
 expensive the more tags I included in the search since each tag
 requires additional self-joins.
 
 Given that the code for METHOD 1 was the least complex (and therefore
 the easiest to define using Zend_Db_Select, just to keep this somewhat
 on topic) and had the lowest cost and second lowest overall elapsed
 time, I would go that route on SQL Server. As I understand, you're
 saying this is not necessarily the case for MySQL.
 
 -- METHOD 1
 SELECT  P.product_id, P.product_name, P.price
 FROMproducts AS P
 INNER JOIN  product_tags AS PT
 ON  P.product_id = PT.product_id
 INNER JOIN  tags AS T
 ON  T.tag_id = PT.tag_id
 WHERE   T.tag IN ( 'foo', 'bar', 'baz', 'floob', 'widget' )
 GROUP BYP.product_id, P.product_name, P.price
 HAVING  COUNT(DISTINCT T.tag_id) = 5
 
 
 -- METHOD 2
 SELECT  products.product_id, products.product_name, products.price
 FROMproducts
 WHERE   EXISTS (
 SELECT  product_tags.product_id
 FROMproduct_tags
 INNER JOIN  tags
 ON  tags.tag_id = product_tags.tag_id
 WHERE   tags.tag IN ( 'foo', 'bar', 'baz',
 'floob', 'widget' )
   AND   product_tags.product_id =
 products.product_id
 GROUP BYproduct_tags.product_id
 HAVING  COUNT(*) = 5
 )
 
 
 -- METHOD 3
 SELECT  P.product_id, P.product_name, P.price
 FROMproducts AS P
 INNER JOIN  product_tags AS PT1
 ON  PT1.product_id = P.product_id
 INNER JOIN  tags AS T1
 ON  T1.tag_id = PT1.tag_id
 AND T1.tag = 'foo'
 INNER JOIN  product_tags AS PT2
 ON  PT2.product_id = P.product_id
 INNER JOIN  tags AS T2
 ON  T2.tag_id = PT2.tag_id
 AND T2.tag = 'bar'
 INNER JOIN  product_tags AS PT3
 ON  PT3.product_id = P.product_id
 INNER JOIN  tags

RE: [fw-general] .htaccess and Download Route Problem

2010-06-16 Thread Vincent de Lau
 
 You may try this:
 
 RewriteEngine on
 RewriteRule
 .*\.(js|ico|gif|jpg|jpeg|png|css|txt|rtf|pdf|doc|docx|xls|xlsx|ppt|pptx
 |mov|mpg|mp3|mp4|mpeg|avi|wmv|wmx|xml)$
 index.php
 
 If you want all non-existent file requests to be redirected to ZF, then
 use this:
 
 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule .* index.php

ZF command line tool creates this file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

What this does:

Turn on the rewrite engine.
If the requested file is a file (with size0) OR
If the requested file is a symlink OR
If the requested file is a directory
Rewrite to itself (no rewrite) and stop rewriting ([L] = last)
Rewrite all to index.php


Vincent de Lau
 vinc...@delau.nl



RE: [fw-general] Unable to load under models from subdirectories

2010-06-04 Thread Vincent de Lau
or infra - Infra

The models directory is being used as the base for Application_Model_, but
all files and folder after that should match casing with the classname.

Be aware that Application_Model_Mapper_ uses models/mappers as a base dir.
It cost me an hour to figure that one out...

Vincent de Lau
 vinc...@delau.nl

 -Oorspronkelijk bericht-
 Van: Paul [mailto:z...@zooluserver.com]
 Verzonden: vrijdag 4 juni 2010 16:04
 Aan: fw-general@lists.zend.com
 Onderwerp: Re: [fw-general] Unable to load under models from
 subdirectories
 
 Shouldn't the class be (captial T)
 
 Admin_Model_Infra_SomeThing.
 
 On 6/3/2010 6:30 PM, Mike Fuller wrote:
 
 
   Hi,
 
   Here's my situation
 
   I have files such as
 application/modules/admin/models/infra/SomeThing.php
 
   The class for SomeThing.php is Admin_Model_Infra_Something.
 
   I have an application/modules/Bootstrap.php file whose class is:
   Admin_Bootstrap extends Zend_Application_Module_Bootstrap
 
   In my controller I'll have $s = new
 Admin_Model_Infra_Something();
 
   On one server (PHP 5.2.5) everything works great. On another
 server (PHP
   5.2.9) I get Fatal error: Class 'Admin_Model_Infra_Something'
 not found .
 
   Obviously , to get a specific answer I would need to present a
 lot of
   information regarding the different environments. So for now I'm
 wondering
   if there are any common things to look at.
 
   Thanks a lot.
 




[fw-general] Issue with preg in Zend_Db_Statement

2010-03-31 Thread Vincent de Lau
Hi all,

With this mail I want to ask your attention for an issue in
Zend_Db_Statement (ZF-5063 [1]). The function _stripQuoted is used with
parameter substitution in statements. The current implementation is relying
on a regular expression that is not optimal to say the least. People
building their own queries might run into problems when their query becomes
large. In this case, the preg library will segfault and kill the Apache
worker. I've submitted a patch to reduce the chance of segfaulting by
reducing the number of items put on the stack. This issue is duplicated
twice already, probably because this is not a ZF nor a PHP issue, but a
libpreg issue. 

When I ran into the problem, I also noticed that the _stripQuoted function
is not complete and even broken. Databases that support multiple quoting
styles will fail to properly strip all instances. I've created an issue for
this (ZF-7911 [2]), together with a patch.

My problem is that I can't provide unit tests to prove my patches work and
that I don't know all the specifics of every DBMS.

I'd love to see someone spending some time on this issue, either by creating
test cases or providing feedback.

Thanks!

Vincent de Lau
 vinc...@delau.nl

[1] http://framework.zend.com/issues/browse/ZF-5063 (Segmentaion fault on
preg_replace in Zend_Db_Statement) 
[2] http://framework.zend.com/issues/browse/ZF-7911
(Zend_Db_Statement::_stripQuoted seems not to be complete)




RE: [fw-general] Re: PDO or Mysqli?

2010-02-24 Thread Vincent de Lau


 -Oorspronkelijk bericht-
 Van: ulf.wen...@sun.com [mailto:ulf.wen...@sun.com]
 Verzonden: woensdag 24 februari 2010 18:23
 
 That blog posting is puzzling me, if not to say, I believe it is
misleading.
 
 Hector Virgen schrieb:
  Not the most scientific analysis but this guy seems to get better
  performance out of PDO:
 
 Any of the PHP APIs are just tiny wrappers on top of the underlying C
 libraries. Mapping from the C call to a PHP call is always about about
 equally fast no matter how you do the mapping - in ext/mysql, ext/mysqli
 or PDO_MYSQL. If you compare equivalent PHP API calls with each other
 they should be very, very close together in performance.
 
 I assume the blog posting is comparing apples and oranges, likely
 without the blog author being aware of it. For example, PDO is using a
 prepared statement emulation by default for MySQL. It could well be that
 the blog posting compares a native prepared statement and a non-prepared
 statement. Or, the blog posting has been written in 2009, it could be
 that for PDO persistent connections had been used whereas for ext/mysqli
 non-persistent connections had been used.
 
 Moral is, forget about API performance. There's not much to squeeze out
 of how you map the very same underlying C library calls into PHP API
 calls. But it can help a lot to use proper API calls for the task.

One thing I think you should keep in mind with this, is that there is a
layer in between which is Zend_Db. Although the bare PHP speed might be
equal, it might well be that the PDO_MYSQL aligns better with the Zend_Db
architecture then ext/mysqli.

I would welcome a proper benchmark to test this. If the difference is as big
as in the article, it might be a good idea to repeat the test with a
profiler attached to see what causes the problem.

Vincent de Lau
 vinc...@delau.nl



RE: [fw-general] observe controller action

2009-12-02 Thread Vincent de Lau
Consume basically means 'one object using another object'.

Basically what it boils down to, is that you should move the code from the
controller to an object in the Model layer (a Service is suggested). Both
controllers can than consume/use this service to get their work done.

Controllers should be thin and use Models to do the work. I can suggest
reading http://www.survivethedeepend.com/ for more information on the
subject.

Vincent de Lau
 vinc...@delau.nl

 -Original Message-
 From: tonystamp [mailto:tonyst...@hotmail.co.uk]
 Sent: Wednesday, December 02, 2009 12:34 PM
 To: fw-general@lists.zend.com
 Subject: Re: [fw-general] observe controller action
 
 
 Thanks for the reply, but could you elaborate a bit more- what do you
 mean by consume?



Re: [fw-general] application.ini adaptation for php 5.3

2009-10-26 Thread Vincent Louvet

Hi,

Removing the 2 signs made the PHP errors disapear but the routes don't work
at all (they are just ignored which I think is normal bacause the regexp is
false then).
It is said that the INI support is improved in PHP 5.3, I just find it more
obscure.

Discouraged, I finally swapped from ini to xml and everything is working
fine again.

If someone is interested I can send key excerpts from the application.xml
(imho the doc shall be updated with more xml examples).

With best wishes,


V


weierophinney wrote:
 
 
 I see one problem here already. It may or may not affect usage, but
 remove the leading '^' and trailing '$' -- the router adds those for
 you. Let me know what happens when you do that. If it works, great, if
 not, we then have a test case for the 5.3 test cases.
 
 


-
Vincent
-- 
View this message in context: 
http://www.nabble.com/application.ini-adaptation-for-php-5.3-tp25993786p26063920.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] application.ini adaptation for php 5.3

2009-10-21 Thread Vincent Louvet

Hi,

I have a website running fine with php 5.2 (Sarge) and I'm trying to get
working copy on a pre production server which runs php 5.3 (CentOs).

After setting up the database and apache, uploading all the php scripts I
had to make a few changes in the application.ini as I was getting syntax
errors (typically replace the  by some ').

I also had to specify a few require_once for my custom classes (althrough
the library folder is in the include_path)

So I finally came up with a working website except for the pages using
routes.

This is how the routes are defined:

PHP 5.2 version (working):
resources.router.routes.news.type = Zend_Controller_Router_Route_Regex
resources.router.routes.news.abstract = true
resources.router.routes.news.route = ^news/(\d+)/(.*)\.html$
resources.router.routes.news.defaults.module = frontend
resources.router.routes.news.defaults.controller = news
resources.router.routes.news.defaults.action = read
resources.router.routes.news.map.news_id = 1

PHP 5.3 version (not working):
resources.router.routes.news.type = 'Zend_Controller_Router_Route_Regex'
resources.router.routes.news.abstract = true
resources.router.routes.news.route = '^news/(\d+)/(.*)\.html$'
resources.router.routes.news.defaults.module = 'frontend'
resources.router.routes.news.defaults.controller = 'news'
resources.router.routes.news.defaults.action = 'read'
resources.router.routes.news.map.news_id  = 1

I can't get it work and can't find any helpful document about my problem.

I'm not sure about all the changes needed when using php 5.3, could anyone
tell me more ?

Best wishes,


Vincent

-
Vincent
-- 
View this message in context: 
http://www.nabble.com/application.ini-adaptation-for-php-5.3-tp25993786p25993786.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] application.ini adaptation for php 5.3

2009-10-21 Thread Vincent Louvet

Dear Matthew,

Well, I'm not sure about anything.
After search on Internet about the error messages it seems to be an issue
with PHP 5.3 as other people had the same kind of problem (it may have
something to do with the ending $).

In my case, the pre production server uses PHP 5.3.0, Apache/2.2.3 (CentOS)
and mysql   5.1.39 the ZF version is the 1.9.4

This is what I get :

1 - Single quotes: 

resources.router.routes.news.route  = '^news/(\d+)/(.*)\.html$'

= no php error but for any reason the route doesn't work
---

2 - Double quotes:

resources.router.routes.news.route = ^news/(\d+)/(.*)\.html$

Fatal error:  Uncaught exception 'Zend_Config_Exception' with message
'syntax error, unexpected $end, expecting TC_DOLLAR_CURLY or
TC_QUOTED_STRING or 'quot;' in
/var/www/vhosts/domain.com/application/configs/application.ini on line 51
' in /var/www/vhosts/domain.com/library/Zend/Config/Ini.php:184
Stack trace:
#0 /var/www/vhosts/domain.com/library/Zend/Config/Ini.php(125):
Zend_Config_Ini-_loadIniFile('/var/www/vhosts...')
#1 /var/www/vhosts/domain.com/library/Zend/Application.php(375):
Zend_Config_Ini-__construct('/var/www/vhosts...', 'development')
#2 /var/www/vhosts/domain.com/library/Zend/Application.php(85):
Zend_Application-_loadConfig('/var/www/vhosts...')
#3 /var/www/vhosts/domain.com/httpdocs/index.php(30):
Zend_Application-gt;__construct('development', '/var/www/vhosts...')
#4 {main}
  thrown in /var/www/vhosts/domain.com/library/Zend/Config/Ini.php on line
184
---

3 - No quotes:

resources.router.routes.news.route = ^news/(\d+)/(.*)\.html$

Fatal error:  Uncaught exception 'Zend_Config_Exception' with message
'syntax error, unexpected '(' in
/var/www/vhosts/domain.com/application/configs/application.ini on line 51
' in /var/www/vhosts/domain.com/library/Zend/Config/Ini.php:184
Stack trace:
#0 /var/www/vhosts/domain.com/library/Zend/Config/Ini.php(125):
Zend_Config_Ini-gt;_loadIniFile('/var/www/vhosts...')
#1 /var/www/vhosts/domain.com/library/Zend/Application.php(375):
Zend_Config_Ini-__construct('/var/www/vhosts...', 'development')
#2 /var/www/vhosts/domain.com/library/Zend/Application.php(85):
Zend_Application-_loadConfig('/var/www/vhosts...')
#3 /var/www/vhosts/domain.com/httpdocs/index.php(30):
Zend_Application-__construct('development', '/var/www/vhosts...')
#4 {main}
  thrown in /var/www/vhosts/domain.com/library/Zend/Config/Ini.php on line
184
---

I'd be glad to know how to get rid of that problem otherwise I'll have to
remove the Route_Regex...

Best,






 After setting up the database and apache, uploading all the php scripts I
 had to make a few changes in the application.ini as I was getting syntax
 errors (typically replace the  by some ').
 
 Are you sure about this? Traditionally, the parse_ini_string|file
 functions have preferred double-quotes over single-quotes when parsing
 files for string values. If this is no longer the case, then it's a huge
 BC break in PHP 5.3, and I need to notify upstream.
 
 
 -- 
 Matthew Weier O'Phinney
 Project Lead| matt...@zend.com
 Zend Framework  | http://framework.zend.com/
 
 


-
Vincent
-- 
View this message in context: 
http://www.nabble.com/application.ini-adaptation-for-php-5.3-tp25993786p26001421.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Turn PHP errors/warnings/notices into exceptions

2009-09-24 Thread Vincent de Lau
 What i did was writing a function that simply throws an exception and
 passing that function to set_error_handler, something like this:
 
 error_reporting(E_ALL);
 function exceptionThrower($type, $errMsg, $errFile, $errLine) {
 throw new Exception($errMsg);
 }
 set_error_handler('exceptionThrower');

You should check out: http://php.net/ErrorException

It is an Exception type tailored to PHP's errors.

Vincent de Lau
 vinc...@delau.nl



RE: [fw-general] mod_rewrite and Zend Framework

2009-09-22 Thread Vincent de Lau
If it was using the rewritten URI, it would use be using index.php.

I think you should add a custom route or use:

RewriteRule ^/bar/echo  /foo/echo [N]

I'm not sure it would work though, you should try for yourself.
http://httpd.apache.org/docs/2.2/en/mod/mod_rewrite.html#rewriterule

Vincent de Lau
 vinc...@delau.nl

 -Original Message-
 From: howard chen [mailto:howac...@gmail.com]
 Sent: Tuesday, September 22, 2009 3:18 PM
 To: Zend Framework General
 Subject: [fw-general] mod_rewrite and Zend Framework
 
 Hello,
 
 I have a zend framework which has the following path:
 
 http://www.example.com/foo/echo
 
 
 
 But in the apache mod_rewrite, I want to rewrite something like
 
 http://www.example.com/bar/echo
 
 RewriteRule ^/bar/echo  /foo/echo
 
 ...
 other ZFW rewrite rule
 ...
 
 
 ZFW keep saying bar is not a valid controller.
 
 It seems that ZFW is using Apache REQUEST_URI for routing, not the
 rewritten uri, isn't?
 
 
 If yes, how to solve?
 
 Thanks.



[fw-general] Issues with Zend_Db_Statement::_stripQuoted

2009-09-22 Thread Vincent de Lau
Hi all,

Last week I ran into a couple of issues with
Zend_Db_Statement::_stripQuoted(). I've created an issue in the tracker:
http://framework.zend.com/issues/browse/ZF-7911 and mailed the problem to
the database list, but got no response yet.

The issues to address:
- a segfault within preg_match when a query with long (4KB+) values is run
- prior patch applied wrong, resulting in a possible issue with quoted
identifiers
- possible issue with RDBMS's that allow more than one quoting style. 

I'd like to complete a patch for this before the next release, but I need
some feedback on the issue.

Thanks,

Vincent de Lau
 vinc...@delau.nl




RE: [fw-general] Chain default route

2009-08-14 Thread Vincent de Lau
I think that the default route is a Zend_Controller_Router_Route_Module
route. It does some checking if a module exists. You use that as your
$plainPathRoute. I suppose you can leave the constructor for this route
empty.

 

Vincent de Lau

 vinc...@delau.nl

 

 

 

From: Sergio Rinaudo [mailto:kaiohken1...@hotmail.com] 
Sent: Friday, August 14, 2009 1:46 PM
To: sayusi.a...@gmail.com
Cc: fw-general@lists.zend.com
Subject: RE: [fw-general] Chain default route

 

Yes, 
I'll explain my problem better.
For my project I've created an hostname chained route, this one

  $hostnameRoute = new Zend_Controller_Router_Route_Hostname(
  ':myvar.mysite.com',
  array()
  );
  $plainPathRoute = new Zend_Controller_Router_Route(
':controller/:action/*',
array(
  'module'='default',
  'controller'='index',
  'action' = 'index'
)
  );
  $router-addRoute('myRoute', $hostnameRoute-chain($plainPathRoute));
  $front-setRouter($router);

That works pretty well when we talk about the default module, but if I want
to get my admin module, 
by request 'www.mysite.com/admin', I get an error that says there is no
controller 'Admin' ( in fact there is not, I have an admin module ).

Then I tried to comment the hostname route and I can get again inside the
admin module, so I think the problem is that 'www.mysite.com/admin' 
match the hostname route, and a good solution could be use the default
module route as $plainPathRoute.

Actually, I temporarily solved the problem creating another route, this one


  $hostnameRoute = new Zend_Controller_Router_Route_Hostname(
 ':myvar.mysite.com',
  array()
  );
  $plainPathRoute = new Zend_Controller_Router_Route(
'admin/:controller/:action/*',
array(
  'module'='admin',
  'controller'='index',
  'action' = 'index'
)
  );
  $router-addRoute('admin', $hostnameRoute-chain($plainPathRoute));

that matches the admin module requests.
Hope it is clear, advices are welcome :)


Sergio Rinaudo


 Date: Fri, 14 Aug 2009 13:29:01 +0200
 From: sayusi.a...@gmail.com
 To: kaiohken1...@hotmail.com
 CC: fw-general@lists.zend.com
 Subject: Re: [fw-general] Chain default route
 
 2009/8/14 Sergio Rinaudo kaiohken1...@hotmail.com:
  Hi,
  it is possible to do an hostname route chain with the default module
route?
  If yes, how?
  I want to do this in the bootstrap.
  Thanks
 
 May I ask what do you want exactly? With an example would be better.
 
 András
 
 -- 
 - -
 -- Csanyi Andras -- http://sayusi.hu -- Sayusi Ando
 -- Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell

  _  

Musica, Cinema, Sport, News... Accendi
http://messengertv.msn.com/mkt/it-it/default.htm  la Messenger TV!



RE: [fw-general] Zend Framework 2.0

2009-08-12 Thread Vincent de Lau
 Van: Ralf Eggert [mailto:r.egg...@travello.de]

 mi...@onshore.com schrieb am 11.08.2009 20:20:
  I think it would be great if we can take advantage of the
  functionality of PHP 5.3 in ZF 2.0.
 
 From my point of view, ZF 2.0 does not make any sense if it doesn't
 depend on the new features of PHP 5.3. If it really doesn't support PHP
 5.3 then we already need to think about ZF 3.0 already. Because
 supporting 5.3 will definitely break backwards compatibility. And this
 is only aloud in major releases. Correct me if I'm wrong.

I couldn't agree more. If there is still a huge demand for a pre 5.3 version
of Zend, I think we need to extend the lifetime of ZF 1.x, by allowing mini
and maybe minor releases to be made.

At our shop, we run into minor issues even when upgrading to a new minor
release. I'm not looking forward to refactor all of our custom extensions
etcetera twice within a small amount of time. I'd probably decide to skip
2.0 if it doesn't contain PHP 5.3 support.

Vincent de Lau
 vinc...@delau.nl






RE: [fw-general] Zend Framework 2.0

2009-08-09 Thread Vincent de Lau
I think it is saver to assume that 2.0 will break existing stuff. There are
some major changes planned, like renaming classes. I wouldn’t be surprised
if ZF 2.0 is PHP 5.3 only (namespaces).

 

There used to be a roadmap on the website (page still exists but doesn’t
seem to be linked to). Maybe it would be a good idea to reinstate this page
and add (preliminary) information about 2.0?

 

Vincent de Lau

 vinc...@delau.nl

 

 

From: Pádraic Brady [mailto:padraic.br...@yahoo.com] 
Sent: Sunday, August 09, 2009 3:53 PM
To: admirau
Cc: Zend Framework General
Subject: Re: [fw-general] Zend Framework 2.0

 

According to Matthew planning is underway. Backwards compatibility will be
retained, I'm sure, for many components but many others will break
compatibility since this is a major revision giving everyone the opportunity
to replace/fix components, APIs, and other behaviour.

 

Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation http://www.openideurope.eu/  Irish Representative

 

 

  _  

From: admirau admi...@gmail.com
To: fw-general@lists.zend.com
Sent: Sunday, August 9, 2009 2:48:03 PM
Subject: [fw-general] Zend Framework 2.0


Are there any known plans for ZF 2.0?
It will be an 'regular' release? Are planned any 'breaktrough' features
(e.g. application backend like in Symfony, ORM)?

I'm sure, it will be backwards compatilble,
but what can we expect?

I've found only this roadmap for Zend_Controller:
http://framework.zend.com/wiki/display/ZFDEV/Zend_Controller+2.0
-- 
View this message in context:
http://www.nabble.com/Zend-Framework-2.0-tp24887311p24887311.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Force full URL names

2009-03-20 Thread Vincent de Lau
I'm not sure if there isn't something in ZF that does this automatically,
but you could create a plug-in to check and redirect.

The plug-in would run after routing. You could use the assemble function on
the route to create the preferred link and check that against the requested
URL.

If they don't match, you could redirect to the assembled URL.

Kind regards, 

Vincent de Lau
 vinc...@delau.nl

 -Original Message-
 From: fozzyuw [mailto:jmbertu...@gmail.com]
 Sent: Friday, March 20, 2009 4:06 PM
 To: fw-general@lists.zend.com
 Subject: [fw-general] Force full URL names
 
 
 This seems like it would be simple enough, but I'm wondering if there's
 a way
 to force full URL's?
 
 If I have a M/C/A URL like this...
 
 /accounts/login/index
 
 then that's always shown or redirect too, even if someone types in
 /accounts/login.  Meaning if someone doesn't type out the whole URL,
 the
 site will auto-redirect to the proper full URL.
 
 So, I type /accounts/login/ and the site will auto-redirect to
 /accounts/login/index.  Or I type in /accounts and I'll be
 redirected to
 /accounts/index/index, assuming index is the default name.
 
 Cheers!
 Fozzy
 --
 View this message in context: http://www.nabble.com/Force-full-URL-
 names-tp22621762p22621762.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




RE: [fw-general] routeShutdown firing before action stack ...?

2009-03-14 Thread Vincent de Lau
I've had a similar discussion a couple of weeks ago with similar arguments
presented.

For our company I wanted to create a system where non-technical staff can
control how a website is composited. For that reason, I created a system
where navigation, ACL, URL's and pages (components/widgets and layout) are
all database driven.

The system now operates as follows:
- bootstrap loads ACL and site structure (navigation/pages) from database
(not directly, but through managers)
- a plugin is used that:
  - creates routes (routeStartup) using the structure manager
  - checks access to the requested page after routing
  - after (successful) dispatch of the 'main' component:
- selects the proper layout
- fills some placeholders with data from the database (title tag, meta
stuff)
- loads all other components (allowed by the ACL) using
Zend_View_Helper_Action and puts the content in the layout

The database stores parameters to pass into the components and resource
names for each component. Management of the whole system is now web based.

I've noticed the perfomance hit on using Zend_View_Helper_Action, but don't
know what a better approach would be. When asked, the only answer I get is:
Use view helpers! but without further explanation or any argument aside
from the performance hit. What I described above seems to me to be to
large/complex for what a view helper is intended to. Sure, parts of this
system could be done in helpers, but controlling what goes on a page?

If performance is the major issue, that might weigh up against the
flexibility of such a system. It would be just a design choice and effort
should be taken to improve the dispatcher or create a lighter dispatcher for
'secondary' content. 

Thanks for reading this anyway!

Kind regards,

Vincent de Lau
 vinc...@delau.nl



 -Original Message-
 From: keith Pope [mailto:mute.p...@googlemail.com]
 Sent: Saturday, March 14, 2009 11:31 AM
 To: Dan Ballance
 Cc: fw-general@lists.zend.com
 Subject: Re: [fw-general] routeShutdown firing before action stack ...?
 
 You may want to read this blog
 
 http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-
 evil/
 
 and the performance guide in the manual, generally it is suggested to
 use the placeholder view helper which gives you control over placement
 or your own view helper.
 
 Hope that helps :)
 
 2009/3/14 Dan Ballance tzewang.do...@googlemail.com:
  Hi folks,
 
  I am trying to build a flexible 'widgetised' layout where the data
 for which
  blocks go in which segments is held in the database.
 
  My current logic is to:
 
  read layout from the database and then load action stack with a
  controller/action for each block
  in my front controller plugin, on routeStartup, 'open bookend' each
 segment
  with required markup
  loop through the blocks found in the database and write each block
 output to
  the correct segment with action stack
  in my front controller plugin, on routeShutdown, 'close bookend' each
  segment with necessary markup.
  layout is finally renderred from the segments (top, left, default,
 right,
  bottom) - where default is the output from the original
 controller/action
  combo in the url
 
  The block data in the database tells me not just which
 controller/action
  combo, but also the segment to write to. This is passed to action
 stack as a
  param.
 
  I have created my own action controller which gets the segment param
 which
  was passed to action stack and sets the segment to write the block to
 in
  pre-dispatch.
 
  It's working reasonably well - except the end result is, for example
 with
  the top segment:
 
  opening bookend, closing bookend, block 1, block 2, block 3
 
  What I want is:
 
  opening bookend, block 1, block 2, block 3, closing bookend
 
  I realise I haven't posted code yet ( can do that next, but didn't
 want to
  post a huge message). At this stage i'm wondering if anyone can see a
 flaw
  in my logic, am I misunderstanding the dispatch sequence?
 
  Any help / clues VERY gratefully received - i'm stuck!
 
  cheers,
 
  dan
 
 
 
 
 
 
 --
 --
 [MuTe]
 --



RE: [fw-general] routeShutdown firing before action stack ...?

2009-03-14 Thread Vincent de Lau
 -Original Message-
 From: Matthew Weier O'Phinney [mailto:matt...@zend.com]
 Sent: Saturday, March 14, 2009 3:30 PM
 
 -- Vincent de Lau vinc...@delau.nl wrote
 (on Saturday, 14 March 2009, 12:52 PM +0100):

 The mantra of use view helpers stems from the fact that in MVC, views
 are allowed to communicate with models in order to fetch content to
 render. The goal, then, is to move all your business logic into models,
 and then write view helpers that access these models (and, optionally,
 format the information for rendering).

First of all, thank you for your answer, I think it clarifies a lot. Maybe
this and parts of the article mentioned earlier should be made into a white
paper or BCP document?

Also, thanks for your patience. I might sound a bit like somebody who just
doesn't want to get it, but I think it is far from that. I want to produce
quality code and systems and I want to learn (and know I have to). I also
want to build something that does what I require. 

 As an example, consider this view helper:
 
 class My_View_Helper_RecentEntries extends
 Zend_View_Helper_Abstract
 {
 public $entryTemplate = 'lia href=%s%s/a/li';
 
 public function recentEntries()
 {
 $model = $this-view-entriesModel;
 $recent = $model-fetchRecent();

snip
 
 In this case, we're pulling from a model we've injected into the view,
 and then creating an unordered list which we return. In your view
 script, you then simply echo the results:
 
 ?php echo $this-recentEnties() ?

And that is where the catch is in my case. I don't want a viewscript to
decide what content to display; I want that to be dynamic. How do I get my
models in the view when I don't know beforehand what helpers are going to be
called and what model access they need? I would argue that that is a
controller task, but you lose that part when using sole helpers.

Part of the problem could be handled by adding a view helper that calls
other helpers (the dynamic part) and passes parameters to them, but I
suppose that doesn't solve the problem of which model to access.

I also find it a problem that for large parts of my system, I would not be
using view scripts for output, making such components harder to reuse. The
current controllers that I'm building, can be used on other sites without
modification. I only need to change my view scripts if required. Some
controllers even made it into our library, leaving only an empty extending
class in the application. (For instance: class ErrorController extends
My_Error_ActionController {} )

 and that's it. This tactic provides better encapsulation, provides
 behavior that is easily testable, and is much more performant as there
 is no need to lookup the controller and dispatch it.
 
 Your suggestion that if performance is an issue with action(), effort
 might go into improving the dispatcher or creating a lightweight
 version
 makes sense in theory... but to do so actually exposes an important
 point: modifying how the dispatch sequence works would actually
 potentially break action().

 Ironically, the method of using view helpers instead of action() makes
 it *easier* to replace elements of Zend_Controller with your own
 implementations, as you no longer need to worry that changing the
 implementation will break the functionality.

I totally understand your point and would never suggest to alter the
behavior of the current dispatcher or action(). I specifically mentioned
'secondary' content because it might warrant a far less complex way of
'dispatching'. Wrapping all my earlier comments and experience up, I can see
a helper that can load other 'helpers' or 'mini-controllers'. Those
'helpers' might even use view scripts to control their output.

However, I could also understand that this would part to far from the
(traditional) MVC pattern. That would however get me thinking if MVC is
really the way to do this type of web applications.

Anyway, I would love more input and opinions on the subject.

Kind regards,

Vincent de Lau
 vinc...@delau.nl




RE: [fw-general] how to write such route

2009-03-06 Thread Vincent de Lau
You could use a regular expression route, a custom route or you could a
route that just catches /manage.

 

Vincent de Lau

 vinc...@delau.nl

 

From: Jacky Chen [mailto:jacky...@gmail.com] 
Sent: Friday, March 06, 2009 5:30 PM
To: fw-general@lists.zend.com
Subject: [fw-general] how to write such route

 

hi guys,

 

i want to add a router that match any characters but not match the word
manage,for example,it would match /home , /news , /blog , but /manage
should not be matched. how to write such a route? thanks.

 

Greetings,

Jacky



RE: [fw-general] Validating a person's name with Zend Validate

2009-01-08 Thread Vincent de Lau
If you really want to accept international visitors, be very careful what
you do with names... My family name for instance is 'de Lau'.  The 'de' part
in the Netherlands is called a 'tussenvoegsel'.[1] It is considered part of
the family name.

 

I would suggest that if a visitor entered any upppercase character in their
input, they probably did a better job than you would be doing and you better
leave it alone. Exception might be ALL UPPERCASE input or even cAPS LOCK.

 

Kind regards,

 

Vincent de Lau

 vinc...@delau.nl

 

[1] http://en.wikipedia.org/wiki/Tussenvoegsel

 

From: guice...@gmail.com [mailto:guice...@gmail.com] On Behalf Of Philip G
Sent: Thursday, January 08, 2009 12:20 AM
To: Michael Tramontano
Cc: Jake McGraw; fw-general
Subject: Re: [fw-general] Validating a person's name with Zend Validate

 

On Wed, Jan 7, 2009 at 3:57 PM, Michael Tramontano
mtramont...@efashionsolutions.com wrote:

Well if you're using ucwords() or ucfirst() for the o'reilly issue, perhaps
you should just uppercase the first letter and ignore the other characters.
That way you get Beth AND O'Reilly.

 

 

McCain. ;)

 

---
Philip
g...@gpcentre.net
http://www.gpcentre.net/



RE: [fw-general] Project Structure / Public directory

2009-01-06 Thread Vincent de Lau
It seems to me as a lot of overhead. I created a structure like:

 

/application/

/library/

/index.php

/ .htaccess

/(all other files that would otherwise go in /public/)

 

The .htaccess file disables access to /application/ and /library/ and
redirects nonexistent URL’s to index.php. Paths in index.php are modified to
find /application/ and /library/.

 

I could see a justification for your solution, when you want your
application to be able to be installed the recommended way.

 

Kind regards,

 

Vincent de Lau

 mailto:vinc...@delau.nl

 http://vincent.delau.nl

 

 

 

From: Luiz A Brandao Jr [mailto:fromv...@gmail.com] 
Sent: Tuesday, January 06, 2009 7:08 PM
To: Pádraic Brady
Cc: Alan Wagstaff; Zend Framework General
Subject: Re: [fw-general] Project Structure / Public directory

 

My problem is like you previously described. When using plesk one usually
can't access files outside the httpdocs folder due to open_basedir
configuration. So I have to put all application files in the web directory.
So if I have a guestbook application I would put all files inside
httpdocs/guestbook and follow the standard directory structure from there,
what means that I will have httpdocs/guestbook/public,
httpdocs/guestbook/application etc

Then with the following .htaccess I would check if a request match a file in
the public folder and allow it, otherwise rewrite to index.php Just to
exemplify: if a request like http://mysite/guestbook/images/someimage.jpg
match a image in httpdocs/guestbook/public/images/someimage.jpg it will
rewrite to that image, if not, it will rewrite to index.php

The only difference is that that index.php stays outside of the public
foder. But I'm sure this can be changed with additional rewrite rules. I
think this way we can follow the default folder structure even inside the
web root folder and organize multiple applications into their own folders.
What do you think of this aproach? Do you think the .htaccess can be
improved?


RewriteEngine On
RewriteBase /myapp

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteCond %{DOCUMENT_ROOT}/myapp/public/$1 -s [OR]
RewriteCond %{DOCUMENT_ROOT}/myapp/public/$1 -l [OR]
RewriteCond %{DOCUMENT_ROOT}/myapp/public/$1 -d
RewriteRule ^(.*)$ public/$1 [NC,L]

RewriteRule ^.*$ index.php [NC,L]

On Mon, Jan 5, 2009 at 9:43 PM, Pádraic Brady padraic.br...@yahoo.com
wrote:

One possible solution is setting a .htaccess file for the other root
directories setting the deny from all directive to forbid access.

 

Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation http://www.openideurope.eu/  Irish Representative

 

 

  _  

From: Alan Wagstaff awagst...@gmail.com
To: Zend Framework General fw-general@lists.zend.com
Sent: Monday, January 5, 2009 10:44:37 PM


Subject: [fw-general] Project Structure / Public directory


Hi all,

 

In most of the ZF tutorials I have read (ZF Quickstart, Rob's one, ZF Book),
they all recommend setting your Apache's webroot to your /zfapp/public/
directory for security reasons.

 

I can understand the logic, putting the application / library directory
outside of the webroot is a good thing but I'm thinking ahead to
distribution and struggling to understand.  Take for example, vBulletin - a
popular forum software.  When you download vBulletin, you unzip it, grab the
/forum directory and dump it in your webroot.  Then visit
http://www.example.com/forum and there's your forum.  You could also put it
in /community/forum and it would work just as well.

 

I don't really understand how I could do that with ZF using the recommend
project structure.  How would I go about setting up my project structure /
.htaccess so the end user could put my app in whatever sub-folder they
wanted on their website, and not just in the webroot?

 

Thanks in advance :)

 

Alan.

 

 



RE: [fw-general] Project Structure / Public directory

2009-01-05 Thread Vincent de Lau
The only 'framework' file in public in you index.php which loads your
bootstrap. You could move it up a level and adjust the include paths
accordingly. 

 

I've done this as well, since I'm running some sites on Plesk systems where
we don't have write access to the level containing the webroot.

 

Vincent de Lau

 vinc...@delau.nl

 

 

From: Alan Wagstaff [mailto:awagst...@gmail.com] 
Sent: Monday, January 05, 2009 11:45 PM
To: Zend Framework General
Subject: [fw-general] Project Structure / Public directory

 

Hi all,

 

In most of the ZF tutorials I have read (ZF Quickstart, Rob's one, ZF Book),
they all recommend setting your Apache's webroot to your /zfapp/public/
directory for security reasons.

 

I can understand the logic, putting the application / library directory
outside of the webroot is a good thing but I'm thinking ahead to
distribution and struggling to understand.  Take for example, vBulletin - a
popular forum software.  When you download vBulletin, you unzip it, grab the
/forum directory and dump it in your webroot.  Then visit
http://www.example.com/forum and there's your forum.  You could also put it
in /community/forum and it would work just as well.

 

I don't really understand how I could do that with ZF using the recommend
project structure.  How would I go about setting up my project structure /
.htaccess so the end user could put my app in whatever sub-folder they
wanted on their website, and not just in the webroot?

 

Thanks in advance :)

 

Alan.

 



RE: [fw-general] Zend Framework 1.7.2 is now available!

2008-12-23 Thread Vincent de Lau
Some days rest might be in place, releasing 1.7.1 again... ;)

I suppose the message was announcing 1.7.2 as the subject suggests.

Vincent de Lau
 vinc...@delau.nl

 -Original Message-
 From: Josh Team [mailto:josht...@gmail.com]
 Sent: Tuesday, December 23, 2008 8:46 PM
 To: Wil Sinclair
 Cc: fw-general@lists.zend.com; fw-annou...@lists.zend.com
 Subject: Re: [fw-general] Zend Framework 1.7.2 is now available!
 
 Wil!
 
 What are you doing releasing stuff?! Go enjoy the holidays! :)
 
 I'm sure I speak for the entire community when we thank you and
 everyone else at zend for their hard work!
 
 Thanks,
 Josh Team
 
 On Tue, Dec 23, 2008 at 1:45 PM, Wil Sinclair w...@zend.com wrote:
  Hi all,
 
  It is my pleasure to announce the release of Zend Framework 1.7.1!
 You
  can download this new mini release from the ZF download site:
 
  http://framework.zend.com/download/latest/
 
  A list of all issues resolved in this release can be found at:
 
 
 http://framework.zend.com/issues/secure/views/IssueNavigator.jspa?reque
 s
  tId=10923
 
  We'd like to once again thank our generous Zend Framework
 contributors
  for all the effort they have put in to this release and the project
 as a
  whole. Enjoy!
 
  ,Wil
 



[fw-general] Zend_Form

2008-10-29 Thread Vincent - D. Ertner
Hi,

on which mailing list are Zend_Form issues discussed?

-- 
Cheers,\\|//
Vince  (o o)
ooO-(_)-Ooo-
 '''   (o)_(o)[ ][0][ ]
 ô¿ô   (=°o°=)   World Domination by Copy and Paste   [ ][ ][0]
  -()_()[0][0][0]

 ()  ascii ribbon campaign - against html e-mail
 /\  www.asciiribbon.org   - against proprietary attachments
   Ooo.
---.ooO(  )-
   (  )(_/
\_)


[fw-general] Thoughts about Zend_Workflow

2008-09-02 Thread Vincent de Lau

Hi all,

For a custom bug/issue/task tracker I was thinking about how to manage
workflow. After some thinking I came to the solution to create a custom
workflow engines based on state machines. Below is a summary of what I'm
thinking about:

The main concepts are Object, State and Action. Objects have a State.
Actions can change the State of an object. Rules determine which Actions are
available for an Object in a certain state. Rules can also be subject
to an ACL.

The Statemanager is responsible for managing rules and state changes for a
certain object. After initializing the Statemanager with the Object and
Rules, an Action can be performed resulting in a state change.

A more advanced version of the Statemanager could also dispatch Actions
automatically. When there is only one possible Action and that Action
doesn't require interaction, it could be performed. A similar concept might
be a Trigger. Trigger are fired after a state change. Triggers don't have
impact on the State of an Object.

Further integration with the Zend Framework is possible. Actions that
require user interaction should be able to communicate with Zend Controller.
A special Workflow Controller could provide a kind of scaffolding access to
the Statemanager. Another field of integration is on the Object side of
things. Integration with models is almost a must. Integration with
Zend_Db_Table, ActiveRecord and other automated model paterns would make
sense.

Does this sound a good plan to make a proposal? Anybody has a major issue to
address before starting a proposal?

Kind regards,

Vincent de Lau
 [EMAIL PROTECTED]
-- 
View this message in context: 
http://www.nabble.com/Thoughts-about-Zend_Workflow-tp19279619p19279619.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] IP calculations

2008-07-31 Thread Vincent de Lau
 -Original Message-
 From: Bill Karwin [mailto:[EMAIL PROTECTED]

 I would guess that most people who need to do range matching, subnets,
etc.
 simply convert an IP address string to its packed binary equivalent, and
 then use PHP bitwise operators.  No need to have an OO interface for
 something this simple.

Why not? As everything with ZF: You don't have to use it. Having a 'wrapper'
makes this stuff more accessible.

Last night I also thought of IPv6. I suppose similar calculations and
formatting stuff might be necessary and they are more complex than IPv4.
Wrapping this and maybe some other stuff (MAC, IPX) into
Zend_Network_Adressing might be useful.

Vincent de Lau
 [EMAIL PROTECTED]



RE: [fw-general] capture STDERR with Zend_Log

2008-07-30 Thread Vincent de Lau
I've created a custom error handler for this. See http://
php.net/set_error_handler and http://php.net/set_exception_handler

Also note the stuff about @ error suppression, which is used in Zend_Loader

if (error_reporting() == 0) return; at the start of the error handler should
do the trick.

Vincent de Lau
 [EMAIL PROTECTED] 

 -Original Message-
 From: sgrobins [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 30, 2008 8:38 PM
 To: fw-general@lists.zend.com
 Subject: [fw-general] capture STDERR with Zend_Log
 
 
 Hello,
 
 I am using Zend_Log for all my output in a script that is run from
 cron.
 Everything works great.  I have it writing to a log file each night.
 
 The problem is if the script encounters a Fatal Error or a PHP Warning,
 those are not put into the log file, since that output didn't go
 through
 Zend_Log.  Is there a way to redirect the STDERR to my Zend_Log object,
 so
 it becomes something like this:
 
 $logger-err( whatever php error produced );
 
 Then each day I can look at my log file and see exactly where these php
 warnings or errors are happening in my script.
 
 Thanks,
 Shawn
 --
 View this message in context: http://www.nabble.com/capture-STDERR-
 with-Zend_Log-tp18739880p18739880.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




RE: [fw-general] capture STDERR with Zend_Log

2008-07-30 Thread Vincent de Lau

 -Original Message-
 From: Vincent de Lau [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 30, 2008 8:49 PM
 To: fw-general@lists.zend.com
 Subject: RE: [fw-general] capture STDERR with Zend_Log
 
 I've created a custom error handler for this. See http://
 php.net/set_error_handler and http://php.net/set_exception_handler

And here it is. Sorry for the lack off documentation, but it shouldn't be
that hard.

Usage: Zend_Error_Handler::register();
 
Vincent de Lau
 [EMAIL PROTECTED]


?php
class Zend_Error_Handler {

/** cannot create a Zend_Error_Handler object, static functions only */
private function __construct() {}

public static function register() {
 
set_exception_handler(array('Zend_Error_Handler','exceptionHandler'));
set_error_handler(array('Zend_Error_Handler','errorHandler'));
}

public static function errorHandler( $errno, $errstr, $errfile,
$errline, $errcontext ) {
// this is to bypass @ error suppression
if (error_reporting() == 0) return;

switch($errno) {
case E_ERROR:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_USER_ERROR:
case E_PARSE:
case E_RECOVERABLE_ERROR:
Zend_Registry::get('log')-err(An error occured in
{$errfile} (line: {$errline}): [{$errno}] {$errstr});
echo pAn error occured in {$errfile} (line: {$errline}):
[{$errno}] {$errstr}/phr /\n;
echo preBacktrace:\n;
debug_print_backtrace();
echo /prehr /preContext:\n;
var_dump($errcontext);
echo /pre;
die();
break;
case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_WARNING:
Zend_Registry::get('log')-warn(An error occured in
{$errfile} (line: {$errline}): [{$errno}] {$errstr});
if(Zend_Registry::get('debug')  error_reporting() != 0) {
echo \n!-- Warning: {$errfile} ({$errline}): {$errstr}
--;
}
break;
case E_NOTICE:
case E_USER_NOTICE:
case E_STRICT:
default:
Zend_Registry::get('log')-notice(An error occured in
{$errfile} (line: {$errline}): [{$errno}] {$errstr});
if(Zend_Registry::get('debug')  error_reporting() != 0) {
echo \n!-- Notice: {$errfile} ({$errline}): {$errstr}
--;
}
break;
}
}
public static function exceptionHandler( $exception ){
Zend_Registry::get('log')-err(An error occured in
{$exception-getFile()} (line: {$exception-getCode()}):
[{$exception-getCode()}] {$exception-getMessage()});
echo pAn error occured in {$exception-getFile()} (line:
{$exception-getCode()}): [{$exception-getCode()}]
{$exception-getMessage()}/phr /\n;
echo preBacktrace:\n;
echo $exception-getTraceAsString();
echo /prehr /preException:\n;
var_dump($exception);
echo /pre;
die();
}
}



RE: [fw-general] The how-to / what to do upgrading 1.5.2 to 1.6.0

2008-07-24 Thread Vincent de Lau
The new Zend_View stream wrapper might have something to do with this, although 
I'm not sure it is included in 1.6RC1. 

See 
http://www.nabble.com/Zend_View-and-the-View-Stream-Wrapper-tc17607130ef15440.html#a17607130

Vincent de Lau
 [EMAIL PROTECTED]


 -Original Message-
 From: Bruno Friedmann [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 24, 2008 11:18 AM
 To: fw-general@lists.zend.com
 Subject: Re: [fw-general] The how-to / what to do upgrading 1.5.2 to
 1.6.0
 
 Bruno Friedmann wrote:
  till wrote:
  On Thu, Jul 24, 2008 at 4:31 AM, Bruno Friedmann [EMAIL PROTECTED]
 wrote:
  Hi all,
 
  I'm just downloaded the 1.6 RC1 release to give it a try.
 
  I've just one trouble : no projects are running now.
  The worst there's no errors just a blank page.
  (All demo previously used have the same symptom )
 
  I could imagine there's some changes, but there's no documentation
 about what a dev
  need to adapt inside projects to have them running.
 
  Or did I miss it ( there's could be a improvement like a update.txt
 file at the root of library ) ?
 
 
  PS : In documentation there chapter missing in the index ( 18
 doesn't have title GDATA, 23 is not write and so ... )
 
  You probably want to enable:
  log_errors = On
  error_log = /path/to/a/writable/log/file
 
  Or maybe it is already enabled and you just need to check it out. To
  find out, do a phpinfo() and look for the above options.
 
  Till
 
  wouah ...
  As I've declare
  error_reporting(E_ALL  E_STRICT);
  ini_set('display_startup_errors', 1);
  ini_set('display_errors', 1);
  in my bootstrap I has forgotten to see my php_error.log ...
 
  What I've found sound strange to me ... sorry
  never see this before ... :-)
 
  [error] [client 127.0.0.1] ALERT - Include filename
 
 ('zend.view:///home/bruno/workspace/socketfinder/sf/application/modules
 /default/views/scripts/index/index.phtml') is an URL that
  is not allowed (attacker '127.0.0.1', file '/ioda/data/web-
 include/ZF/library/Zend/View.php', line 105)
 
 
 
 Ok found this is when suoshin module is loaded ...
 What strange is that with 1.5.2 ZF there's no trouble ...
 
 Can someone confirm ...
 
 --
 
  Bruno Friedmann
 
 Ioda-Net Sàrl   - www.ioda-net.ch
   2830 Vellerat - Switzerland
 
   Tél : ++41 32 435 7171
   Fax : ++41 32 435 7172
   gsm : ++41 78 802 6760
 
 C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com




Re: [fw-general] descriptive urls using zend

2008-06-24 Thread Vincent de Lau

Quoting uppaluri [EMAIL PROTECTED]:


how do I get the url to look like this ?
mydomain.com/controllername/sports/golf-balls

I am not very good with zend, but can find my way given a starting point.



Look in the manual for Zend_Controller_Router [1]. Basically the  
/:controller/:action/* is the default route, but you van define an  
alternate route like /:controller/:param1/:param2.


I hope this gets you underway.

Kind regards,

Vincent de Lau
 [EMAIL PROTECTED]



[1] http://framework.zend.com/manual/en/zend.controller.router.html


This message was sent using IMP, the Internet Messaging Program.



Re: [fw-general] Default Decorators ----- disable

2008-06-12 Thread Vincent
On 6/12/08, Rohit83 [EMAIL PROTECTED] wrote:


 Hi ,
 For some specific reason i want default decorators should be disabled and i
 should able to render form elements in html that i have written.I tried for
 that but getting the dd and dt tags so applying css will be difficult
 for me,Any Help on this!!!
 Regards
 Rohit


See Matthew's article:
http://devzone.zend.com/article/3450-Decorators-with-Zend_Form

-- 
Vincent


Re: [fw-general] Any thoughts about Zend View Filters for Zend layout?

2008-06-11 Thread Vincent
On 6/11/08, patrick veach [EMAIL PROTECTED] wrote:

 Hola!

 Since we are routing output through the response object, it makes zend view
 filters feasible.
 The idea is to attach a filter(s) to a named segment of the response object
 and then, when the
 response object renders to the view, it first runs the contents of the
 named segments through a filter.
 or possibly a filter chain on its way to the view object.

 $view-myFilter('response_segment');

 or maybe filters could be set by  a viewHelper:

 $view--setFilter('response_segment', 'filter_name');

 It may be possible to do this without changing the response object
 by using a view helper to set the filters and  plugins to render the named
 segments.
 Or, perhaps a more integrated method may be used.  We already have
 /views/filters directory.

 Anybody have thoughts on this issue?


So... You first add some stuff to the view to filter it out later on? Why
not make sure it doesn't end up there immediately?

Adios.

 *quetzequatl*




-- 
Vincent


Re: [fw-general] Any thoughts about Zend View Filters for Zend layout?

2008-06-11 Thread Vincent
On Wed, Jun 11, 2008 at 4:49 PM, patrick veach [EMAIL PROTECTED]
wrote:

 Ciao Vincent,

 I was using the word filter somewhat loosely. An example would be GIMP blur
 filters.  They take an input image, modify it and pass it back, not merely
 filter out It might also function as a decorator.

 The response object is a choke point,  almost every thing passes through
 the response object on its way to the layout, making it a good place to put
 a filter.

 The idea is to modify 'filter/decorate based on the named response
 segment rather than the content i.e. where its going rather than what it is.
 Also, we already have a filters directory in our modular directory layout
 but alas, no  filters.


Hmm, what would be an example use case?




 ciao,

 *quetz*
 .





-- 
Vincent


Re: [fw-general] Re: ZF reference guide or how to use a single component

2008-06-10 Thread Vincent
On 6/10/08, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote:

 -- Robin Skoglund [EMAIL PROTECTED] wrote
 (on Tuesday, 10 June 2008, 03:57 PM +0200):

  On Tue, Jun 10, 2008 at 3:37 PM, Matthew Weier O'Phinney 
 [EMAIL PROTECTED]
  wrote:
  -- Thomas Weidner [EMAIL PROTECTED] wrote
  (on Tuesday, 10 June 2008, 03:25 PM +0200):
   I just added a new reference table to the documentation where
 people can
   see which ZF component depends on which other ZF component.
 
  Where is this? Do you have it built anywhere?
 
   So if anyone is in need of just one component like Zend_Log he can
 just
   look into this table and see which other components he has also to
   provide that all works properly.
 
  Does this take into consideration optional dependencies? For
 instance,
  Zend_Db can be used _without_ Zend_Config, but can also consume it.
 
 
  Isn't that a requirement nonetheless? At some point there is a check like
 'if
  ($config instance of Zend_Config)', which means the class requires
 Zend_Config
  to do the check.


 Actually, in recent PHP versions (I'm not sure when it started exactly;
 somebody will chime in, I'm sure), the class does not need to be loaded
 for instanceof checks to succeed, so this is still a soft dependency.


http://nl2.php.net/instanceof

There are a few pitfalls to be aware of. Before PHP version 5.1.0, *
 instanceof* would call 
 __autoload()http://nl2.php.net/manual/en/language.oop5.autoload.phpif the 
 class name did not exist. In addition, if the class was not loaded, a
 fatal error would occur. This can be worked around by using a *dynamic
 class reference*, or a string variable containing the class name:



:)

-- 
Vincent


[fw-general] Adding styles to labels using Zend_Form

2008-06-09 Thread Vincent
Hi,

I want to hide a form element using inline CSS. Now, I can add a style
attribute to the input element, but is it also possible to manipulate
attributes in the Label decorator? (Either in the label or the surrounding
dt)

Thanks,

-- 
Vincent


RE: [fw-general] About the css issue

2008-06-05 Thread Vincent de Lau
 Using / implies that you are looking for a resource off the root of
 your domain. If your site lives in a subdirectory of your doc root,
 you'll run into some problems.
 In order to ensure cross site/installation compatibility, you may want
 to look into using a simple View Helper to get the base URL of your
 site
 for resource links, href's, etc.

Another good practice to work around this issue, it to set a base-tag, maybe
even using the following line in your layout/template:

base href=?php echo(Zend_Controller_Front::getInstance()-getBaseUrl());
? /

There should be only one base-tag in a document, and it should be in head.

Regards,

Vincent de Lau
 [EMAIL PROTECTED]




Re: [fw-general] Best practice for validation

2008-06-05 Thread Vincent
On 6/5/08, Josh Team [EMAIL PROTECTED] wrote:

 Matthew,I googled, Jani H Zend Framework Blog to no avail. Do you have a
 link to his blog(s)?


See
http://codeutopia.net/blog/2008/06/02/autogenerating-forms-from-doctrine-models/and
http://codeutopia.net/blog/2008/06/04/zend_forms-from-doctrine-models-part-2/

Thanks,
 Josh Team


-- 
Vincent


[fw-general] Best caching strategy?

2008-06-04 Thread Vincent
Hi,

In my application, there are several modules that cache several different
things. I don't have much experience with caching (can you overdo caching?),
so I was wondering what the best caching strategy was. Currently, most
modules use the same cache directory using different prefixes. Is it perhaps
better to create separate cache directories for separate modules or should I
leave it as is?

Thanks,
-- 
Vincent


Re: [fw-general] Using FlashMessenger to display a message when there was an error processing a form

2008-06-03 Thread Vincent
On 6/3/08, Bart McLeod [EMAIL PROTECTED] wrote:

 If you submit the form and validate it, your post data will still be in the
 form, while the page has been refreshed (there has been a round trip to the
 server upon form submission).

 I did never use flashmessenger, but I do not see why it would not display
 its message when the user submits the form and thus refreshes the page?


FlashMessenger stores the message in the session. When I said refresh, I
didn't mean the page request when the form is submitted, but another request
*after* the form has been processed ;-)

Bart


-- 
Vincent


Re: [fw-general] Re: Using FlashMessenger to display a message when there was an error processing a form

2008-06-03 Thread Vincent
On 6/3/08, Jake McGraw [EMAIL PROTECTED] wrote:

  My goal with this helper was to be able to leverage a similar interface
 to FlashMessenger
  for a generic message storage that would persist messages across
 redirects
  _and_ make them available if a redirect did _not_ occur.


 This is a solution we came up with at company, I'd highly suggest
 people take this route.


And that's what I'm going for now that I now of getCurrentMessages().
Shouldn't require too much editing, so thanks for the help everybody!

- jake




-- 
Vincent


Re: [fw-general] Using FlashMessenger to display a message when there was an error processing a form

2008-06-03 Thread Vincent
On 6/3/08, Jeffrey Sambells [EMAIL PROTECTED] wrote:

 Wouldn't it be better to provide a method to retrieve the messages
 regardless of which page load it is in so that the flashMessanger could be
 the generic message container for either case?


Exactly!

However, while I've read through the source in the past, I don't know why
I've never noticed getCurrentMessages(). That should solve my problem for
now, thanks!

For example, if I do:

 $this-_flashMessenger-addMessage('My Message');
 $messages = $this-_flashMessenger-getMessages();

 I would assume that $message should contain 'My Message' since I just added
 it in the previous line, but it doesn't. The addMessage() method stores the
 message in the session, while getMessage() retrieves from the $_message
 property of the object. The $_message property is populated only from the
 previous request but not updated when new messages are added.

 In some cases the part of the application that needs to indicate a message
 won't know yet if the page will re-direct or not at the end so it seems
 silly to use two different models for the basically the same purpose
 (message storage). Could the flashMessanger provide a getAllMessages()
 method that would remove like messages from the session if they're retrieved
 on the same call so you get all message without repeating them in the next
 request?

 I guess this could be accomplished by manually merging getMessages() and
 getCurrentMessages() but then you have to manually clear the current
 messages too which is something else to remember. It would be nice to have
 something like this in the FlashMessenger:

 function getAllMessages( $clear = true ) {
$all = array_merge( $this-getMessages(),
 $this-getCurrentMessages() );
if ( true === $clear) {
$this-clearMessages();
}
return $all;
 }

 - Jeff




-- 
Vincent


Re: [fw-general] Using FlashMessenger to display a message when there was an error processing a form

2008-06-03 Thread Vincent
On 6/3/08, Jake McGraw [EMAIL PROTECTED] wrote:

 FlashMessenger is meant for displaying messages only after receiving a
 second request, like a redirect:


Is there a specific reason for this? Are there any plans to implement
displaying messages in the same request or is it unwise for me subclass the
FlashMessenger for this?

FIRST REQUEST
 Client to Server - POST form values
 Server - Process form values
 Server - Form values will cause a redirect, record all messages
 FlashMessenger
 Server to Client - Send redirect

 SECOND REQUEST
 Client to Server - GET redirect page
 Server - Check FlashMessenger queue for messages
 Server to Client - Print out messages

 In order to solve your problem, record messages to an internal message
 queue (say an array on Zend_Registry) when you aren't redirecting,
 otherwise use FlashMessenger.


 - jake




-- 
Vincent


Re: [fw-general] Form Validator: Empty Element Error Message Customization

2008-05-22 Thread Vincent
On 5/22/08, Pádraic Brady [EMAIL PROTECTED] wrote:

 snip
 By the way I agree - the default messages are horrendous and border on bad
 English. If I were not English speaking I'd suspect they were
 incomprehensible. There is a lot to be said for having defaults that are as
 simple and plain spoken as possible using natural English.

 Take Zend_Validate_Alpha. If an empty string is input you get the error
 message:
 '%value%' is an empty string

 That's brilliant. The user now knows they input an empty string. We even
 print the empty string, just to clarify that the space between the single
 quotes is indeedzero. When I saw this the first time I spent a few
 mintues trying to figure out if the joke was on me ;). What we haven't
 clarified is that it's not allowed to be an empty string. There's a subtle
 difference - one is a statement of fact, the other is advising of a
 problem.
 The single quotes may even be confusing by themselves.

 I ended up going off topic on this one ;). Maybe I'll tackle the default
 messages again as something for ZF 2.0 to consider.


Let alone the fact that, if I didn't do any scripting, as a non-native
speaker I wouldn't know what a string is... :)

Paddy



-- 
Vincent


Re: [fw-general] ZF and Ohloh

2008-05-20 Thread Vincent
On Mon, May 19, 2008 at 3:09 PM, Simone Carletti [EMAIL PROTECTED] wrote:

 Hi Wil,
 I have been using Ohloh since one year and I have to say it's a really
 amazing project.


I've been using it since 26 Feb according to Ohloh, I think I only really
got into it a little bit later but when I did, one of the first thing I did
was stack ZF ;-)


 They also expose a RESTful API.
 If I'm right there's a ZF component proposal for a Ohloh client somewhere
 in the wiki page.


Apparently a placeholder that's been removed:
http://framework.zend.com/wiki/pages/viewpage.action?pageId=42444

Such a component would be very welcome to me, though ;-)




 Simone


 On Mon, May 19, 2008 at 2:54 AM, Wil Sinclair [EMAIL PROTECTED] wrote:

 Hi all, I took a look at Ohloh (http://www.ohloh.net/) this weekend for
 the first time. It's a relatively interesting tool to track open source
 projects, and I find it particular useful for tracking relationships
 among them. Zend Framework's Ohloh project can be found here:
 http://www.ohloh.net/projects/zend_framework. Two reasons I mention
 this:

 1) I would be nice to see all our users and contributors associated with
 the Zend Framework project on Ohloh.

 2) It would be *particularly* nice to see all projects that use Zend
 Framework associated with the project on Ohloh.

 ,Wil





-- 
Vincent


Re: [fw-general] Controller actions/ distinguishing between GETs and POSTs

2008-05-18 Thread Vincent
On 5/18/08, Stephan Stapel [EMAIL PROTECTED] wrote:

 Hi!

 this is probably a simple question but unfortunately I couldn't find the
 answer in the docs.

 I'd like to use a different handling within my action methods for POST and
 GET requests to implement PRG behaviour. Is there an easy way to find out
 'how' the action method was invoked (e.g. through the _request member
 variable?).

 Currently, I distinguish like this:

 function myAction()
 {
   if (sizeof($_POST)  0)
   {
   }
   else
   {
   }
 }

 but this is really ugly since a POST might occur that doesn't send any
 variables for some reason. If you have a could hint how to achieve this,
 it'd be great to read it :)

 regs,

 Stephan


I use $this-_request-isPost() and $this-_request-isGet(), see
http://framework.zend.com/manual/en/zend.controller.request.html#zend.controller.request.http.method

-- 
Vincent


Re: [fw-general] Help with Zend_View

2008-05-18 Thread Vincent
On Sun, May 18, 2008 at 6:11 PM, Steven [EMAIL PROTECTED] wrote:

 Doing so means that I'll have to call render() in every action, instead of
 just letting ZF catch it automatically right?  Currently, I only have a
 single action that needs to call a different template, so that's not an
 ideal solution.


How about $this-_helper-viewRenderer-setScriptAction()?
http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelper.viewrenderer.api

-- 
Vincent


Re: [fw-general] noob problem - ZF works on localhost but not on webserver

2008-05-16 Thread Vincent
On 5/16/08, vladimirn [EMAIL PROTECTED] wrote:


 Hello Jacob, thank you :)
 I will try to explain.
 I have admin part of site. In administration i added new functionality-
 adding new banners.
 I made a BannerController.php(controller), Banner.php(model), and following
 the example of guy who made whole application i made admin-index.phtml and
 admin-update.phtml in scripts/banner folder.
 When you click on link i made in administration- Manage index banner, on my
 localhost i am getting a page with form for new banner. And it is working.

 Also there is an index,phtml page where i am calling
 ?=$this-getActiveBanner()? at some point. And this works fine too on my
 localhost.

 But when i upload all on live site, clicking on Manage index banner not
 showing new form, but redirecting out of administration page, and display
 Error 500: Internal server error, please try again  ... or some. :)
 If no ideas so far, i can post my methods, so you can take a look into it.
 I am most confusing about that its work on localhost and same files doesn't
 work on live server :)


Has it worked before on the live server? If not, are you sure the rewrite
rules are correct?

Second question is:
 I used existing file which have very similar functionality. It displays
 data
 from other mysql table, but same methods are used. So i just copied
 existing
 files, and made a new one.
 Eg. file Popular.php and PopularController.php i renamed to Banner.php and
 BannerController.php, and changed protected _name='popular' to
 _name='banners'.
 Also changed some html code and when click on Manage index banner i was
 getting error: No cuch metod updateBanner. Code for that was:
 if($this-Banner-update()).. and then did: require_once('Banner.php');
 if(Banner::update()) and then works :)


Sorry, I can't follow this. Where are you calling updateBanner?

So i am so confused and dont have any clues about all this :)
 Thank you one more time,
 Vladimir




Cheers,

-- 
Vincent


Re: [fw-general] noob problem - ZF works on localhost but not on webserver

2008-05-16 Thread Vincent
On 5/16/08, vladimirn [EMAIL PROTECTED] wrote:


 Hello Vincent :)
 Web site is live and working on web server.
 if($this-Banner-update()) is called in BannerController.php
 (currently on webserver is: require_once('Banner.php');
 if(Banner::update()))


But you said PHP said:

no such method updateBanner


updateBanner() is a different method than update().

.htaccess is identical on localhost and web server. I got it from web server
 when got this project. And it is working on my localhost.

 also i noticed that when i am calling method like: $this-update('some sql
 statement') - which is in original file(popular.php - model) i remake for
 banners, i am getting error 500. If i use $this-db-update('some sql
 statement') it works fine.


Sorry, I don't use Zend_Db so I can't help you here...

Is there a possibility that problem is caused by version of FW? i am not
 sure what version i have on my computer. It could be ZF1.5, but not sure
 and
 dont know how to check. On web server i think that this is ZF 1.01.


Using different versions of ZF will very likely cause differences in
behaviour, best to develop using the same version. The version can be
checked by opening the file Zend/Version.php, the VERSION contant contains
the version number.

Also, there is a folder inside every subfolder on web site which is called
 .svn. I dont know what is this for. :)


The .svn folders are metadata for Subversion, a Version Control System.
Apparently this website is managed using Subversion, so it's a little bit
odd that you're not using it yourself.

Sorry if i am bothering with my problem, just i dont know from where to
 start to solve it .

 @Jacob- i already read acrabat and all tutorial from acrabat web site, but
 couldnt figure it out.. :(




 Vincent-20 wrote:
 
  On 5/16/08, vladimirn [EMAIL PROTECTED] wrote:
 
 
  Hello Jacob, thank you :)
  I will try to explain.
  I have admin part of site. In administration i added new functionality-
  adding new banners.
  I made a BannerController.php(controller), Banner.php(model), and
  following
  the example of guy who made whole application i made admin-index.phtml
  and
  admin-update.phtml in scripts/banner folder.
  When you click on link i made in administration- Manage index banner, on
  my
  localhost i am getting a page with form for new banner. And it is
  working.
 
  Also there is an index,phtml page where i am calling
  ?=$this-getActiveBanner()? at some point. And this works fine too on
  my
  localhost.
 
  But when i upload all on live site, clicking on Manage index banner not
  showing new form, but redirecting out of administration page, and
 display
  Error 500: Internal server error, please try again  ... or some. :)
  If no ideas so far, i can post my methods, so you can take a look into
  it.
  I am most confusing about that its work on localhost and same files
  doesn't
  work on live server :)
 
 
  Has it worked before on the live server? If not, are you sure the rewrite
  rules are correct?
 
  Second question is:
  I used existing file which have very similar functionality. It displays
  data
  from other mysql table, but same methods are used. So i just copied
  existing
  files, and made a new one.
  Eg. file Popular.php and PopularController.php i renamed to Banner.php
  and
  BannerController.php, and changed protected _name='popular' to
  _name='banners'.
  Also changed some html code and when click on Manage index banner i was
  getting error: No cuch metod updateBanner. Code for that was:
  if($this-Banner-update()).. and then did: require_once('Banner.php');
  if(Banner::update()) and then works :)
 
 
  Sorry, I can't follow this. Where are you calling updateBanner?
 
  So i am so confused and dont have any clues about all this :)
  Thank you one more time,
  Vladimir
 
 
 
 
  Cheers,
 
  --
  Vincent
 
 


 --
 View this message in context:
 http://www.nabble.com/noob-problem---ZF-works-on-localhost-but-not-on-webserver-tp17272058p17272949.html

 Sent from the Zend Framework mailing list archive at Nabble.com.




-- 
Vincent


Re: [fw-general] noob problem - ZF works on localhost but not on webserver

2008-05-16 Thread Vincent
On 5/16/08, vladimirn [EMAIL PROTECTED] wrote:


 I misstyped what php said :) actually PHP said that method does not exist,

 and i know that method exist. But when i include file Banner.php which

 contain that method, and change in code from $this-Banner-update to
 Banner::update() then works fine.

 Original file(which i remake to make banner part) works fine with

 $this-Popular-update()...
 Also after changes i made, i moved completly folder structure from my
 localhost back to web, changing only database data in config.php and

 everything working but banners :)

 I like zend framework and what ZF offer, but it is so confusing sometimes
 :)
 I am not using SVn cause i cant figure it out how to use it. I read on svn
 web site but still dont get it. And it was already on web site i got to
 adjust.
 Thank you very much for your reply :)



So what does get_class($this-Banner) say?

-- 
Vincent


Re: [fw-general] Route with variable parameters

2008-05-16 Thread Vincent
On Fri, May 16, 2008 at 2:58 PM, Cristian Bichis [EMAIL PROTECTED]
wrote:




 I have some problems:
 1. How can i write the route to allow a potential unlimited number of
 parameters


 IIRC this would be /:text/:page/:lang/*

 Thanks,

 What kind of Route is this ? Regex or Static ?


Just the standard Zend_Controller_Router_Route, see
http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.standard

Route definition can contain one more special character - a wildcard -
 represented by '*' symbol. It is used to gather parameters similarly to the
 default Module route (var = value pairs defined in the URI). The following
 route more-or-less mimics the Module route behavior:


 ?php
 $route = new Zend_Controller_Router_Route(
 ':module/:controller/:action/*',
 array('module' = 'default')
 );
 $router-addRoute('default', $route);



 Cristian




-- 
Vincent


Re: [fw-general] noob problem - ZF works on localhost but not on webserver

2008-05-16 Thread Vincent
On Fri, May 16, 2008 at 5:21 PM, vladimirn [EMAIL PROTECTED] wrote:


 BannersController.php - my version of existing method
 [code]
 public function adminIndexAction()
{
if (!$this-is_admin()) $this-_redirect(/admin/login);

$this-view-status_list = array('1' = 'online', '0'= 'offline');
$this-view-data = Banners::getBanners();


$this-view-messages = $this-_flashMessenger-getMessages();
}

 [/code]
  if i use  $this-view-data = $this-Banners-getBanners(); i am getting:
 Fatal error: Call to a member function getBanners() on a non-object in
 C:\wamp\www\dev\application\controllers\BannersController.php on line 30


So $this-Banners is not an object. Perhaps in the PopularController's
init() method $this-Populars is defined? You'll probably need to do
something similar in the BannersController, i.e. $this-Banners = new
Banners().



 This works just fine on $this-Populars-getPopulars

 Existing method i got from Populars.php
 [code]
  public function adminIndexAction()
{
if (!$this-is_admin()) $this-_redirect(/admin/login);

$this-view-status_list = array('1' = 'online', '0'= 'offline');
$this-view-data = $this-Populars-getPopulars(false);
$this-view-messages = $this-_flashMessenger-getMessages();
}
 [/code]

 This is how i remake original method

 public function getBanners()
{  $where = null;
if ($online_only) $where = 'status = 1';

$rowset = $this-db-fetchAll('select * from banners');
if (is_null($rowset)) return array();
$idx = 0;
foreach ($rowset as $row){
$ar_res[$idx]['Banners'] = $row;
$idx++;
}

return $ar_res;
 }

 Original method was:

 public function getPopulars($online_only = true)
{
$where = null;
if ($online_only) $where = 'status = 1';

$rowset = $this-fetchAll($where, $this-getOrder());
if (is_null($rowset)) return array();
$idx = 0;
foreach ($rowset as $row){
$ar_res[$idx]['Populars'] = $row-toArray();
$idx++;
}

return $ar_res;
}
 On my local mashine:
 When i am using original method, i am redirected to public area of site and
 getting this:
 Internal server error
 Error
 An error occurred, please try again later.

 if i am using first method i rewrote, everything is working on local
 machine, but not on the live site.


Could you post your .htaccess?




 Vincent-20 wrote:
 
  On 5/16/08, vladimirn [EMAIL PROTECTED] wrote:
 
 
  I misstyped what php said :) actually PHP said that method does not
  exist,
 
  and i know that method exist. But when i include file Banner.php which
 
  contain that method, and change in code from $this-Banner-update to
  Banner::update() then works fine.
 
  Original file(which i remake to make banner part) works fine with
 
  $this-Popular-update()...
  Also after changes i made, i moved completly folder structure from my
  localhost back to web, changing only database data in config.php and
 
  everything working but banners :)
 
  I like zend framework and what ZF offer, but it is so confusing
 sometimes
  :)
  I am not using SVn cause i cant figure it out how to use it. I read on
  svn
  web site but still dont get it. And it was already on web site i got to
  adjust.
  Thank you very much for your reply :)
 
 
 
  So what does get_class($this-Banner) say?
 
  --
  Vincent
 
 

 --
 View this message in context:
 http://www.nabble.com/noob-problem---ZF-works-on-localhost-but-not-on-webserver-tp17272058p17277324.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




-- 
Vincent


Re: [fw-general] noob problem - ZF works on localhost but not on webserver

2008-05-16 Thread Vincent
On Fri, May 16, 2008 at 6:08 PM, vladimirn [EMAIL PROTECTED] wrote:


 this is what i tought :)
 but BannersController and PopularController have same methods. This is
 init()
 public function init()
{
parent::init();

require_once 'Zend/Filter.php';

// load filters
require_once 'Zend/Filter/StripTags.php';
 //require_once 'Zend/Filter/HtmlEntities.php';
require_once 'lib/Zend/Filter/StripSlashes.php';

$this-filters = new Zend_Filter();
 //$this-filters-addFilter(new Zend_Filter_StripTags())
 //-addFilter(new Zend_Filter_HtmlEntities())
$this-filters-addFilter(new Zend_Filter_StripSlashes());
 }


So where does the PopularController define $this-Populars? And what does
var_dump($this-Banners) in BannerController say?
-- 
Vincent


Re: [fw-general] MVC - where can I learn more about the model?

2008-05-13 Thread Vincent
On 5/13/08, Rishi Daryanani [EMAIL PROTECTED] wrote:

 Hi,
 I'm a total newbie, but I am reading up on the Zend
 framework and trying out some tutorials, very useful..
 However everything I've read/tried involves the
 application/views and application/controllers
 directories to create views and controllers. I have
 not yet come across any mention of the models
 subdirectory.

 Where can I learn more about this and what it's used
 for?

 Am I right in assuming that I can build my own
 functionality (e.g. user login form, CMS) entirely
 with the concept of a controller and view? (but not a
 model)


The model is just a representation of data, which more often than not means
a class with which you retrieve data from the database, i.e. take a look at
Zend_Db.

Many thanks






-- 
Vincent


Re: [fw-general] Amateur question re: Zend_Layout (sans MVC)

2008-05-05 Thread Vincent
On 5/5/08, David Di Biase [EMAIL PROTECTED] wrote:

 Hi Eric,

 As a matter of fact right after e-mailing my last response, I figured it
 out. It now seems easy enough and I've gone ahead and implemented a VERY
 basic MVC model yet not fully-fledged ZF MVC. I setup a bootstrap and am
 currently funneling requests to scripts, then breaking off the code (on my
 own) into separate actions and OO classes. I feel very comfortable with this
 and am quite happy with the direction.

 It was just that initial hump of understanding what was going on with the
 view and layout class that got be stumped, but it's coming along nicely. I'm
 actually quite excited with what I've come up with - it's *extremely*
 flexible now that I've got it setup properly.

 I would like to add however that I find an almost paradoxical notion in
 ZF. It's claimed that the parts can be split-off and re-used in any way to
 remain flexible, but in reality what I found in my initial testing/learning
 phase was that people just kept telling me that proper MVC was easier. The
 paradox is that there are claims that they can be used as standalone but
 ultimately you are driven to just using MVC - which for developers who are
 trying to take baby-steps into DRYing up their current sites, requires a
 complete re-code - which seems unavoidable. Basically it seems very biased
 towards MVC; perhaps a natural or even intended effect!

 Either way now I'm on a roll but before. I think the community would be
 better served by producing a manual for standalone use of each module. This
 would increase the frameworks use by allowing people to become familiar with
 the modules on their current projects (which are most likely NOT MVC).
 Basically, I'm hoping to push for better support for standalone use - that's
 all.

 David
 :-)


Basically, I think the idea is that it is recommended to use the ZF MVC, but
the advanced developers that explicitly want their own setup can do so.
Besides, the loose coupling means that a project can very easily just use
Zend_Search_Lucene, for example. So if you're going to use the whole
framework, it's recommended to use the ZF MVC unless you *really* do not
want to, while if you're interested in a particular component, it is
possible to use just that (e.g. if you prefer CodeIgniter or whatever).

Cheers,

-- 
Vincent


Re: [fw-general] Amateur question re: Zend_Layout (sans MVC)

2008-05-05 Thread Vincent
On 5/5/08, David Di Biase [EMAIL PROTECTED] wrote:

 Thanks for that clarification. I see what you both mean. I apologise if I
 think I sound like I know what I'm talking about - I did admit I'm merely an
 amateur. Nor have I studied computer science (just a hobbyist with his own
 ... dynamic PHP websites).


Well, perhaps I should add that I'm still in high school, so don't just take
what I say for granted either :)
(Yes, I should add that disclaimer more often...)

-- 
Vincent


[fw-general] Should I use Zend_OpenId's URL manipulation methods?

2008-05-05 Thread Vincent
Hi,

I want the absolute URL to the current website, however, the getBaseUrl()
method of the request object returns a relative URL. So, I've found that
Zend_OpenId, among other useful methods, includes the absoluteUrl() method.

However, of course Zend_OpenId isn't meant as a URL manipulation class.
Thus, my question is: what would be considered best practice in this case?

Thanks,
-- 
Vincent


Re: [fw-general] instantiate an object with a variable name for the class

2008-04-25 Thread Vincent
On 4/25/08, Aldemar Bernal [EMAIL PROTECTED] wrote:

 Hi Denis,

 I understand what you are trying to do, unfortunely get_class(self) will
 not work if self is an extended class (as Zend_Db tables are), the only
 workaround (until 5.3 is out where will be possible to do this) is to create
 a method, this is how I do it:

 create an interface

 interface My_Interface
 {
   public static function init();
 }

 then create your class

 class My_Class extends Zend_Db_Table implements My_Interface
 {
   ...

   public static function init()
   {
   return new self;
   }
 }

 then, when you need the class you must use $myClass::init() instead of new
 $myclass

 Hope it helps,


Ah, thank you, that was indeed the issue I had before and which I confused
with this one.

Aldemar




-- 
Vincent


Re: [fw-general] instantiate an object with a variable name for the class

2008-04-24 Thread Vincent
On 4/24/08, Denis Fohl [EMAIL PROTECTED] wrote:

 Hi all,

 sorry i forgot the subject in my previous post :

 i'm trying to implement a class to manage manytomany relationships in
 backoffice, i'd like to standardize it for reusability.
 I would like to pass to the constructor of my class the name of the tables
 involved (destination table, origin table, intersection table) and that it
 instantiate correspondings Zend_Db_Table objects.

 So now is the question : how can i instantiate an object (Zend_Db_Table
 here) with a variable classname :

 function __construct ($originTable, $destinationTable) {

$table1 = new $originTable();
...

 }

 i can't find what i want on google (tried call_user_func but that's not
 it).


This sounds similar to something I've been trying to do a while ago. After
reading a *lot* about this, I found out this was not possible before PHP
5.3. I'm not sure exactly where I found that, but a good starting point
would be the comments on http://nl3.php.net/get-class .

Thanks.

 Denis.


Best of luck,

-- 
Vincent


Re: [fw-general] instantiate an object with a variable name for the class

2008-04-24 Thread Vincent
On 4/24/08, Denis Fohl [EMAIL PROTECTED] wrote:

 Thank you for your response Vincent,

 for now, i have no other solution than instantiate the object before
 calling my constructor and pass the Zend_Db_Table objects to it instead of
 passing strings with their names... but it's not exactly what i wanted to
 do.


It's very unfortunate indeed, but that's life I guess...

cheers



-- 
Vincent


Re: [fw-general] instantiate an object with a variable name for the class

2008-04-24 Thread Vincent
On 4/24/08, Pete Spicer [EMAIL PROTECTED] wrote:

 Hello
 It is possible to instantiate a class from a variable name - before PHP 5.3
 even. I've been doing this with 5.2 in a project I'm working on.

 I think the key thing is the syntax:
   $table1 = new $originClass; // note no brackets

 Hopefully that'll help!


It that's true, then sorry for the wrong information on my part. It's a
while ago that I tried to do something similar, and I'll probably have mixed
up a few things. Good to know your use case will work :)

Pete


-- 
Vincent


Re: [fw-general] Zend Layout doctype at bootstrap question

2008-04-16 Thread Vincent
On 4/16/08, Denis Fohl [EMAIL PROTECTED] wrote:

 Hi all,

 in comments to this tutorial :
 http://codeutopia.net/blog/2008/03/17/introduction-to-zend_layout-updated-for-zf-15/

 Matthew said : I'd recommend calling the doctype() helper with the
 doctype you want from your bootstrap. 

 how to do that ?


I currently do it like this:

$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$view = new Zend_View(array('encoding' = 'utf-8'));
$view-doctype('XHTML1_STRICT');
$viewRenderer-setView($view);

Thanks.

 --
 Denis


-- 
Vincent


Re: [fw-general] Simplicity Meets Power and not Simplicity, Meets Power

2008-04-16 Thread Vincent
On Wed, Apr 16, 2008 at 5:40 PM, David Rogers [EMAIL PROTECTED] wrote:

 On Apr 16, 2008, at 1:03 PM, Wil Sinclair wrote:

 Please feel free to throw out ideas here. I would like to suggest you try
 to aggregate all your suggestions in one mail, however, so that we don't
 create too much non-technical traffic. And, of course, if we were to use a
 slogan suggested by a member of the community, we'd have to make sure Zend
 held the copyright and could trademark it if necessary.


 It Doesn't Suck. (:D)

 Agile AND Flexible.

 ...and it doesn't suck. :D


It doesn't suck implies that other frameworks do suck, and even though one
might argue that to be the case ( ;-) ), I think it'd be more appropriate to
promote ZF's own benefits.



 David




-- 
Vincent


Re: [fw-general] Simplicity Meets Power and not Simplicity, Meets Power

2008-04-16 Thread Vincent
On Wed, Apr 16, 2008 at 6:26 PM, David Rogers [EMAIL PROTECTED] wrote:

 Hopefully everyone else found this more funny than serious. The Agile AND
 Flexible motto was my serious suggestion. Come on, V, get hip, man...! ;)


Hehe, sorry :)
(It's not that I've got no humour, just that I've used up all my humour
points today because I enjoy laughing so much ;-)
-- 
Vincent


Re: [fw-general] Zend_Config_Ini - keys as an array

2008-04-15 Thread Vincent
On 4/15/08, Paul Simon [EMAIL PROTECTED] wrote:

 Hi,

 I've been using Zend_Config_Ini successfully in a number of applications.
 I'm wondering if the following is the correct way to configure arrays? My
 concern is that I don't see it documented anywhere to add brackets to the
 end of keys, like plugin[]. I just happened on a comment at [
 http://us.php.net/manual/en/function.parse-ini-file.php#75983] saying it
 can be done. Does anybody else use 'key[]' to configure arrays? Thanks, Paul

 Set config.php
 ---
 [Production]
 ; plugins
 plugin[] = Init
 plugin[] = Authenticate
 plugin[] = Access
 plugin[] = Wrapper

 Get array
 ---
 $conf = new Zend_Config_Ini('config.php','Production');
 $plugins = $conf-plugin-toArray();

 Dump $plugins
 ---
 array (
   0 = 'Init',
   1 = 'Authenticate',
   2 = 'Access',
   3 = 'Wrapper',
 )



I think you're supposed to do it like this:

Set config.php
---
[Production]
; plugins
plugin.0 = Init
plugin.1 = Authenticate
plugin.2 = Access
plugin.3 = Wrapper

Get array
---
$conf = new Zend_Config_Ini('config.php','Production');
// Now you can access them like:
echo $conf-plugin-0; // Displays 'Init'
// Or you could convert it to an array which would return the array
described
$plugins = $conf-plugin-toArray();

Dump $plugins
---
array (
 0 = 'Init',
 1 = 'Authenticate',
 2 = 'Access',
 3 = 'Wrapper',
)


-- 
Vincent


Re: [fw-general] Zend_Config_Ini - keys as an array

2008-04-15 Thread Vincent
On 4/15/08, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote:

 -- Vincent [EMAIL PROTECTED] wrote
 (on Tuesday, 15 April 2008, 06:22 PM +0200):

  On 4/15/08, Paul Simon [EMAIL PROTECTED] wrote:
 
  Hi,
 
  I've been using Zend_Config_Ini successfully in a number of
 applications.
  I'm wondering if the following is the correct way to configure
 arrays? My
  concern is that I don't see it documented anywhere to add brackets
 to the
  end of keys, like plugin[]. I just happened on a comment at [http://
  us.php.net/manual/en/function.parse-ini-file.php#75983] saying it
 can be
  done. Does anybody else use 'key[]' to configure arrays? Thanks,
 Paul
 
  Set config.php
  ---
  [Production]
  ; plugins
  plugin[] = Init
  plugin[] = Authenticate
  plugin[] = Access
  plugin[] = Wrapper
 
  Get array
  ---
  $conf = new Zend_Config_Ini('config.php','Production');
  $plugins = $conf-plugin-toArray();
 
  Dump $plugins
  ---
  array (
0 = 'Init',
1 = 'Authenticate',
2 = 'Access',
3 = 'Wrapper',
  )
 
 
 
 
  I think you're supposed to do it like this:
 
  Set config.php
  ---
  [Production]
  ; plugins
  plugin.0 = Init
  plugin.1 = Authenticate
  plugin.2 = Access
  plugin.3 = Wrapper


 No, you can't do this...


  Get array
  ---
  $conf = new Zend_Config_Ini('config.php',
  'Production');
  // Now you can access them like:
  echo $conf-plugin-0; // Displays 'Init'


 ... because the above is invalid PHP. (Try it; you'll get an unexpected
 T_LNUMBER parse error.)


Ah, of course, stupid. I knew I was missing something, thanks for
correcting...

-- 
Vincent


Re: [fw-general] Zend_Search_Lucene and 2.4

2008-03-24 Thread Vincent
On 3/24/08, reto [EMAIL PROTECTED] wrote:

 Hi everyone,

 I'm just trying some stuff out to build a simple search engine for
 documents with lucene.
 Because this is a performance critic thing, I was comparing searching
 and indexing with Lucene 2.1 and 2.4 format.
 With a small Java reference-implementation the observed
 speed-difference was impressive.
 Time needed to build an index of 1.8Mio items: 18secs (2.4) or 30mins (2.1
 ).
 Time needed to search the index wasn't that different. But the query
 with the new format still needed about half the time.

 Since Zend_Search_Lucene only supports 2.2 lucene-format (which as I
 see is the same as 2.1), I would like to ask, whether support for the
 2.4-format might come to ZF in the near future? Since I have no deeper
 understanding of the index-formats I cannot estimate anything...

 Or might it be more reasonable to write a search and indexing
 application in java and then make a php-wrapper for this application?

 Thanks for any insights or hints!


Not sure if this is of any help since I haven't tried it myself, but I read
this post the other day:
http://www.ibuildings.nl/blog/archives/701-Implementing-Sphinx-search.html

Sincerely,

 Reto




-- 
Vincent


Re: [fw-general] Zend_Form: submit and reset decorators

2008-03-23 Thread Vincent
On 3/23/08, LaggyLuke [EMAIL PROTECTED] wrote:


 What is the simplest and correct way of rendering Submit and Reset buttons
 on
 a single row of the form, not one below the other?
 I've played with decorators and fieldsets for awhile, but ended up with
 quite messy code.
 I assume that such an easy task should have some simple solution I'm
 missing.


As this has to do with the looks of your website, you should do this in CSS,
by e.g. setting display: inline; .

Best,
-- 
Vincent


Re: [fw-general] Zend_Form: submit and reset decorators

2008-03-23 Thread Vincent
On 3/23/08, LaggyLuke [EMAIL PROTECTED] wrote:



 Vincent-20 wrote:
 
  On 3/23/08, LaggyLuke [EMAIL PROTECTED] wrote:
 
 
  What is the simplest and correct way of rendering Submit and Reset
  buttons
  on
  a single row of the form, not one below the other?
  I've played with decorators and fieldsets for awhile, but ended up with
  quite messy code.
  I assume that such an easy task should have some simple solution I'm
  missing.
 
 
  As this has to do with the looks of your website, you should do this in
  CSS,
  by e.g. setting display: inline; .
 
  Best,
  --
  Vincent
 
 


 Thanks for the tip - this solution is simple, but not completely correct.
 You're right that the look of a website should be specified by CSS, but
 HTML
 part should still be semantically correct.
 With default decorators it looks like this (whitespaces changed for
 readability):
 dt/dt
 ddinput type=submit name=submit id=submit value=Save/dd
 dt/dt
 ddinput type=reset name=reset id=reset value=Reset //dd

 What I want is to move these buttons from dl altogether, or at least put
 them in a single dd.
 Sure thing, I'll use CSS to style them as soon as I get semantically
 correct
 markup in HTML.


Ah, then you'll need to replace the standard decorators [1] with your own
[2], IIRC.

[1] http://framework.zend.com/manual/en/zend.form.standardDecorators.html
[2] http://framework.zend.com/manual/en/zend.form.decorators.html
-- 
Vincent


Re: [fw-general] Website fonts size too large?

2008-03-22 Thread Vincent
On 3/22/08, Amr Mostafa [EMAIL PROTECTED] wrote:

 Thanks Wil, I would say that throughout the whole site, reducing the fonts
 size made it a better (usual) experience for me. (usual as when compared to
 other websites I'm browsing).


I have to say that, even on my 1280x1024 screen, the doc fonts look much,
much better when decreased in size one step.

Cheers,
 - Amr




-- 
Vincent


Re: [fw-general] Zend Framework 1.5 has landed!

2008-03-17 Thread Vincent
On 3/17/08, Wil Sinclair [EMAIL PROTECTED] wrote:

 Well, folks, we made it. Zend Framework 1.5 GA is now released and
 available at the framework site:

 http://framework.zend.com/download

 And just to remind you once again of all the new features in 1.5:

 * New Zend_Form component with support for AJAX-enabled form elements
 * New action and view helpers for automating and facilitating AJAX
 requests and alternate response formats
 * Infocard, OpenID, and LDAP authentication adapters
 * Support for complex Lucene searches, including fuzzy, date-range, and
 wildcard queries
 * Support for Lucene 2.1 index file format
 * Partial, Placeholder, Action, and Header view helpers for advanced
 view composition and rendering
 * New Zend_Layout component for automating and facilitating site layouts
 * UTF-8 support for PDF documents
 * New Nirvanix, Technorati, and SlideShare web services

 There are a lot of people to thank, since there are a lot of people who
 worked hard to make this happen. First of all, thanks to all the Zend
 Framework contributors who helped in all kinds of ways to make this a
 truly great, high-quality release. I would personally like to thank the
 Zend Framework team here at Zend for working the long hours this weekend
 to make sure everything came together on Monday morning. There were also
 some very selfless souls in marketing who stayed up late over the last
 few days to make sure the site was at its best in both style and
 substance for the big day. Finally we'd like to thank all the ZF users
 out there who inspire us to continue improving Zend Framework and who
 never fail to keep us on our toes. :) We hope this release not only
 lives up to your high expectations but goes beyond them.

 Now we can finally say that we wholeheartedly recommend the 1.5 release
 for production use.

 Enjoy ZF 1.5!


 ,Wil


Love the new site, too bad there's http://framework.zend.com/docs/quickstart

http://framework.zend.com/sIFR/caecilial_roman.swfError!

An error occurred with this request: Action quickstart does not exist and
was not trapped in __call().

-- 
Vincent


Re: [fw-general] Library for writing config (INI) files to disk?

2008-03-11 Thread Vincent
On 3/11/08, Julien Pauli [EMAIL PROTECTED] wrote:

 Please, visit that improvement :
 http://framework.zend.com/issues/browse/ZF-2849
 Feel free to contact both Rob or me for making a proposal of refactoring +
 adding implementations (such as the save() one ) for Zend_Config.


Hmm... I haven't sign the CLA or anything, and in fact, don't think I'm
experienced enough to be really contributing to ZF yet. I'll first make sure
my class works, publish it so people can at least take a look at it, and see
how it could be refactored. I'm really not confident enough yet to be making
serious contributions ;-)

regards
 Julien.P


-- 
Vincent


Re: [fw-general] Library for writing config (INI) files to disk?

2008-03-11 Thread Vincent
On 3/11/08, Julien Pauli [EMAIL PROTECTED] wrote:

 Don't worry = just write tests and tests again, with use cases. I will be
 enought ;-)


Hehe, the problem is: I don't know PHPUnit :)
I've been learning PHPSpec (great work Padraic :), but unfortunately,
PHPMock has still not released any beta with documentation whatsoever, so I
can't use mock objects yet.

Julien.P




-- 
Vincent


Re: [fw-general] Library for writing config (INI) files to disk?

2008-03-11 Thread Vincent
OK, I've written specifications and they passed, so you can take a look at
my code here:
http://gitorious.org/projects/vogel/repos/mainline/blob/master/project/library/Vogel/Config/Ini.php

If you have git installed you can checkout using

git clone git://gitorious.org/vogel/mainline.git

Any comments are welcome, as I've mentioned, I'm not too confident in my own
code yet, so there's probably lots to improve.

Also note that unsetting (deleting) of values is not possible yet; since
Zend_Config_Ini saves all subvalues as instances of Zend_Config, I could not
override the __unset() method. Perhaps I'll save the original values and let
it check which values were removed when save()ing, but for now, you'll have
to do with this :)

On 3/10/08, Julien Pauli [EMAIL PROTECTED] wrote:

 I'am :-)

 Julien.P



Thanks,
-- 
Vincent


Re: [fw-general] Library for writing config (INI) files to disk?

2008-03-10 Thread Vincent
On 3/10/08, Julien Pauli [EMAIL PROTECTED] wrote:

 I'am :-)


Then you'll be happy to note that I've progressed quite far :)
Currently, the only things left on the TODO list are allowing for unsetting
of values (i.e. deleting them) and to write specifications (unit tests).
I'll post a final message once it's complete :)

Julien.P


-- 
Vincent


Re: [fw-general] RSS Component

2008-03-07 Thread Vincent
On 3/7/08, Kevin McArthur [EMAIL PROTECTED] wrote:

 Before I go and reinvent the wheel, has anyone proposed or developed a
 RSS feed _creator_ for the framework?

 Zend_Feed does an excellent job of parsing feeds but I don't see any
 documented way to create RSS feeds in a similar way to how zend_feed
 parses them.


 Kevin


See
http://framework.zend.com/manual/en/zend.feed.importing.html#zend.feed.importing.customfor
creating custom feeds from arrays.

Best,
-- 
Vincent


Re: [fw-general] Library for writing config (INI) files to disk?

2008-03-05 Thread Vincent
On 3/5/08, dinok [EMAIL PROTECTED] wrote:


 Have a look at http://www.zfforum.de/showthread.php?t=1453
 It's a german page, but you should be able to copy some source :-D

 Best regards


Thanks. Problem with this is that the licensing is unclear and that it
cannot update existing configuration files. However, I've started my own
class that extends Zend_Config_Ini and adds a save() method. Is anyone
interested in getting notifief once it's done?
-- 
Vincent


[fw-general] Library for writing config (INI) files to disk?

2008-03-04 Thread Vincent
Hi,

For my project, I'd like to be able to update INI files. Since
Zend_Config_Ini does not have the ability to write to files, I was looking
for a different library that is open source and able to write INI files to
disk, preferable working with Zend_Config_Ini (if it can take an array of
configuration data that'd be great).
I have already looked at the eZ Components configuration class (
http://ezcomponents.org/docs/tutorials/Configuration) but found that it
doesn't quite fit my needs as 1) it also has to read the configuration files
itself, but more importantly 2) doesn't use real INI files (e.g. comments
are marked with a #, not a ;).
Highly preferred would be a class that can update existing files so comments
in those files do not get lost.

Thanks,
-- 
Vincent


Re: [fw-general] Class 'Zend_Form' not found

2008-03-01 Thread Vincent
On Sat, Mar 1, 2008 at 7:42 PM, zend_newbie [EMAIL PROTECTED] wrote:


 HI

 I am using the zend framework and getting the following error.

 Fatal error: Class 'Zend_Form' not found in  ../public_html/form1.php on
 line 45

 Heres my code

 ?php

 require_once 'Zend/Db.php';

 function start_form()
 {
 $form = new Zend_Form;
 $form-setAction('second.php()') -setMethod('post');

 I would really apprecite if anybody can guide me where i am making the
 mistake.


Perhaps

require_once 'Zend/Form.php'

?



 Vaibhav




-- 
Vincent


Re: [fw-general] Class 'Zend_Form' not found

2008-03-01 Thread Vincent
On Sat, Mar 1, 2008 at 8:15 PM, zend_newbie [EMAIL PROTECTED] wrote:


 HI

 Thanks for all your help and i m still trying to configure zend and it
 seems
 that theres some configuration issues that i m having.
 When i include the file
 require_once 'Zend/Form.php'

 it gives me a different error
 Warning: require_once(Zend/Form.php) [function.require-once]: failed to
 open
 stream:
 No such file or directory in public_html/form1.php on line 4

 Fatal error: require_once() [function.require]: Failed opening required
 'Zend/Form.php'

 I searched for the file Form.php and i dont have this on my system, i m
 using  red hat. Do u know what i need to install to fix this.


Are you sure you fully downloaded and extracted the Zend Framework? It's
really supposed to be right there in the Zend folder. Have you also added
the library directory to the include_path?



 Vaibhav

 Fatal error: require_once() [function.require]: Failed opening required
 'Zend/Form.php'





-- 
Vincent


Re: [fw-general] Make Default Router get 1 param from /some/list/1

2008-02-29 Thread Vincent
You might be interested in
http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.regex


On 29/02/2008, Nicolae Namolovan [EMAIL PROTECTED] wrote:

 Yes, but I want to do one rewrite route for all actions.. I mean
 change the default router.
 For example, very often I need just one paramater, so it doesn't make
 too much sense to pass param name too..
 I'd like to get one_param from /controller/action/one_param..
 Any way to do that with getParam() ? And how I must rewrite the route
 to leave the /key/value behavior and just add /value behavior..


 On Wed, Feb 27, 2008 at 5:07 PM, James Dempster [EMAIL PROTECTED]
 wrote:
  You might find that this is more what you are looking for?
 
 http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.basic
 
 
 
  On Wed, Feb 27, 2008 at 12:57 PM, Nicolae Namolovan 
 [EMAIL PROTECTED]
  wrote:
   Is it possible to do a default router with same characteristics as
 current
  one:
  
   Module + controller + action + params:
  
   But also with
   Module + controller + action + 1param:
   Example:
   /some/list/1
  
   And getParam(0) should return 1.. ?
  
   --
   Sincerely,
   Nicolae Namolovan.
  
 
 
 
  --
  /James




 --
 Sincerely,

 Nicolae Namolovan.




-- 
Vincent


Re: [fw-general] ZF and SEO issues

2008-02-12 Thread Vincent
(Sorry debussy007 for sending this to you personally)

On 12/02/2008, Vincent [EMAIL PROTECTED] wrote:



 On 12/02/2008, debussy007 [EMAIL PROTECTED] wrote:
 
 
  Hi,
 
  Some of my content can have more than one Url, e.g. :
  * http://www.example.com/read_inbox/mail/15
  * http://www.example.com/read-inbox/mail/15
  * http://www.example.com/readInbox/mail/15
  * etc.
  This is wrong regarding SEO.
  You will probably reply me that I should just use one type of url in my
  application,
  but what if someone links a different url to my site ?
  Also maybe someone that doesn't want your site to get well ranked can
  use
  this trick.
 
  This article also explains this problem:
 
  http://www.mindloop.be/nieuws/nieuwe-ontwikkelingen/seo-warning--zend-framework-and-duplicate-content
 
  Thank you for any reply


 It is highly unlikely that a visitor would go switching around those URLs
 by himself (probably doesn't even know it's possible). If a competitor wants
 to like to such URLs to harm you he'll probably only help you because he
 adds another link back to your site.

 Best,
 --
 Vincent




-- 
Vincent


Re: [fw-general] Zend_Layout - images and css not loading

2008-02-02 Thread Vincent
On 01/02/2008, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote:

 -- Peter Atkins [EMAIL PROTECTED] wrote
 (on Friday, 01 February 2008, 12:17 PM -0800):
  I apologize that was my typo
 
  html
  head
  meta http-equiv=Content-Type content=text/html; charset=utf-8
 /
  titleHome/title
  link href=/css/lib.css media=screen rel=stylesheet
  type=text/css //head
  body
  img src=images/order.gif
  div id=header!-- base/header --
  brbr/div
  .
 
  I wish that was it...
 
  I do see the following two errors:
 
  HP Fatal error:  Uncaught exception
 'Zend_Controller_Dispatcher_Exception'
  with message 'Invalid controller specified (css)'...
  PHP Fatal error:  Uncaught exception
 'Zend_Controller_Dispatcher_Exception'
  with message 'Invalid controller specified (images)' 

 Okay, this sounds like one of two things:

   * Either the css and image files are not under your public directory,
 OR
   * You've got a bad rewrite rule, and *all* files are getting routed to
 the front controller instead of omitting static content

 What does your rewrite rule look like? Is it the one from the
 documentation:

 RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php


Also, what happens when you visit the file linked to in the source of your
generated HTML page?

Best,
-- 
Vincent


Re: [fw-general] Proposal for a user agent component

2008-01-31 Thread Vincent
On 31/01/2008, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote:

 -- Simone Carletti [EMAIL PROTECTED] wrote
 (on Wednesday, 30 January 2008, 11:19 PM +0100):
  http://creativecommons.org/licenses/by-nc-sa/2.5/
  Attribution-Noncommercial-Share Alike 2.5 Generic
 
  Additionally, you should consider I already talked with my friend about
 the
  idea of a PHP porting and he was more than happy.
  I guess license or permission is not really a problem.

 Excellent -- I'll have somebody on the Zend team verify that this is a
 compatable license; I'm not sure what our policy is on attribution.

 Wouldn't the NonCommercial part be a problem? (As in: IIRC the New BSD
license allows commercial usage)

-- 
Vincent


Re: [fw-general] ZF1.5 and Zend_Form

2008-01-29 Thread Vincent
On 29/01/2008, Xavier Vidal Piera [EMAIL PROTECTED] wrote:

 Hi

 Yes, technically it's not a critical thing, but IMHO showing a popup The
 page you're trying to see contains POSTDATA... is a technical message and
 should not appear to the user, who is not interested to know about this tech
 things. For us is something clear and we know how to manage it but there are
 people who doesn't know what the word POST stands for. The user doesn't know
 either if clicking again will be harmful for his data or not, so avoiding
 these kind of decisions it's better for the user experience.

 It sounds a bit perfectionist, but as i don't want to show any thrown
 exception from the application, i don't want to show popups like these
 either.

 Thanks for your comments ;)


While I agree that this practice is user-unfriendly, I see it as a problem
of the browser. In fact, I recall reading plans for Firefox to remove that
dialog (which I take it means automatically reloading it, but a re-wording
would already be a huge improvement).

Best,
-- 
Vincent


Re: [fw-general] Zend_Form from config file

2008-01-22 Thread Vincent
On 22/01/2008, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote:

 snip
  If so how we gonna handle multilanguage (site been in multiple
  languages) case ? With multiple sections of same config file,
  inherited ([general], [en], [de], aso) ?

 Right now, I've got the following setup for i18n:

   * With labels, if a Zend_Translate_Adapter has been registered with
 the form, the label provided to the element will be passed to
 translate(). So, you can specify a translation messageid for the
 label, and as long as you have a translation in the current locale,
 it will provide the translation.


Sorry to chime in, but this made me wonder: will this method still allow e.g.
PoEdit to generate translation files containing those strings?

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



Thanks,
-- 
Vincent


Re: [fw-general] ZFW Modular Structure Question

2008-01-14 Thread Vincent
On 14/01/2008, Juan Felipe Alavarez Saldarriaga [EMAIL PROTECTED]
wrote:

 Hey :).

 I got a question, I have this modular structure, the default one:

 modules/
 article/
 controllers/
 AdminController.php
 IndexController.php
 models
 SmartArticle.php
 views/
 scripts/
 article/
 *.phtml

 I have an issue, when I try to load the model named SmartArticle.php:

 /**
 * Browse.
 *
 */
 public function browseAction()
 {
 // Load News module.
 $objSmartArticle = new SmartArticle();
 }

 I got a fatal error:

 Fatal error: Class 'SmartArticle' not found in
 /home/jfalvarez/php5/test/site/modules/article/controllers/AdminController.php
 on line 99

 I'm using the Zend_Loader::registerAutoload(); method into the bootstrap,
 the model name should be equal than the module name ? I mean, SmartArticle
 should be Article ?

 Thx for any help.


Have you added /modules/article/models to the include path?

-- 
Vincent


Re: [fw-general] Pages/subpaces routes

2008-01-07 Thread Vincent
On 07/01/2008, Stuardo -StR- Rodríguez [EMAIL PROTECTED] wrote:

 The framework website is using ZF, right?

 How do you create the route they use for pages/subpages like this one

 http://framework.zend.com/whyzf/casestudies/


You might want to check out
http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.usage
and http://naneau.nl/2007/04/26/a-zend-framework-tutorial-part-three/ .

-- 
Vincent


Re: [fw-general] Zend_Layout now in core!

2007-12-12 Thread Vincent
On 12/12/2007, Daniel Freudenberger [EMAIL PROTECTED] wrote:

  for everbody who's not able to build the docs, i've put the documentation
 (including zend_layout) to http://zfdoc.bwler.org/


Awesome, thanks!

Best regards,

 Daniel




-- 
Vincent


Re: [fw-general] has zend_db_table some kind of getPage() method ?

2007-10-20 Thread Vincent
On 20/10/2007, Matthew Weier O'Phinney [EMAIL PROTECTED] wrote:

 -- Truppe Steven [EMAIL PROTECTED] wrote
 (on Saturday, 20 October 2007, 04:19 AM +0200):
  is there some method to fetch an interval of zend_db_rowset objects from
  an zend_db_table for pagination ? or do i need to write it on my own ?
  so i can for example fetch all items with id from 1 to 10 or 10 to 20
  and so on.

 The fetchAll() method allows you to pass a $count a $offset parameter:

 fetchAll($where = null, $order = null, $count = null, $offset = null)

 Use those parameters when you want to do paging.


Also see http://www.assembla.com/wiki/show/riskle/Pagination_Component

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




-- 
Vincent


Re: [fw-general] Best practices for controller and model methods

2007-10-09 Thread Vincent
On 09/10/2007, Noé Froidevaux [EMAIL PROTECTED] wrote:

 Hi!
 I make my work diploma with zend framework. So, I would like to do the
 best practices.

 I use the MVC model. When you make a function which is called by an
 action, where do you write this function? directlly in the controller?
 Do you make your own library?


See http://framework.zend.com/manual/en/zend.controller.actionhelpers.html

And when you make a custom sql request, where you write this request?
 In function in a model? Do you make a new model for that? Do you make
 a function in a class of your own library?


You can just write that in your controller, and it should interact with a
model. I think you should see
http://framework.zend.com/manual/en/zend.db.statement.html but perhaps
someone more skilled than me should answer it.

Noe




-- 
Vincent


Re: [fw-general] Can't delete my index entries with Zend_Search_Lucene

2007-10-09 Thread Vincent
On 08/10/2007, Alexander Veremyev [EMAIL PROTECTED] wrote:

  Hi,



 Commit should be applied automatically when $index variable goes out of
 scope… So, something is wrong. Could you prepare an example of code to
 reproduce problem?


Well, I don't really want to be reproducing it now because it would mess up
all my files and db tables again, but here's the code that's run inside
AdminController::verwijderenAction() :


$config = new Zend_Config_Ini('./application/config.ini',
'search');
$index = Zend_Search_Lucene::open($config-index-path);
$query = new Zend_Search_Lucene_Search_Query_MultiTerm();
$query-addTerm(new
Zend_Search_Lucene_Index_Term($this-_request-getParam('id'),

'comment_id'), true);
$query-addTerm(new Zend_Search_Lucene_Index_Term('comment',
'type'), true);
$hits = $index-find($query);
foreach($hits as $hit)
{
$index-delete($hit-id);
}
$index-commit();

Which did not work when I did not perform $index-commit();

PS TermDocs() should work faster for this purpose (
 http://framework.zend.com/manual/en/zend.search.lucene.best-practice.html#zend.search.lucene.best-practice.unique-id
 ):


Thanks, I'm reading it through right now. I also read that an alternative to
$index-commit() is to unsert($index), is that what you meant?



 $config = new Zend_Config_Ini('./application/config.ini', 'search');

 $index = Zend_Search_Lucene::open($config-index-path);



 $idTerm = new
 Zend_Search_Lucene_Index_Term($this-_request-getParam('id'),
 'comment_id');

 $docIds  = $index-termDocs($term);

 foreach ($docIds as $id) {

 $doc = $index-getDocument($idTerm);

 if ($doc-type == 'comment') {

 $index-delete($id);

 }

 }

 



 With best regards,

Alexander Veremyev.


  --

 *From:* Vincent [mailto:[EMAIL PROTECTED]
 *Sent:* Saturday, October 06, 2007 9:35 AM
 *To:* Rob Allen
 *Cc**:* fw-general@lists.zend.com
 *Subject:* Re: [fw-general] Can't delete my index entries with
 Zend_Search_Lucene





 On 05/10/2007, *Rob Allen* [EMAIL PROTECTED] wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Did you commit() after loop?


 You see? I said so it would be a stupid mistake... Thanks!



 Regards,

 Rob...

 Vincent wrote:
  Hello,
 
  I am currently working on this website where users can add comments to
  messages. At the moment I am trying to allow the admin to delete these
  comments. However, the code I use can't seem to delete this comment from
  my search index. I've been struggling with it for a while now and just
  can't seem to find the answer, so I was hoping to find help here.
 
  This is my current code:
 
  $config = new
  Zend_Config_Ini('./application/config.ini', 'search');
  $index = Zend_Search_Lucene::open($config-index-path);

  $query = new
 Zend_Search_Lucene_Search_Query_MultiTerm();
  $query-addTerm(new
  Zend_Search_Lucene_Index_Term($this-_request-getParam('id'),
 
  'comment_id'), true);
  $query-addTerm(new
  Zend_Search_Lucene_Index_Term('comment', 'type'), true);
  $hits = $index-find($query);
  foreach($hits as $hit)
  {
  $index-delete($hit-id);
  }
 
  The opening of the index works as it should, and it even is able to find

  my comments (I'm able to do an echo $hit-comment_id within the foreach
  loop, however, $index-delete($hit-id) doesn't delete the entry. I'm
  probably doing something incredibly stupid here, so I hope that you will

  be able to help me.
 
  Thanks in advance,
 
  --
  Vincent

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.7 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

 iD8DBQFHBgxz421+qn4cITwRAuz5AJ4nDMELOebWMPWRUDR8YjdoySVdLQCeN6mi
 e3KCrQkYaHtOTAquoK/2KO8=
 =vSHY
 -END PGP SIGNATURE-




 --
 Vincent




-- 
Vincent


Re: [fw-general] re: .net or zend framework?

2007-10-07 Thread Vincent
On 06/10/2007, rogeson [EMAIL PROTECTED] wrote:




 Alex Netkachov wrote:
 
  BTW: MS will make .NET source code available to debug in next version
  of Visual Studio: http://www.alexatnet.com/node/87
 

 I didn't know that - great move on Microsofts part!


Not as great as it sounds: it can only be viewed for debugging purposes. You
are not allowed to use the code in your own projects, and it does not bring
you the freedom most *real* open source licenses bring you. See
http://blogs.zdnet.com/open-source/?p=1493

--
 View this message in context:
 http://www.nabble.com/.Net-or-Zend-Framework--tf4580976s16154.html#a13077572
 Sent from the Zend Framework mailing list archive at Nabble.com.




-- 
Vincent


  1   2   >