Elgg Tips

ELGG

1. The way of giving URL in elgg_echo :

1 . \”{$vars[‘url’]}everyone.php?offset=$offset\”

For Example :

$area2 .= elgg_echo( “<a href=\”{$vars[‘url’]}everyone.php?offset=$offset\”>more</a>” );


2 . $url_to_wire = $vars[ ‘url’ ] . “pg/thewire/” . $vars[ ‘entity’ ]->username ;

echo “<a class=\”status_update\” href=\”{$url_to_wire}\”>update</a>” ;

2.The way of giving div tag in PHP :

1 . echo “<div class=\”content\”>” ;

echo “name” ;

echo “<a href=’ ‘> Vijayakumar </a>” ;

echo “</div>” ;

See Examples :

1 . Javascript related : mod/thewire/views/default/thewire/activity_view.php

 

Keywords :

1 . get_context( );  –>  It returns the name of the plugin . It is used to check in if condition.

2 . $vars[ ‘title’ ];   –> It returns the title of the page.

3 . $vars[ ‘url’ ];  –>It returns the URL of the page.

4 . $_SESSION[ ‘user’ ]->name ; –>  The name of the loggedin user in elgg.

 

Count  – items

1 . How to count the no of items in Elgg :

$countitem = elgg_get_entities(array(‘types’=>‘object’ , ‘subtypes’=>‘thewire’ , ‘offset’=>$offset , ‘limit’=>$limit));

$count = count($countitem);

echo $count;

2 . count the no of items for particular user :

$countitem = elgg_get_entities(array(‘types’=>‘object’,‘subtypes’=>‘thewire’,‘owner_guid’=>$page_owner>getGUID(),‘limit’=>$limit,‘offset’=>0));

$count = count($countitem);

echo $count;


Count -Users

1 . How to know the no of registered users in elgg , count the users :

echo get_number_users();

It displays the no of registered users in Elgg . It is very useful when we need to count the users..

2 . How to find the online users :

echo get_online_users();

Search the user in Elgg :

How to fetch the one user in Elgg :

list_user_search(“abc”) –> It displays the user whose name is abc.

This function is very useful in search one user in the form of ,

$tag=get_input(‘tag’);

list_user_search(‘$tag’);

 

Limit the String length  in Elgg :

 

elgg_get_excerpt( $text, $num_chars = 40);

It will limit the no of characters in $text to 40 and … is added at the end if it is more than 40.

 

 

 

  1. Chinna
    May 17, 2011 at 10:19 am

    nice…

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: