Skip navigation

Category Archives: Uncategorized

Tahrir Square

Tahrir Square


“The revolution in Egypt has stunned the entire world” (mymodernmet)

“The uprising in Egypt has galvanized the world” (aolnews)

“Egypt Revolution will change the Arab World” (

“Arab world gears up for domino effect” (


The Egyptian Revolution. The Big Picture.


Since Social Engine uses the Zend Framework, the files structure are most probably the same. Social Engine uses modules. So inside the application directory you find modules folder. Each module has a separate folder, containing its associated controllers, models, views, widgets ..etc.


Controllers are found inside controllers folder. Each controller class has defined actions (methods) and each method must have an associated view.

Controllers’ naming convention is NameController.php. The controller’s class name becomes {modulename}_{controllername}Controller

So if we’re inside User module and looking at the Profile Controller, you’ll find:

  • Controller filename is ProfileController.php
  • Controller class name is User_ProfileController

The standard method in controller is the init()  method. This is the method that get invoked when the class is instantiated. So inside it important variables that are used within other method in the controller should be set. For example, setting the subject. I understood that socialengine uses the term “Subject” to name a variable, or an item that the user is currently looking at. For example when you view someone’s profile, the subject becomes that person. If you’re viewing a group, subject becomes that group. Subject is set in the init function so as to be available easily to all other methods in the same controller.

To set subject:

if( !Engine_Api::_()->core()->hasSubject() )    {  //Check is there is  no already set subject

$subject_temp = Engine_Api::_()->user()->getUser($id);      //set temp variable to some user, we got using his id

if( $subject_temp->getIdentity() )        {        //If temp is indeed a valid  user

Engine_Api::_()->core()->setSubject($subject_temp);      // set the subject to that user



To get subject:

$subject = Engine_Api::_()->core()->getSubject();

Methods other than init() are called actions. The take the following convention:

public function methodnameAction(){ }

inside which the action’s logic is defined.

Each  controller has a folder containing it’s views, found in views/scripts folder. For Profile Controller explained above, there is a folder called “profile“, and for each method in this controller -other than init() – there must be an associated view. So if we have a method called helloAction, there must be a file called hello.tpl within that folder.

To invoke a certain action within a certain controller, you follow this scheme in URL:


This action gets invoked, and automatically the associated view gets rendered for display.


Quite insulting.. Both ways actually.

I was playing with Abdallah El Guindy’s “very useful” Ubiquity mashup. Its objective is to fetch the every week Todo list from the G-OSC Wiki. There were few glitches however in his script that I managed to fix.

The best thing about this script and Ubiquity is the preview function. Just popout Ubiquity, type gosc-watsup and the preview should get you the information immediately. However, preview didn’t work.

I Fixed it by adding the missing parameter pblock to the preview function gosc_watsup_preview_page, so it finally appeared.(took me some time to reach that btw)

Then I noticed the previewed items were not complete. I examined the code a little. Abdallah traverses the tags using JQuery.  He greps the To do List anchor with the find function, jumps twice to the next  siblings (siblings are other tags at the same level) and fetches the content using next(). The problem with that is sometimes the To do list is not just one block. There may be a list, then a block of text, another list ..etc. So the last next() invoke may sometimes bring only part of the Todo list.

I managed to solve that too, by calling next() repeatedly in a loop until there are no more siblings. This however brought another problem as the References, Feedback and other items at the same level are brought into preview. I solved that too by added a condition to check we are not leaving the To Do List section.

Okay preview is working and nothing is missing. But it doesn’t look very nice, even though the items are in an Unordered List.

Apparently this is a bug in Firefox. This is what happens:




is treated differently than


So I had to switch to the second one as the in the first, the <ul> is totally ignored.

So, is that all? No! There is one last problem (hopefully), but I’ll just leave that to another post 🙂

This is my updated version of gosc-watsup.


function gosc_watsup_go_to_page() {
jQuery.get(GOSC_WATSUP_TODO_PAGE, {}, function(html) {
var url = jQuery(html).find(‘#bodyContent’).children(‘ul’).children(‘li:last’).children(‘:first’).attr(‘href’);
Utils.focusUrlInBrowser(GOSC_WATSUP_BASE_URL + url);

function gosc_watsup_preview_page(pblock) {
jQuery.get(GOSC_WATSUP_TODO_PAGE, {}, function(html) {
var url = jQuery(html).find(‘#bodyContent’).children(‘ul’).children(‘li:last’).children(‘:first’).attr(‘href’);
jQuery.get(GOSC_WATSUP_BASE_URL + url, {}, function(html2) {
pblock.innerHTML = ‘<h2>Latest TODO list</h2>’;
var innerHtml=””;
return jQuery(this).attr(‘name’) == ‘To_Do_List’;






names: [“gosc-watsup”],
author: { name: “Abdallah El Guindy and Tarek Galal”, email: “”},
contributors: [“Tarek Galal”],
description: “Go to the latest TODO list page.”,
execute: gosc_watsup_go_to_page,
preview: gosc_watsup_preview_page

	names: ["gosc-watsup"],
	author: { name: "Abdallah El Guindy and Tarek Galal", email: "abdallah [dot] elguindy [at] gmail [dot] com"},
	contributors: ["Tarek Galal"],
	description: "Go to the latest TODO list page.",
	execute: gosc_watsup_go_to_page,
	preview: gosc_watsup_preview_page

Web Development is fun. I’ve learned many concepts, made many applications but never actually contributed to the developer’s community. I believe through this blog I’ll be able to contribute to the community with what I’ve learned and will learn.

My name is Tarek,  I’m a student at the German University in Cairo and this is my “always expanding” to do list that I hope this blog will witness me accomplishing many of it 😀


  • Learn Symfony
  • Learn Propel
  • Learn Drupal
  • Learn Joomla
  • Learn CakePP
  • Learn Zencart
  • Learn Magento
  • Learn Smarty

Some concepts:

  • Infinite scroll concept
  • Payment gateways
  • Shopping carts
  • Try Linq to FQL
  • Learn and make Widgets


  • Learn JSON
  • Learn Extjs


  • Learn AIR
  • Learn Perl
  • Learn Python/ Django
  • Learn Ruby/ Rails

Blog Related:

  • Move to an Independent host.
  • Create my own design for this blog.
  • Learn WordPress theming structure


  • Learn and make Facebook applications

And find/ make a To do widget to put all those Todos  in 🙂 I’d rather actually call it “My to learn list”.

Stay tuned 😉