Re: [fw-general] Reducing the number of loaded exception files

2007-12-14 Thread Craig Slusher
Why not just implement the __autoload function and handle the require_once
for the Exception class there?

On Dec 14, 2007 4:19 PM, Jordan Moore [EMAIL PROTECTED] wrote:

 It's at the throw, not at instantiation.

 On Dec 14, 2007 12:14 PM, Ralph Schindler [EMAIL PROTECTED] wrote:
  I'm just going off memory right now, but I think stack traces for
  exception objects are wound up from the point which they are created,
  not the point which they are thrown from.  So this would mean that when
  you look at the trace from the exception, it originates from the
  getException method, rather than the place you are wanting to throw it
 from.
 
 
  -ralph
 
 
  Shekar C Reddy wrote:
   I would suggest to incorporate a method that serves as a central
   location to instantiate exception objects - a *consistent
   *object-instantiation system, if you will. This method could go inside
   a class that is always required/loaded so we don't have to include
   another file just for this purpose. Zend_Loader, maybe? This approach
   allows us to add more processing/error-handling logic to the method in
   future that ripples across the framework:
  
  
 //
   static function getException( $class, $message = 'ERROR', $code = 0,
 ... )
  
 //
   {
  self::loadClass( $class );
  //
// Or straight require_once for performance, but then format the
   class-name to instantiate...
   // require_once( $class );
  //
  return new $class( $message, $code, ... );
 




-- 
Craig Slusher
[EMAIL PROTECTED]


Re: [fw-general] RE: Zend_Search_Lucene - Best Practices for Indexing 100k+ articles

2007-05-09 Thread Craig Slusher

webshark27,

When you get your articles indexed, it would be really great if you
can share your experience with searching against it. I would love to
know how well the Zend implementation of Lucene handles the load.

On 5/8/07, webshark27 [EMAIL PROTECTED] wrote:


Hi Chris,

Thanks for the quick response.

Doesn't the $doc = new Zend_Search_Lucene_Document(); just overwrite the
old one?

Also I think the $index-addDocument($doc) is filling up the memory fast, I
don't know exactly how to play with the MergeFactor, MaxMergeDocs and
MaxBufferedDocs effects this issue.

I am running 10,000 each time and then commit changes - load the script
again and running 


Chris Blaise wrote:


   It's been a few months since I worked with this but I had some weird
 errors that I'm not sure if I figured out was due to running out of memory
 or it if it was due to some weird corruption I was seeing that caused the
 script to exit.

   The fix to my problem was to free memory.  In your case try setting
 $doc to null when you're finished with it in the loop, right after the
 $index-addDocument($doc).

  Chris



--
View this message in context: 
http://www.nabble.com/Zend_Search_Lucene---Best-Practices-for-Indexing-100k%2B-articles-tf3712199s16154.html#a10385215
Sent from the Zend Framework mailing list archive at Nabble.com.





--
Craig Slusher
[EMAIL PROTECTED]


Re: [fw-general] persistent ACL data

2007-04-26 Thread Craig Slusher

You could use Zend_Session to make the ACL information persistent.

On 4/26/07, Raul Gomez [EMAIL PROTECTED] wrote:

hello, i am new to zend framework. I am doing an autenthication system
with zend auth and acl, following this tutorial
http://devzone.zend.com/node/view/id/1665
its working with databases, but how can i keep the acl data persistent
without calling database for it again, like auth does it with some
auth::getInstance in the bootstrap so you just fill that only once in
the authentication so you dont have to carry again the auth info
everytime, right now i am calling the database for acl info everytime i
enter a page.
if someone working applying databases in an auth/acl excenario and can
show me would be nice.

thank you.






--
Craig Slusher
[EMAIL PROTECTED]


Re: [fw-general] Stacking Translations

2007-04-25 Thread Craig Slusher

You could register it in Zend_Registry or you could do
$request-setParam() to assign the translation object to each request.
The request object is available in all controllers.

On 4/25/07, Ian Warner [EMAIL PROTECTED] wrote:


Ok If I right a plugin:

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
 Zend_Debug::dump($request, null, false);

 // Setup the Language element
 $translate_module = new Zend_Translate('gettext', 'modules/' .
$request-getParam('module') . '/locale/en.mo', 'en');
 }

How do I pass this new translation for use in the controllers - or do I
just register this in the registry and then call back?

Cheers

ian

Ian Warner wrote:
 Hi

 Just wanted to get some feedback on ways to stack translations.

 The scenario is we have one core Translation file - getText

 This contains generic translation strings that are present in all sites
 and modules

 Want I want though is to then create a translation file with specific
 site strings and then more with specific module strings.

 so at any one time there will be three loaded translation files

 CORE always on

 SITE - always on

 MODULE - optional only when they enter module.

 Anyone doing anything like this now, any gems of wisdom and optimisation
 techniques I should be lookiing for.

 Cheers

 Ian





--
Craig Slusher
[EMAIL PROTECTED]


Re: [fw-general] Re: how to assign username for smarty, from login?

2007-04-23 Thread Craig Slusher

What I generally do is create a Zend_Controller_Plugin that does the
Authentication before the dispatch process begins. I use Zend_Auth to
handle this. Once I have a valid identity, I assign it to the $request
object. This way there is an identity for each request, and it's
automagically available to every Controller/Action , as well as the
view if I want it there.

On 4/23/07, José de Menezes Soares Neto [EMAIL PROTECTED] wrote:

I could did it with sessions, but will be much better if I could print the
names using zend_auth.


2007/4/21, José de Menezes Soares Neto [EMAIL PROTECTED] :
 hi,

 i am trying to assign username for use it in templates, like header.tpl
and footer.tpl
 but, i don't know how to assign it only one time (in logon proccess) and
use it in all templates that i want.

 i tried to use session, but didnt work...

 does someone could help me?

 best regards,

 José de Menezes






--
Craig Slusher
[EMAIL PROTECTED]


Re: [fw-general] File Upload

2007-02-22 Thread Craig Slusher

Section 13.2.4 File Uploads
http://framework.zend.com/manual/en/zend.http.client.advanced.html

On 2/22/07, Romeo-Adrian Cioaba [EMAIL PROTECTED] wrote:

i'm trying to figure out how to upload a file through Zend Framework. If
have tryed with no luck to upload using Zend_Http_Client.

Can anyone give me a practical example?

Thank You!



--
Craig Slusher
[EMAIL PROTECTED]


Re: [fw-general] Smarty integration

2007-02-21 Thread Craig Slusher

I have attached a copy of my Sleek_View_Smarty class I wrote. Feel
free to rename it and use it for yourself. It works great for me. I
can render smarty templates no problem.

On 2/21/07, highland [EMAIL PROTECTED] wrote:


Hello

I does not work for me, i've made my view class from the code you provided
(edit only smarty paths), when i try to:
$view-assign('Title','test page');
$view-assign('main_data','main_site_data.tpl');
$this-_response-setBody($view-render('main_site_template.tpl'));

i receive my main_site_template.tpl template code: (instead of data):
{include file=header.tpl}

body id=top
div id=wrapper
div id=content
div id=right
{include file=$main_data}
{include file=menu_top.tpl}
/div
{include file=menu_left.tpl}
div id=topOfPage #top Top of page /div
{include file=logo.tpl}
{include file=footer.tpl}
/div
/body
/html


Why ?

 Hi,

 I'd like to recommend you implement Zend_View interface instead of
 extend the abstract class and the render method can be simply like this
 without any problem:

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

 if you look into Smarty's source code, you will find the display() method
 calls fetch()
 and prints the output.

 Just my two cents.

 Jason.

I agree. It's much easier to implement the interface for a non-php based

My take:

http://akrabat.com/2006/12/23/extending-zend_view_interface-for-use-with-smarty/

Regards,

Rob...



--
View this message in context: 
http://www.nabble.com/Smarty-integration-tf3260325s16154.html#a9078402
Sent from the Zend Framework mailing list archive at Nabble.com.





--
Craig Slusher
[EMAIL PROTECTED]


Re: [fw-general] Smarty integration

2007-02-21 Thread Craig Slusher

Forgot the attachment.

On 2/21/07, highland [EMAIL PROTECTED] wrote:


Hello

I does not work for me, i've made my view class from the code you provided
(edit only smarty paths), when i try to:
$view-assign('Title','test page');
$view-assign('main_data','main_site_data.tpl');
$this-_response-setBody($view-render('main_site_template.tpl'));

i receive my main_site_template.tpl template code: (instead of data):
{include file=header.tpl}

body id=top
div id=wrapper
div id=content
div id=right
{include file=$main_data}
{include file=menu_top.tpl}
/div
{include file=menu_left.tpl}
div id=topOfPage #top Top of page /div
{include file=logo.tpl}
{include file=footer.tpl}
/div
/body
/html


Why ?

 Hi,

 I'd like to recommend you implement Zend_View interface instead of
 extend the abstract class and the render method can be simply like this
 without any problem:

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

 if you look into Smarty's source code, you will find the display() method
 calls fetch()
 and prints the output.

 Just my two cents.

 Jason.

I agree. It's much easier to implement the interface for a non-php based

My take:

http://akrabat.com/2006/12/23/extending-zend_view_interface-for-use-with-smarty/

Regards,

Rob...



--
View this message in context: 
http://www.nabble.com/Smarty-integration-tf3260325s16154.html#a9078402
Sent from the Zend Framework mailing list archive at Nabble.com.





--
Craig Slusher
[EMAIL PROTECTED]


Smarty.php
Description: Binary data


[fw-general] Custom Libraries

2007-02-17 Thread Craig Slusher

I have attached an example of two classes I have created which have
helped make my code less error-prone and more modular. The classes
provided wrap the Zend_Db_Table_Row and Zend_Db_Table_Rowset objects,
making them Immutable. This has proven very beneficial when I need to
pass instances of these objects to a view.

By wrapping them in these Immutable objects, I can prevent a template
designer from altering data in any way. It is also more efficient than
converting to an array, since I still implement the Iterator and
Countable interfaces in these objects.

Example:

$photo_table = new PhotoTable(); // PhotoTable extends Zend_Db_Table
$photo = $photo_table-find(1);

// Passes an immutable instance of this object to the view.
$view-photo = new Sleek_Db_Table_ImmutableRow($photo);

$album_table = new AlbumTable(); // AlbumTable extends Zend_Db_Table
$albums = $album_table-fetchAll('parent_id IS NULL');

// Immutable rowset object.
$view-albums = new Sleek_Db_Table_ImmutableRowset($albums);

Check out the attachment and let me know what you think. I'd be
interested to know if anyone finds this type of thing useful.

--
Craig Slusher
[EMAIL PROTECTED]


sleeklib-0.1.tar.gz
Description: GNU Zip compressed data


Re: [fw-general] noRouteAction ....no function ...please help

2006-12-21 Thread Craig Slusher

Check out the following URL:

http://framework.zend.com/manual/en/zend.controller.migration.html#zend.controller.migration.fromzerotwo

The answer to your semi-question is at the bottom of the page.

On 12/21/06, andreencinas [EMAIL PROTECTED] wrote:


hello

noRouteAction the indexController not function


please help
--
View this message in context: 
http://www.nabble.com/noRouteAction-no-function-...please-help-tf2863934s16154.html#a8003340
Sent from the Zend Framework mailing list archive at Nabble.com.





--
Craig Slusher
[EMAIL PROTECTED]


[fw-general] Zend_Filter_Input

2006-10-02 Thread Craig Slusher
I use Zend_Filter_Input to process my $_POST data. If I want to find out if a certain button was clicked, what is the best way to check?if ($post-getRaw('btnSave') !== false) { ... }Is this the correct way to check for button clicks?
-- Craig Slusher[EMAIL PROTECTED]