Posts

Showing posts from June, 2014

PHP explode() Function

Definition and Usage The explode() function breaks a string into an array. Note: The "separator" parameter cannot be an empty string. Note: This function is binary-safe.
Example Break a string into an array: <?php $str = "My name is KC Verma"; print_r (explode(" ",$str)); ?>
Result - Array ([0] => My [1]=>name [2]=> is [3]=> KC [4] => Verma) Syntax explode(separator,string,limit)
ParameterDescriptionseparatorRequired. Specifies where to break the stringstringRequired. The string to splitlimitOptional. Specifies the number of array elements to return.Possible values:
Greater than 0 - Returns an array with a maximum of limit element(s)Less than 0 - Returns an array except for the last -limit elements()0 - Returns an array with one element

Entities (Major difference between Drupal 6 and Drupal 7)

Image
Entities Maybe you've heard of "entities" in Drupal 7, wondered what they were, and wanted to learn the underlying concepts. Leveraging the Entity API lets you create more lightweight and flexible solutions. The Drupal community often compares site building through configuration to a favorite childhood toy: LEGO bricks. We can build Entity types, which can make Bundles, to which we can add Fieldsand then create Entities. This article explains the relationships between Entity types > Bundles > Fields > Entities. This was one of the most important changes of Drupal 7, and brought components from some well-loved contributed modules -- such as CCK -- into the core system. The illustration below shows some examples of Entity types included with Drupal 7, with some example entities:
Let’s take a closer look at these concepts. It’s sort of a chicken-and-egg thing, one doesn’t exist without the other. Entity types In earlier versions of Drupal, the field system was only…