Sunday, March 31, 2013

Image Upload from a URL Using Php

By PHP, you need to strip the path from a URL, leaving behind just the filename at the end of the URL. You can do this with a regular expression pattern of course, but I have a much simpler solution. See the example code below.

Get filename from a URL Using Php

 Example : 

 $url = "http://www.iconarchive.com//path/to/file/filename.php";

 $filename = basename($url);

 echo $filename; //filename.php

Thursday, March 14, 2013

Get Remote IP Address By Php Script

Hey Get the Visitor IP Address using Php Script.Just use below code for it.

The Code :

$ip = $_SERVER['REMOTE_ADDR'];
OR
$ip= $REMOTE_ADDR;
Here is sample code:
<?
$ip= $REMOTE_ADDR;
echo "<br> Your IP address : " . $ip;
echo "<br> Your hostname : " . GetHostByName($ip);
?>

Free Download Google Php Api

Free Download Google Plus Api for php,google api use to publish,login,get friends details,google plus,google bookmark,google weather api etc.


Download-Google Api

Tuesday, March 12, 2013

Add Css and Javascript In Joomla 2.5

Its Important How to add css ,javascript and jquery in joomla 2.5.Joomla is one of the most popular content management system and its also a freeware opensource.


See the below code to add css :



$document =& JFactory::getDocument();
$filename = 'style.css'; // this file is used for class="hasTip3"
    $path = 'modules/mod_guestbook/css/'; // path to the file
    JHTML::stylesheet($filename, $path);

www.starplus.in See the below code to add Js:



$js1 = 'jquery.js'; // this file is used for class="hasTip3"
    $js2 = 'dropmenu.js'; // this file is used for class="hasTip3"
    $path2 = 'modules/mod_guestbook/js/'; // path to the file
    JHTML::script($js1, $path2);
    JHTML::script($js2, $path2);
    


 



Wednesday, March 6, 2013

Run and Install Multiple Xampp Server

Here we Run Multiple Xampp Instance in single computer.one as main and another is a portable xampp server installed in another drive or usb drive.we use two xampp and mysql at a time.

Run Multiple Xampp Server

  • Run Two Xampp at single computer
  • Run Two Mysql Server
  • Use Two Database 

Step For Portable Xampp Configuration(Usb Xampp)

1) G:\xampp\apache\conf\httpd.conf: change code :
ServerName localhost:80 to 
ServerName localhost:8080 
Listen 80 to 
Listen 8080

2) change mysql port 
G:\xampp\mysql\bin\my.ini port = 3306 to port = 3333 
G:\xampp\php\php.ini mysql.default_port = 3306 to mysql.default_port = 3333

3) G:\xampp\apache\conf\httpd.conf: change ssl config:
 LoadModule ssl_module modules/mod_ssl.so to
 #LoadModule ssl_module modules/mod_ssl.so 
LoadModule rewrite_module modules/mod_rewrite.so
 to #LoadModule rewrite_module modules/mod_rewrite.so

4)connect database : localhost to localhost:3333 (mysql port)

 Xample to connect database :

Main Xampp

$my=mysql_connect("localhost","root","rootadmin"); mysql_select_db("test",$my); if($my) { echo "sucessfully connect-main(test)"; }

Portable Xampp

$m=mysql_connect("localhost:3333","root","rootadmin"); mysql_select_db("webauth",$m); if($m) { echo "sucessfully connect portable"; }

Tuesday, March 5, 2013

Ajax Inline Text Editor Script

AjaxEditor Is inline or place edit content.Ajaxeditor is Easy to customized,Easy to Implemented,No Loading (Ajax).Its completally jquery-ajax based codecanyon script.

Codecanyon : Ajax-text-editor Script

 

Codecanyon PHP Search Engine Script

Codecanyon PHP Search Engine Script and Code.Google like search engine or Global search engine by php script.Its very nice and amazing script.this search contain text,video,news,Web, Images Search. Search for .DOC, .XLS, .PDF and many more.

Codecanyon PHP Search Engine Script

 

Codecanyon Editme For Inline Edit

EditMe Is a Codecanyon Powerfull Jquery Plugins.editme hides the input field, shows a nice labeled of the data in the input field and adds an edit button.


Codecanyon-EditMe

Edit Me Contain Below Services :
  • edittext : The text in the edit link. Default is "edit"
  • removetext : The text in the remove link. Default is "remove"
  • removeable : Show the remove link? Default is "false" (use booleans)
  • savetext : The text in the save button. Default is "save"
  • canceltext : The text in the cancel link. Default is "cancel"
  • autosave : Pass the function you want to use, if you want to save the data using ajax. The function should accept ONE parameter (the data to save).

Saturday, March 2, 2013

Accessing the Database by JDatabase in Joomla

For Accessing Database in Joomla cms User this object  " $db = JFactory::getDBO();".The getDBO function usually automatic create database connection.please see the below example .

For database connection use :
 $db = JFactory::getDBO();

 For Execute sql or mysql query : 
setQuery($query) 
Example :
$query = "SELECT * FROM #__example_table WHERE id = 999999;";
$db->setQuery($query);
 
Fetch result from database use :

loadAssoc(): loadAssoc() returns an associated array from a single record in the table.

Example :

$db->setQuery($query);
$row = $db->loadAssoc();
print_r($row);

loadResult() : Use loadResult() when you expect just a single value back from your database query.

Example :

$db = JFactory::getDBO();
$query = "
  SELECT COUNT(*)
    FROM ".$db->nameQuote('#__my_table')."
    WHERE ".$db->nameQuote('name')." = ".$db->quote($value).";
  ";
$db->setQuery($query);
$count = $db->loadResult();

loadRow(): loadRow() returns an indexed array from a single record in the table.

Example :

$db->setQuery($query);
$row = $db->loadRow();
print_r($row);

loadObject(): loadObject returns a PHP object from a single record in the table.

Example :

$db->setQuery($query);
$result = $db->loadObject();
print_r($result);

loadResultArray() : loadResultArray() returns an indexed array from a single column in the table.

Example :

$query = "
  SELECT name, email, username
    FROM . . . ";
. . .
$db->setQuery($query);
$column= $db->loadResultArray();
print_r($column);

 

 

 

 

 

Get Site's Global Configuration in Joomla

The Global configuration in Joomla Administration.These global configuration are stored in the file "JoomlaBase/configuration.php".Sometimes it is required to get these global configuration in component,module,template or plugin.See below code foe get this details.

Getting a configuration object :

$config =& JFactory::getConfig();

Now getting the Value :

you need to get 'fromname'.It is present in the file "JoomlaBase/configuration.php".You can get 'fromname' by getValue() function as shown below.
$config->getValue( 'fromname' );

Get User Details In Joomla


Joomla is a Most Popular Opensource and Content Management System.In this blog we have to get current user details of joomla Login User.

Example code :
$user =& JFactory::getUser();
//print_r($user);
echo $user->username; 
 
Here JFactory is provides access to a group of core Joomla Objects. and  
$user =& JFactory::getUser(); Means Returns a reference to the 
global user object, only creating it if it 
doesn't already exist.  The object returned will be of type Juser.