Friday, June 29, 2007

Define a new block in drupal

open          "site_base"/ template/"template_name"/template.php
function themeName_regions()
{
return array(
"left"=>t("left sidebar"),
"right"=>t("right sidebar"),
"newRegion"=>t("human readable name for the region");
)

}

you must edit theme file(Especially page.tpl.php) for outputing  "newRegion"

Thursday, June 28, 2007

how to acces latest 6 youtube video

<?php $youtube_user="gave here ur user name; ?>
<a href='http://flashandburn.net/youtubeBadge/<?php echo $youtube_user ?>/goto'><img border="0" src=' http://flashandburn.net/youtubeBadge/<?php echo $youtube_user ?>/logo:1-color:000000/recent.png'></a>

Wednesday, June 27, 2007

first 10 fotos tagged as per ur search # same component in yahoo cities

<?php
require_once("phpFlickr.php");
// Create new phpFlickr object
$f = new phpFlickr("2d9926bbd0237c88d2a2f77c1e348f83");

$tag = $f->photos_search(array("tags"=>"kannur", "tag_mode"=>"any","per_page"=>7));
$total_flickrpage=$tag["pages"];
$tag =$f->photos_search(array("tags"=>"kannur", "tag_mode"=>"any","per_page"=>7,"page"=>rand(1,$total_flickrpage)));

$i=0;
while($i<(6))
$i=0;
while($i<20)
{

$farm=$tag["photo"][$i]["farm"];
$serv=$tag["photo"][$i]["server"];
$xid=$tag["photo"][$i]["id"];
$secre=$tag["photo"][$i]["secret"];

$p_url="http://farm".$farm.".static.flickr.com/".$serv."/".$xid."_".$secre."_s.jpg";
print $tag["photo"][i]["farm"];
$i=$i+1;
#print "<hr>http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}.jpg ";

print "<img border='0' src=".$p_url."> </img>";}


?>

--
regards

sajjad.c

Portal Theme

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
     
    <link rel="stylesheet" type="text/css" href="<? print base_path().path_to_theme()?>/ext/resources/css/ext- all.css" />
    
    <!-- LIBS -->     <script type="text/javascript" src="<? print base_path().path_to_theme()?>/ext/yui-utilities.js"></script>     <script type="text/javascript" src="<? print base_path().path_to_theme()?>/ext/ext- yui-adapter.js"></script>     <!-- ENDLIBS -->
 
    <script type="text/javascript" src="<? print base_path().path_to_theme()?>/ext/ext-core.js"></script>
    <script type="text/javascript" src="<? print base_path().path_to_theme()?>/ext/package/util.js"></script>
    <script type="text/javascript" src="<? print base_path().path_to_theme()?>/ext/package/tabs/tabs.js"></script>
 
    <!-- Tabs Example Files -->
  
 <script  language="javascript" type="text/javascript">

 
<?php
 $voc=taxonomy_get_vocabularies();

  foreach($voc as $vocab)
     {
          if($vocab->vid!=4)
        {
        print("\n var Tab".$vocab->vid."Example = { \n init : function() \n  {");
         print("\n var tab".$vocab->vid."= new Ext.TabPanel('tab".$vocab->vid."'); \n");
       $arrx=taxonomy_get_tree($vocab->vid, $parent = 0, $depth = -1, $max_depth = NULL);
        $activate=True;
       
      foreach ($arrx as $arry)
         {
          print("tab".$vocab->vid.".addTab('".$arry->name."','".$arry->name."'); \n");
         if($activate)
             {
             print("tab".$vocab->vid.".activate('".$arry->name."'); \n");
            $activate=False;
            }
         }
     print("}} \n Ext.EventManager.onDocumentReady(Tab".$vocab->vid."Example.init, Tab".$vocab->vid."Example, true); \n");
   

     }
    }
?>
 



</script>
 
    <!-- Common Styles for the examples -->
<style>

<?php
$voc=taxonomy_get_vocabularies();

 foreach($voc as $vocab)
    print("\n #tab".$vocab->vid." {width:400px;} \n #tab".$vocab->vid." .x-tabs-item-body {display:none;padding:10px; font-size: 15px}");

?>


</style>
<! -----------------------coding related to  Go  Flexible----------------------->
<title> <?php print $head_title ?> </title>
<?php print $styles ?>
</head>
<body>
<div id="wrap">
    <div id="header-section">
            <h1> <?php print $site_name ?> </h1>
            <img id="header-background-right" src=" http://localhost/~space/img/theyyam.jpg" alt=""/>
           
    </div>
<div id="header">
        <ul>
                    <li><a href=<?php print "'".$base_path."'"?>>Home</a></li>

             <li><a href=<?php print "'".$base_path."/?q=en/taxonomy/term/2'"?>>Woman</a></li>
            <li><a href=<?php print "'".$base_path."/?q=en/taxonomy/term/3'"?>>Employment</a></li>
                 </ul>
        </div>

<?php if($sidebar_left):?>
        <div id="left-column">
             <div id="treeDiv1"></div>
            <?php print $sidebar_left ?>
           
        </div>
    <?php endif;?>
<div id="middle-column">

<p>
 
 
 

<?php




    $voc=taxonomy_get_vocabularies();
    foreach($voc as $vocab)
    {
      print("<div id='tab".$vocab->vid."'>");
      $arrx=taxonomy_get_tree($vocab->vid, $parent = 0, $depth = -1, $max_depth = NULL);
      foreach ($arrx as $arry)
        {
        print( "<div id='".$arry->name."' class='tab-content'><ul>");
        $res=taxonomy_select_nodes(array($arry->tid), $operator = 'and', $depth = "all", $pager = TRUE, $order = ' n.created DESC');
        while( $ans=$res->fetch_array())
            {
            print("<li><a href='".$base_path."?q=en/node/$ans[nid]'> $ans[title]</a></li>");            }               
               
        print("</ul></div>");
        }
    print"</div>\n";
 }
   
?>           

   
      </div>
<?php if($sidebar_right):?>
         <div id="right-column">
           
                             <?php print $sidebar_right ?>
           
        </div>
    <?php endif; ?>    
<div id="footer">
            <?php print $footer_message ?>
    </div>
         

 
    
</body>
</html>
 

disable Directory listing


<Directory "directorypath">
Options -Indexes
Options FollowSymLinks
AllowOverride None
</Directory>

Thursday, June 21, 2007

How to reset drupal admin password


update users set pass=md5('NEWPASS') where uid = 1;

NB:admins user id is 1

Wednesday, June 20, 2007

Add type in Windows php


Add the line at the end as
    LoadModule php5_module "c:/php-5.0.2-Win32/php5apache2.dll"

Search for AddType and insert the following lines
    #AddType application/x-tar .tgz
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .phtml .php
    AddType application/x-httpd-source .phps

Configure the path to php.ini
PHPIniDir "C:/php-5.0.2-Win32"
Start Apache Server
--
regards

sajjad.c

Sunday, June 17, 2007

Best joomla templates

open_business
JA Sabina
open_salon
vista
Warmish

Friday, June 01, 2007

Malayalam transilitation plug in for TinyMCE

Malayalam transilitation plug in for TinyMCE
---------------------------------

This plugin adds a അ  button to TinyMCE.

1 Installation Instructions
-------------------------

1.1 for TinyMCE
-----------

   1. Copy the malayalam  directory to the plugins directory of TinyMCE (/jscripts/tiny_mce/plugins).
   2. Add plugin to TinyMCE plugin option list example: plugins : "malayalam".
   3. Add the button name to button list, example: theme_advanced_buttons3_add : "malayalam".


   1.1.a.Initialization Example
   ----------------------
    tinyMCE.init({
        theme : "advanced",
        mode : "textareas",
        plugins : "malayalam",
        theme_advanced_buttons3_add : "malayalam"
         });

1.2 for Drupal
------------
    1. Copy the malayalam  directory to the plugins directory of TinyMCE in drupal 
        drupal_directory/modules/tinymce/tinymce/jscripts/tiny_mce//plugins/

    2. edit drupal_directory/modules/tinymce/plugin_reg.php
         add this code snippet before  return $plugins;

        $plugins['malayalam'] = array();
        $plugins['malayalam']['theme_advanced_buttons2'] = array('malayalam');
    3  goto Administrator->siteconfiguration->TinyMCE
            edit any profile in the list
        in  buttons and plugins ,enable  അ malayalam button



2.How to use
------------
    2.1 Basic application usage
    ----------------------------
    After installation malayalam  plug in,TinyMCE has two modes of typing . English mode and Malayalam mode. if u will click The അ button, TinyMCE mode  is toggled between malayalam and english.
        This application used basic transilitation methode
          for keycombination  and other deatils
        http://adeign.googlepages.com/ilamozhi.html
    2.2 WYSIWYG Editor usage
    ------------------------
        Formatting done only  after all the text typed in TinyMCE
3. Bug Report and code modification
-----------------------------------
    3.0  space website(www.space-kerala.org)
    3.1  blog article for this plug in(http://lifekamazza.blogspot.com)
    3.2  through email( csajjad AT gmail.com)
4.License
---------
    Gnu Public License

firefox and IE on keyup

http://tinymce.moxiecode.com/punbb/viewtopic.php?id=6788