PHP Programming Frameworks

PHP Programming Frameworks

Make your PHP projects simpler with a development framework.

It is difficult to leverage Drupal to its full extent without actually learning the mechanics behind it – PHP. Since Drupal is a framework for Content Management, I decided to see if there might be a similar type of framework for PHP, the soul of Drupal. I discovered this great roundup on Wikipedia on development frameworks for many different programming languages. And here I discovered Yii. You can see from both sites that the Yii (Yes It Is) MVC (Model, View, Controller) framework scores better than the others, offering more features. And it is under the BSD license so the download is free!

http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks

http://www.phpframeworks.com/ – This is another good resource, specifically for PHP.

So with the choice for Yii made, I decided to look for a book on the subject. I’ve had good luck with Packtpub before so I decided to check their web site to see if they offer anything on Yii. And lo and behold, they do.

I’ve been reading the book, working with the sample code and using Yii for a few weeks now and the book has been really helpful. The chapters navigate the development path of a real application. The book touches on every aspect that a real world development team will face in software production from user access control, issue management to production readiness. It also explores the Blueprint CSS framework, which allows the team to make the application look polished and refined.

The code examples are easy to use and well documented, allowing for a great learning experience even for a novice.

All in all, a great resource for those in software development for the web. Highly recommended.

Resolved – Warning: Parameter 1 to icl_content_node_view

I have been working with a bunch of the language modules and I am now receiving this error on the main page of my quality environment. Eh, that’s why you have quality. Well, that’s really why you have a sandbox. but my sandbox really needs some help. Fortunately, I backed everything up before my last prod change, including quality. If I can’t fix it, I may roll back and punt.

Warning: Parameter 1 to icl_content_node_view() expected to be a reference, value given in module_invoke_all() (line 857 of/var/www/html/includes/module.inc).

this is a known bug. http://drupal.org/node/1223990 and http://drupal.org/node/1010166

Here is the actual patch procedure from hgneng. Big thanks for this; it worked perfectly.

I did have to install the app “patch” to use this proc. simple – yum install patch

Posted by hgneng on May 16, 2012 at 8:38am

The patch works for Drupal 7.14. Why not merge it to dev?

@tzanis how to install patch (for Linux user):
$ cd sites/all/modules/translation_management/icl_content
$ wget http://drupal.org/files/issues/translation_management-node-hooks-by-valu…
$ cp icl_content.wrapper.inc icl_content.wrapper.inc.bak
$ patch -p1 icl_content.wrapper.inc -i translation_management-node-hooks-by-value.patch.txt

WAMP and Aptana code editor

well, i have all my great drupal environments setup. but as i started working with php code in aptana, i realized pretty quickly that i was going to need a local web server to test the php pages. so, install apache for windows xp. let me digress. windows xp is one of the best OSs ever developed. this MCSE isn’t big on MS much these days but XP is still a masterpiece. it will run so much stuff and run it well. i have a nearly ten year old dell running XP and it works great. it will run all the modern open source crap that i want and it is as solid as a rock. there is a reason that the biz community ran XP for as long as it did. and DOES. there are still millions of PCs out there in offices all over the place that run xp. there just isn’t a good reason to get rid of it when it will do 96% of what you need on hardware that is now pretty old. the only thing it won’t run that i actually care about is IE9. and i would never use that anyway if i didn’t have to plan my development around its css quirks.

i love XP. it’s great and it is a product like americans used to make: no planned obsolescence.

so, i’m installing a full WAMP server. most of the config for WAMP was pretty easy. the hard part was getting aptana to work properly with apache and the installed browsers so that the preview features could be used. for clues on that i am attaching a SS of what my server config looked like in aptana. it was a pain and i don’t believe that it was well documented. so, i posted what i did to stackoverflow here: http://stackoverflow.com/questions/12188045/aptana-studio-3-generic-server-doesnt-support-start/14402908#14402908

Import/export Aggregator feeds part II

well, i now have it running in prod and there were a few minor differences that i wanted to document.

since i don’t have an X window type desktop, i had to access the phpmyadmin via a remote web browser. so, i had to change the file /etc/conf.d/phpmyadmin.conf in three places to allow connections from all instead of just localhost. i was then able to access the web gui, import the file, and test the aggegator feeds. i had to chanmge som permissions as well to be able to access the file so i could edit it remotely. i could have done it locally via VI Editor, but i hate that thing. it sucks. so after the changes were made i made sure to change the perms back as well as change the file itself so that attempting to access the phpmyadmin gui from the remote host yielded again a “forbidden” error.

Getting all the environments ready.

So, I have all three environments up and running. I have the prod site out of DC hosted by blackmesh.com, the best drupal hosting company there is. The quality site, which mimics the prod site perfectly past the virtualization level, from the drupal core level, the OS and patch installs and even the modules and themes installed on drupal. file structure. user accounts. access methods (although prod uses sftp and qual uses ftp) and os components like apache and mysql. very nice.

i had to reenable clean urls on the q and d boxes. which was OK. i used most of the proc that i uploaded earlier today with a few differences that are not in the instructions. but google and drupal.org were very helpful and I really didn’t have much trouble. just be aware that linux permissions seem to be trickier than perms on a windows server.

getting late, and write more tomorrow. but i am excited because i am finally going to be able to get to work on the site itself and not have to worry so much about all the infrastructure crap. i did  get a few issues with file transfer worked out too. but i have a question: is there any other way to use drupals install module gui to use a protocol other than ftp? that’s the only choice in the drop down. i can ssh files to the server and i’m sure that i could install/enable the modules via the command line, but from the web admin gui running remotely, i don’t see how you could. i’ll pcik that back up more tomorrow maybe.

Production and Development, SSH, Quality and Testing

So I have my two environments up and running. What I need to do now is get them aligned so I can do proper testing in the dev environment before moving the files to prod with a minimum of trouble. So, I have my dev environment on a vm on my laptop. i can access prod from the laptop or desktop via the drupal web interface. I can also access it via SSH and aptana. that’s the way that i can upload the code to prod. but i need to be able to access the dev code consistently from the desktop (the vm is on the laptop and the files are too big to move around).

so i need to be able to access the laptop vm from the desktop. and since they (desk n vm) are on different networks i have to route packets from the vm network to the home wireless network. otherwise, i’m going to have to sync the code files from the desk to the lap, upload the files on the laptop to the vm for testing, then upload from desk to prod via ssh. i think that i might try to get SSH running on the vm centos install then make it accessible to the desk. that would also closely mimic prod. that’s the ticket.

Centos Dev Server up and running

Well, I have finally gotten my dev server up and running. now my dev matches prod. CentOS 6.3 is the choice by my provider, Blackmesh.com and now it is my choice as well.

there were some challenges getting centos to work with drupal but nothing too bad and it ended up taking about half a day.

Drupal CSS, TPL Files and More

Drupal 7, CSS, TPL, PHP

This colorful little exercise actually attempts to show where the Core and Module CSS and TPL files are located. The thing is, Core really mean Core and Core Module. Together, these are refered to as Core. Module refers to contributed modules and their corresponding files that may or may not supersede the core files. Then, there are the Theme files. These can trump all the rest of the files’ styles if the naming conventions are followed properly. This too-busy diagram also attempts to help me see how I deal with many colors, shapes and layering. I’m not a design guy and I don’t really care for design, nor am I any good at it. But, I have to learn some of it.

Inheritance rev7 – Copy – this is the actual Visio diagram. rename it to .vsd and you can see this up close.

Drupal 7 Core .TPL.PHP files

http://drupal.org/node/190815

this link will take you to a list of all the template files used in the core. this is a great link that has been very useful to me. each template is fully linked to an explanation of the template itself.

these are the files that I am particularly concerned with:

System“modules/system/…”

 

Core CSS Files and Drupal Inheritance

So I am exploring subtheming. and because i am a bit OCD, i have to understand the whole underlying thing. so i have been looking at the core files; not to hack but to see what the overrides and intercepts are actually affecting. Here are the core CSS files in   Drupal 7

..drupal…mod…sys…

system.admin.css

system.base.css

system.maintenance.css

system.messages.css

system.theme.css

then, if you enable the stark theme, you will see a little bit more styling. stark contains:

stark.info

layout.css

if you remove the reference to the css file for stark in the .info file you will see what the default css styling looks like. this helped me to see, literally, the consequence of the styling in layout.css. and since i am a monkey, i need to see it… and because i am an idiot.