Enter line break into mailto body

The body of a message must be encoded using the %0D%0A sequence

Eg;

mailto:name@domain.e_t?subject=Header&body=This is the first line%0D%0AThis is the second

white spaces also be replaced with the appropriate ASCII code which is %20

Eg;

mailto:name@domain.e_t?subject=Header&body=This%20is%20the%20first%20line%0D%0AThis%20is%20the%20second

Acces files from a specified Folder

$img_fold=”images/slideshow/banner/”;

<?php
        $i=0;
        $string =array();
        $filePath=$img_fold;  
        $dir = opendir($filePath);
        while ($file = readdir($dir)) {
           if (eregi(“\.png”,$file) || eregi(“\.jpg”,$file) || eregi(“\.gif”,$file) ) {
           $string[] = $file;
           }
        }
        while (sizeof($string) != 0){
            
          $img = array_pop($string);
          ?>
<li><img src=”<?php echo $filePath.$img; ?>” alt=”slide1″ title=”slide1″ id=”wows1_<?php echo $i; ?>”/></li>
<?php       $i=$i+1; }        ?>

modal module for joomla 1.5 website

create custom html and add contents ,what content you want display in modal its position is firstvisit

add this code to template index
<!–this code for open any new thenga kola–>
<script type=”text/javascript”>
function randamsubmit(){
    document.getElementById(‘hid’).value=1;
}
</script>
<?php
if($this->countModules(‘firstvisit’)) {
  if(!isset($_COOKIE[‘randam’])){
    if(isset($_POST[‘hid’])){ setcookie(“randam”, 0, time()+60*60*24*15);}else{ ?>
    <div id=”home_first_div”></div>
<style type=”text/css” >
#modal_main{
    width:400px;
    height:auto;
    border: 1px solid #ccc;
    padding:10px;
    box-shadow: 0pt 0pt 5px rgba(0, 0, 0, 0.3);
    background-color:#FFF;
    position:fixed;
    margin-top:-200px;
    margin-left:-200px;
    top:50%;
    left:50%;
    z-index:10002;
    }
#home_first_div {
    background-color: #EA83B5;
    height: 100%;
    opacity: 0.5;
    filter:alpha(opacity=80);
    position: fixed;
    width: 100%;
    z-index: 10001;
    /*display:none;*/
}

</style>

<div id=”modal_main”><form method=”post” onsubmit=”randamsubmit();”>
<input type=”image” style=”position: absolute; right: 0pt; top: 0px; width: 35px;” src=”images/stories/closeround.png” >
<input type=”hidden” id=”hid” name=”hid” value=”0″>
</form>
<jdoc:include type=”modules” name=”firstvisit” style=”raw” />
</div>

<?php }
}
}  ?>
<!–this code for open any new thenga kola–>

Joomla1.5 n 2.5 parameters types

Parameters type

select article modal
<param name=”id” type=”article” default=”0″ label=”Select Article” description=”An article” />

Text

<field name=”num_leading_articles” type=”text” default=”1″ label=”JGLOBAL_NUM_LEADING_ARTICLES_LABEL”
description=”JGLOBAL_NUM_LEADING_ARTICLES_DESC”>
</field>

Editor for Module
<param name=”contentofmodal” label =”Content Of Modal” type=”editor”  filter=”safehtml” width=”300″ height=”500″ />

add some codes in

<?php

// Check to ensure this file is within the rest of the framework

defined(‘JPATH_BASE’) or die();

class JElementMyeditor extends JElement

{

var $_name = ‘Myeditor’;

function fetchElement($name, $value, &$node, $control_name)

{

$editor = JFactory::getEditor();

$width  = $node->attributes(‘width’);

$height = $node->attributes(‘height’);

$col    = $node->attributes(‘col’);

$row    = $node->attributes(‘row’);

//  ($name, $html, $width, $height, $col, $row, $buttons = true, $params = array())

return $editor->display($control_name.'[‘.$name.’]’,

htmlspecialchars($value, ENT_QUOTES),

$width, $height, $col, $row,

array(‘pagebreak’, ‘readmore’) ) ;

}

}

Radio

<field name=”show_category_title” type=”radio”    label=”JGLOBAL_SHOW_CATEGORY_TITLE”
description=”JGLOBAL_SHOW_CATEGORY_TITLE_DESC” default=”1″ >
<option value=”0″>JHIDE</option>
<option value=”1″>JSHOW</option>
</field>

User List
<field name=”targetb” type=”list” label=”COM_CONTENT_URL_FIELD_B_BROWSERNAV_LABEL”
description=”COM_CONTENT_URL_FIELD_BROWSERNAV_DESC” class=”inputbox”>
<option value=”0″>JBROWSERTARGET_PARENT</option>
<option value=”1″>JBROWSERTARGET_NEW</option>
<option value=”2″>JBROWSERTARGET_POPUP</option>
<option value=”3″>JBROWSERTARGET_MODAL</option>
</field>

For Space

<field name=”spacer4″ type=”spacer”    hr=”true”    />

Component Layout

<field name=”category_layout” type=”componentlayout” label=”JGLOBAL_FIELD_LAYOUT_LABEL”
description=”JGLOBAL_FIELD_LAYOUT_DESC” menuitems=”true” extension=”com_content” view=”category” />

Acces Permission (acl)

<field name=”rules” type=”rules” label=”JCONFIG_PERMISSIONS_LABEL” class=”inputbox” validate=”rules”
filter=”rules” component=”com_content” section=”component” />

Category drop down for article admin

<field name=”catid” type=”categoryedit” label=”JCATEGORY” description=”JFIELD_CATEGORY_DESC” class=”inputbox” required=”true” >
</field>

Editor in article

<field name=”articletext” type=”editor”
label=”COM_CONTENT_FIELD_ARTICLETEXT_LABEL” description=”COM_CONTENT_FIELD_ARTICLETEXT_DESC”
filter=”JComponentHelper::filterText” buttons=”true” />

Calendar

<field name=”created” type=”calendar” label=”COM_CONTENT_FIELD_CREATED_LABEL”
description=”COM_CONTENT_FIELD_CREATED_DESC” size=”22″ format=”%Y-%m-%d %H:%M:%S” filter=”user_utc” />

User

<field name=”created_by” type=”user”    label=”COM_CONTENT_FIELD_CREATED_BY_LABEL” description=”COM_CONTENT_FIELD_CREATED_BY_DESC” />

Multiple Users

<field name=”multiauthor” type=”sql” query=”SELECT id ,name FROM #__users” multiple=”multiple” key_field=”id” value_field=”name” label=”Multiple Authors” description=”Select Multiple users in case of more than one author for an article” onchange=”javascript:quotePricing(this);”/>

Texta Area

<field name=”metakey” type=”textarea”
label=”JFIELD_META_KEYWORDS_LABEL” description=”JFIELD_META_KEYWORDS_DESC”
class=”inputbox” rows=”3″ cols=”30″ />

Access Level

<field name=”access” type=”accesslevel” label=”JFIELD_ACCESS_LABEL” description=”JFIELD_ACCESS_DESC” size=”1″ />

Input Box

<field name=”alternative_readmore” type=”inputbox” label=”JFIELD_READMORE_LABEL” description=”JFIELD_READMORE_DESC”
class=”inputbox” size=”25″ />

Hidden

<field name=”show_parent_category” type=”hidden” label=”JGLOBAL_SHOW_PARENT_CATEGORY_LABEL”
description=”JGLOBAL_SHOW_PARENT_CATEGORY_DESC”>
</field>

Open Media

<field    name=”image_intro”    type=”media”    label=”COM_CONTENT_FIELD_INTRO_LABEL”    description=”COM_CONTENT_FIELD_INTRO_DESC” />

Url

<field    name=”urla” type=”url”    validate=”url”    filter=”url”  label=”COM_CONTENT_FIELD_URLA_LABEL”    description=”COM_CONTENT_FIELD_URL_DESC” />

Standard form field types/Single-page reference

http://docs.joomla.org/Standard_form_field_types/Single-page_reference

http://docs.joomla.org/Standard_form_field_types

Simple Browser detection

/* browser detection code defenition*/
function browser_info($agent=null) {
$known = array(‘msie’, ‘firefox’, ‘safari’, ‘webkit’, ‘opera’, ‘netscape’, ‘konqueror’, ‘gecko’);
$agent = strtolower($agent ? $agent : $_SERVER[‘HTTP_USER_AGENT’]);
$pattern = ‘#(?<browser>’ . join(‘|’, $known) .
‘)[/ ]+(?<version>[0-9]+(?:\.[0-9]+)?)#’;

if (!preg_match_all($pattern, $agent, $matches)) return array();
$i = count($matches[‘browser’])-1;
return array($matches[‘browser’][$i] => $matches[‘version’][$i]);
}
/* browser detection code defenition*/

 

Function call

$ua = browser_info();
foreach ($ua as $ind=>$vars){

if ($ind==’firefox’){
$ind=’Mozilla Firefox’;
}
else if($ind==’msie’){
$ind=’MS Internet Explorer’;
}
else if($ind==’safari’){
$ind=’Google Chrome/Safari’;
}

}

$browser=$ind.” “.$vars;

out put:

Mozilla Firefox 10.0

MSSQL get data from table with limit property

MSSQL not supporting LIMIT property, we can use this for 

$query1=”WITH OrderedOrders AS
(SELECT top 100 c.id as blg_id,c.title as post_title,c.introtext as post_content,c.created_by,c.publish_up as post_date,ROW_NUMBER() OVER (ORDER BY c.id) AS ‘RowNumber’ FROM jos_content as c INNER JOIN jos_categories as d on c.catid=d.id where d.parent_id=89 AND c.state=1 ORDER BY c.id DESC)
SELECT * FROM OrderedOrders WHERE RowNumber BETWEEN 50 AND 100;”;

joomla 2.5 get user name from users table

get user name from jos_users table of joomla 2.5 

 

$query = $db->getQuery(true);
$query->select(‘TOP ‘.$no_top_row.’ c.id as blg_id,c.title as post_title,c.introtext as post_content,c.created_by,c.publish_up as post_date’);
$query->from(‘#__content as c’);
$query->innerJoin(‘#__categories as d on c.catid=d.id’);
$query->where(‘d.parent_id=89 AND c.state=1’);
$query->order(‘c.id DESC’);
$db->setQuery($query,0);
$result_top = $db->loadObjectList();

 

foreach ($result_top as $results){

//$author_names =& JFactory::getUser($results->created_by);
$author_names->name

}