April 14, 09 by Gabi Solomon
IF you just got into versioning your code then you are probably really happy with your acomplishment.
But do you have your database versioned ? This is the questioned asked in this here by Jeff Atwood and also asked by a lot of users on stackoverflow.
After reading a lot on this topic i decided on a strategy on how to keep my database under version control.
As a warning it isn’t the most easy strategy and it really takes some discipline from all the developers.
Read the rest of this entry »
March 29, 09 by Gabi Solomon
Many times when i use Zend_View i have to include view files that are in the same directory, and i am forced to type in the same path over again. Which is and isnt so much work, but during development i often have to place those files in a different folder or rename one of the folders. In witch case i would be forced to change those path i gave in the view file.
This is why i wrote a small View_Helper to return the current view folder.
Unfortunately this will not work on a Zend framework out of the box, it will require some modifications to Zend_View_Abstract.
I have placed the code on ZF Snippets website, a project that i really like, and i would ask you to place any comments and suggestions for this helper on that webpage.
[ZF Snippets code]
Cheers
March 12, 09 by Gabi Solomon
Recently i had to implement a cronjob for a website that was build with zend framework, and to be honest i haven’t done this before. I did some googling and as a lot of times with zend framework there arent to many resources about this topic.
I did find some topics on stackoverflow.com about it ( found out about zend cli proposal wich sounds interesting ) but not really an answer. So i decided to go ahead and try a solution on my own. Read the rest of this entry »
March 11, 09 by Gabi Solomon
After coming across Matthew Turland Minify Filter for Zend Framework i decided to implement the minify app to also minify the css and javascript external files.
But i only did the implementation for the stylesheets for now, and i wanted to share it
.
Read the rest of this entry »
by Gabi Solomon
After tinkering with my VPS settings to optimize it ( it was having some low memory problems ) and after restarting the server, just when i tought everything was ok i noticed that i managed to break some websites.
they all got this error:
mysql error : Incorrect information in file: ./table.frm
After a bit of googling i found the problem … apparently it could be because there is no support for InnoDB … oops. In my quest for optimization i disabled the support for InnoDB tables thinking that there werent any InnoDB tables in the websites hosted on that VPS .. apparently they were
.
Hope you get here faster then i found the solution.
Cheers
March 05, 09 by Gabi Solomon
All of the applications this days will involve a database to store data and most of them will also have a user system. This means that beside building a login/register page you also need a method to store the data of the logged-in user while they are logged in.
Normally in php driven websites you will have that data storred in sessions, but in Zend Framework its easyer to use Zend_Auth to help you manage that part for you. The way i implemented my login is that i save the the user model in Zend_Auth storage, this helps me by having acces to the models methods like isAdmin for example.
Read the rest of this entry »
March 04, 09 by Gabi Solomon
Recently i tried to integrate the well known swfupload script into a website.
If you are here you must probably know that normally the flash request looses session since it doesn’t send cookie headers. The recommended workaround is to send the sessionid as a parameter through post, and in the action page set the session_id() to the post variable before the session start.
I did this but for some reason, my zend application refused to accept the new session_id. I struggled with it for quite a few hours, and finally narrowed it down to a php problem since the session_id would get set properly but after session start the session would be empty.
Really hitting a dead end i headed to stackoverflow ( really thankful for the guys that made this site possible ) and tried my luck there and wrote a question. And i got my answer
Seemed like the problem was with the php extension Suhosin witch has a session protection to prevent session stealing. A very useful thing but in this case it made me spend quite a few hours puzzled and staring at the monitor.
Hope you this is also your problem,
Cheers
March 03, 09 by Gabi Solomon
I have been trying to install apc for the past 3 hours on my centos VPS and i was getting these error:
Sorry, I was not able to successfully run APXS. Possible reasons:
1. Perl is not installed;
2. Apache was not compiled with DSO support (–enable-module=so);
3. ‘apxs’ is not in your path. Try to use –with-apxs=/path/to/apxs
The output of apxs follows
/root/tmp/pear/APC/configure: line 3263: apxs: command not found
configure: error: Aborting
ERROR: `/root/tmp/pear/APC/configure –with-apxs’ failed
after a alot of searching i finally found the solution. I had to do a manual install.
Asuming you are logged in as root you need to follow the following steps.
1. Grab APC 3.0.8
wget http://pecl.php.net/get/APC-3.0.8.tgz
2.Extract files
gunzip -c APC-3.0.8.tgz
3. change to directory:
cd APC-3.0.8
4. Actual install
phpize
./configure –enable-apc –enable-apc-mmap –with-apxs=/usr/local/apache/bin/apxs –with-php-config=/usr/bin/php-config
make
make install
take note that –with-apxs also specifies the location
As for the rest as the config i am sure you already have opened a ton of pages telling how to do it, if you encountered this error.
Hope you find this page faster then i did.
Cheers
February 27, 09 by Gabi Solomon
After starting working with zend framework i found all sorts of examples of bootstrap files, but a lot of them seem pretty messy to me since all the calls to zend components were basically thrown in there.
So after a lot of looking around i came up with a bootstrap files that is more to my liking. I found the initial class on a blog post when i was looking around but i don’t remember where, so sorry for not giving it the credit.
Read the rest of this entry »
February 08, 09 by Gabi Solomon
this post is more of a personal best practice and thought to share it with you guys. I like to do things this way, and think this is the best aproach, but i might be wrong and i would like your feedback on this
.
So in Zend Framework first of all you are recommended to always use the routers assemble method to generate the Urls. Wich is very good since you will then have an easy way of updating an URL, for example when the SEO guy tells you to switch 2 url params around.
The problem is where you place your call to the router ?
One way to go about it is to place it in the controller, or in the view. But i think that is not the best ideea since this would mean in case you would want to change the route, the name for example, you would need to change it in all the places you made it.
A second choice would be to have the router call in a function somewhere that you would call from everywhere you would want the URL generated. But that seems to me like an extra layer.
My approch.
Almost all the time that URL is related to a model. For example if u have an article model. then you could make a method buildUrl :
PHP:
-
public function buildUrl()
-
{
-
$router = Zend_Controller_Front::getInstance()->getRouter();
-
-
$url = $router->assemble(
-
-
'article_id' => $this->id,
-
),
-
'article_page');
-
return $url;
-
}
and then in your controllers and views you would just do:
which looks nicer and you are keeping the call to the router in one place.
Thats about it, i know this might look like pretty simple stuff for most of you, but i hope some will find this useful.
Cheers