Tag Archives: PHP

Drupal Bullet Points


I have used Drupal in 2008-2010 and worked on Drupal5 and Drupal6.

I am just collecting some keywords during my learning.

Drupal
Node
Content
Content Type
CCK
users
annonomouse user
logged in user
Roles and Permissions
role based permission
Single Sign on
blocks
modules
drupal plugin software
hook system
extensible
event driven system.
Drupal core
Drupal contributed
menus
menu paths
Drupal pages
Drupal index.php
clean urls
themes
site configutaiion..
error reporting…
status report
cron
performance
caching

Now I am not using Drupal, but which my work. This framework was awesome for CMS structure.

Happy Drupal.

Advertisements

Drupal Interview Questions


So while working with Drupal Projects in my previous company. Me and my team prepared some Drupal Interview Question. This does not have everything but this will be for 1st round for sure. If you know these many question then I think you know Drupal For Sure.

Here is the list which is basic Drupal Questions.

  • Drupal Basics – Node, Module, Teaser, theme, Path, taxonomy, Patch, Region, Block, Menu
  • Installation of Drupal, steps and how to upload it on the live site from the local Machine.
  • Core Module in Drupal, their Names and their Functionalities.
  • Hook, Node Concepts
  • Functions and their Functionalities for – t() Function, l() function, Watchdog functions etc
  • Theme System in Drupal.
  • Themes and Theme Templates.
  • Theme Engines (Interface between the Drupal Core and the theme template).
  • Theme Hooks (Provide a way of interaction between the Modules and theme)
  • Theme Template structure and different sections as Page.tpl.php, node.tpl.php, block.tpl.php, box.tpl.php, etc
  • Derivative themes or Sub themes or Theme inheritance concepts that came into existence in Drupal 6, about it and its functionalities.
  • Steps to create a derivative theme and how to move for creating the theme from Derivative themes to a new theme right from scratch.
  • Theme function.
  • Where the Drupal theme functions are defined?
  • How the Drupal Theme functions can be overridden.
  • How to Implement the AJAX Effects on the Block modules in Drupal 6
  • Theme registration and the concepts in Drupal 6.
  • CCK modules and its importance with major functionalities.
  • How to create a Module.
  • How to insert the database table schema from the Modules when they are installed and remove the table scheme when they are un-installed (modules.)
  • User, Permission, Role in Drupal
  • How the Drupal database works?

Please give comments for more Drupal Questions.

Long back I have shard my PHP Interview Questions also.

Happy Programming.

Symfony Criteria for table alias with join of same table


Symfony Criteria for table alias and join a quick example.

Yesterday got a good situation, A kind of join with same table and with table alias.
I need to use the first query with symfony criteria.

I got this, hope this will be usefull to you too.

SELECT u1.USR_FNAME AS a, u1.USR_LNAME AS b, u2.USR_FNAME AS c, u2.USR_LNAME AS d, u3.USR_FNAME AS e, u3.USR_LNAME AS f
FROM tbl_test
LEFT JOIN tbl_users u1 ON ( tbl_test.TEST_USER1_ID = u1.USR_ID )
LEFT JOIN tbl_users u2 ON ( tbl_test.TEST_USER2_ID = u2.USR_ID )
LEFT JOIN tbl_users u3 ON ( tbl_test.TEST_USER3_ID = u3.USR_ID )
ORDER BY tbl_test.TST_ID ASC
LIMIT 10
$c = new Criteria();
   	$c->clearSelectColumns();
   	$c->addAlias('u1','tbl_users');
   	$c->addAlias('u2','tbl_users');
    $c->addAlias('u3','tbl_users');
   	$c->addSelectColumn(TblProjectPeer::TST_NAME);
   	$c->addAsColumn('a','u1.USR_FNAME');
   	$c->addAsColumn('b','u1.USR_LNAME');
    $c->addAsColumn('c','u2.USR_FNAME');
    $c->addAsColumn('d','u2.USR_LNAME');
  	$c->addAsColumn('e','u3.USR_FNAME');
   	$c->addAsColumn('f','u3.USR_LNAME');
   	$c->addJoin(TblTestPeer::TEST_USER1_ID,'u1.USR_ID',Criteria::LEFT_JOIN);
   	$c->addJoin(TblTestPeer::TEST_USER2_ID,'u2.USR_ID',Criteria::LEFT_JOIN);
  	$c->addJoin(TblTestPeer::TEST_USER3_ID,'u3.USR_ID',Criteria::LEFT_JOIN);

Or take another example

SELECT a.id FROM article a RIGHT JOIN article b ON a.article_id = b.id ORDER BY a.name DESC, b.date DESC
$c=new Criteria();
$c->addAlias('a', 'article');
$c->addAlias('b', 'article');
$c->addSelectColumn('b.id');
$c->addSelectColumn('a.article_id');
$c->addDescendingOrderByColumn('a.name');
$c->addDescendingOrderByColumn('b.date');
$c->addJoin('a.arcticle_id','b.id','RIGHT JOIN');
$rs = ArticlePeer::doSelectRS($c);  

Happy Programming. 😎

PHP & MySQL quick search bookmarklets


If you want to quick search to MySQL, here is the fast quick bookmarklet

javascript:q=document.getSelection();
if(!q)void(q=prompt('MySQL%20Keyword:',''));
if(q)location.href='http://search.mysql.com/search?q='+escape(q)

And the same goes for PHP too same like above…

javascript:term=document.getSelection();
if(!term)void(term=prompt('PHP%20Keyword:',''));
if(term)location.href='http://in2.php.net/'+escape(term)

Happy Programming. 😀

quick symfony tips.


I am learning symfony. Just got some good tips to share with you.
Symfony rocks. 🙂

I will update this regularly.

1> How to write OR condition query in symfony.
$c = new Criteria();
$c->clearSelectColumns();
$c->addSelectColumn(TablePeer::TBL_ID);
$cton1 = $c->getNewCriterion(TABLEPEER::TBL_ID1, $some_condition , Criteria::EQUAL);
$cton2 = $c->getNewCriterion(TABLEPEER::TBL_ID1, $some_condition , Criteria::EQUAL);
$cton1->addOr($cton2);
$c->add($cton1);

2> How to get query where first date greater then and less then last date.
$date1 = date('Y-m-d 00:00:00');
$date2 = date('Y-m-d 23:59:59');
$cton1 = $gUser->getNewCriterion(TABLEPEER::TBLE_CREATEDAT, $date1, Criteria::GREATER_EQUAL);
$cton1->addAnd($gUser->getNewCriterion(TABLEPEER::TBLE_CREATEDAT, $date2, Criteria::LESS_EQUAL));
$gUser->add($cton1);

3> how to run the update query in symfony.

“update table TableName set TableField1=’1′ where TableField2=$some_value.”

$update = new TableName();
$update->setNew(false);
$update->setTableField1(1);
$update->setTableField2($imageId); // this is primary key of the table. include this line.
$update->save();
?>

technorati tags:
, , , , Continue reading

Find last day of the month in PHP


Yday I was working with dates and got the situation to get the last day of the month so got this piece of code.

date(’Y-m-d’,strtotime(’-1 second’,strtotime(’+1 month’,strtotime(date(’m').’/01/’.date(’Y').’ 00:00:00′))));

And this piece of code will gv you the last day of the your corrent month. 

tags: , , ,

%d bloggers like this: