Thursday, February 24, 2011

ENCODUNG Concepts

JAVASCRIPT Alert in phpcode
--------------------------------
here you can give the alert message";
$string = mb_convert_encoding($string, 'UTF-7');
echo htmlentities($string);
?>

Friday, September 17, 2010

types of plugins in joomla

Hi

In Joomla there the following types of plug-ins or available



authentication: (/plugins/authentication)
---------------
This plugin allows to login and other authentication related stuffs

content : (/plugins/content)
--------
This plugin can use to modify or add the features to the content

Editor : (/plugins/editor)
-------
This allow to create the editors

System (/plugins/system)
-------
PHP based operations can be handled by this

Friday, August 6, 2010

Language Conversion in JS

<script type="text/javascript">

function languageswitch(){

var url=window.location.href;

if(url.indexOf('\/en\/')>0){

url=url.replace('\/en\/','\/de\/');

url=url.replace('\/en_','\/de_');

}else if(url.indexOf('\/de\/')>0){

url=url.replace('\/de\/','\/en\/');

url=url.replace('\/de_','\/en_');

}

window.location.href=url;

}

</script>

ex:
http://damublog.blogspot.com/en
http://damublog.blogspot.com/de

Wednesday, March 24, 2010

Regular expression

remove the img tag from the given content
========================================
$content = "this is something with an image tag here in it.";
$content = preg_replace("/]+\>/i", "(damu) ", $content);
echo $content;

die();
?>

Tuesday, June 9, 2009

Joomla plugins 1

Plugin types :

  • authentication
  • content
  • editors
  • editors-xtd
  • search
  • system
  • user
  • xmlrpc
File system:

your can create your own type by adding a new folder under /plugins/. So, files for an authentication plugin will be saved under /plugins/authentication/, files for a system plugin will be saved under /plugins/system/, and so on.

SAMPLE FOR THE SYSTEM PLUGIN :

he skeleton test.php has the following source:

?>

text.



System - Test
Author
Month 2008
Copyright (C) 2008 Holder. All rights reserved.
GNU General Public License
email
url
1.0.1
Damu A test system plugin

test.php


type="text"
default=""
label="Example"
description="An example text parameter" />





Installation Make

create the zip file with this two files and try to upload from the joomla admin pannel in the install area to install this zip file after that its the fiels are under the plugin/system/test.php , plugin/system/test.xlm like its present .

Friday, February 1, 2008

PHP HIDDEN FUNCTIONS

String Functions:
==============
1. stream_filter_append:
~~~~~~~~~~~~~~~~
syntax:
resource stream_filter_append ( resource stream, string filtername [, int read_write [, mixed params]] )

desc:
Attach a filter to a stream for example u want to write the content inside one file under some filter condition (only lowercase /upper case/strip tags )

ex:

$fp = fopen('php://output', 'w');
stream_filter_append($fp, 'string.toupper');
fwrite($fp, "This is a test.\n");
/* Outputs: THIS IS A TEST. */
//stream_filter_append($fp, 'string.toupper');
//stream_filter_append($fp, 'string.tolower');

=========================================================

Thursday, November 22, 2007

Tricks and tip in ..htaccess. .. (php)

1) Create Our own Error Code display page.. like "404 pagenot found"

For example, if you want a web page called 404.html to replace the default error page, put the following line in your .htaccess file:

ErrorDocument 404 /404.html

You can do the same with other error codes. make sure ur mentioned file are having in your root folder.

error document in apache see the link http://httpd.apache.org/docs/1.3/mod/core.html#errordocument

2) coming soon...

Tuesday, November 20, 2007

Xml Parsing..

XML INVOKING....
To get the xml from the feed...
function :
//call the function ..

getXml("www.dwmu/feedxml/");

function getxml($url)
{
$ch = curl_init(); // Initialize the curl session..

curl_setopt($ch,CURLOPT_URL,$url);

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

$xmlval = curl_exec ($ch);

curl_close ($ch);

return $xmlval ; // now the full xml is return here ....

}
?>



Sample Xml structure..
================


How to parse the xml...? (above sample ) and get the valuse for the particular jobid .

$xmlobj = -->now consider the full xml is in the is ($xmlobj)variable . now ready to parse.

step1:
pass this xml and jobid into one function as ur own ..

parsexml($xmlobj,$id); //call the function

step2:
write a function to pars the xml

function parsexml($xmlobj,$id){
$xml = new SimpleXMLElement($xmlobj);

// damu get the "" for particular job id.............s...
$i=0;
foreach($xml->job as $listing){
if($xml->job[$i]->attributes() == $id){
$name = $listing->name;
$description = $listing->description;
$rollupdeptname = $listing->dept_name;
$qualification = $listing->qualification;
$location = $listing->location;
$email = $listing->email;
$postdate = $listing->postdate;
break;
}
$i++;
}
$jobdeails = array($name,trim($description),$rollupdeptname,$qualification,$location,$email,$postdate);
return $jobdeails;
}

now the xml is parsed and save inside the
$jobdeails array.

Wednesday, October 31, 2007

Put RSS Feed to ur web site

hi friends ..

u want to add a Rss feed to your web page mens do the following steps collect the details from database and create xml file using the following steps


step1:
create a database ..ex:

CREATE TABLE `book_store` (
`book_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`title` VARCHAR( 20 ) NOT NULL ,
`description` VARCHAR( 100 ) NOT NULL ,
`price` INT NOT NULL
) ENGINE = MYISAM ;


to be continuee...