



Setelah saya menulis Membuat Sitemap WordPress dengan Google Sitemap Generator. Kali ini saya akan membahas tentang bagaimana cara membuat file sitemap.xml. apa itu sitemap.xml…? sitemap.xml adalah sebuah file yang mengandung alamat-alamat url dari sebuah website yang dikirm ke seach engine sebagai acuan search engine untuk mencari content website.
untuk membuat file sitemap.xml bisa dengan mengetikkan satu persatu tetapi misalkan content website anda sudah ribuan artikel, apa anda mau menuliskan manual..?
di sini mau saya bahas sebuah class script php yang bisa secara otomatis akan membuat file sitemap.xml. berikut cara memasang class php script tersebut.
cara diatas adalah untuk membuat sitemap.xml secara custom dengan script php. jika anda menggunakan wordpress atau cms lain anda bisa menginstall pluginnya baca (Membuat Sitemap WordPress dengan Google Sitemap Generator). Selamat Mencoba




this script read the numeric and writing to the sentence. the data numeric can be covert using function. if you will use this function, you must call function with parameter included. output this script for indonesian format sentence…
terbilang.php
function Terbilang($x)
{
$abil = array("", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas");
if ($x < 12)
return " " . $abil[$x];
elseif ($x < 20)
return Terbilang($x - 10) . "belas";
elseif ($x < 100)
return Terbilang($x / 10) . " puluh" . Terbilang($x % 10);
elseif ($x < 200)
return " seratus" . Terbilang($x - 100);
elseif ($x < 1000)
return Terbilang($x / 100) . " ratus" . Terbilang($x % 100);
elseif ($x < 2000)
return " seribu" . Terbilang($x - 1000);
elseif ($x < 1000000)
return Terbilang($x / 1000) . " ribu" . Terbilang($x % 1000);
elseif ($x < 1000000000)
return Terbilang($x / 1000000) . " juta" . Terbilang($x % 1000000);
}
?>
using function :
$terbilang=terbilang(37);
echo $terbilang;
//output
//Tiga Puluh Tujuh




we have discused about dumping structure table into sql file before. now we can discus about dumping data table script using php.
this is a function to export table to data sql file :
| PHP Example : | |
function _mysqldump_table_data($table) { $sql=”select * from `$table`;”; if( $num_rows > 0) $field_type=array(); //print_r( $field_type); } if( $index < $num_rows-1) $index++; echo “\n”; |
|
Usage Example:
| PHP Example : | |
$con= mysql_connect ( “127.0.0.1″, “root”, “”);
die(); |
|
for usage, you must connect to the database, then calling _mysqldump_table_data(‘table’); and enter the table name into parameter function.
header(‘Content-type: text/plain’);
header(‘Content-Disposition: attachment; filename=”dumpdata.sql”‘);
header script used to create file sql and saved on your directory.




Sometimes you might need a function to create sql table structure to entire sql file . This function will help you do that.
this is a function to export table to structure sql file :
| PHP Example : | |
| <? function _mysqldump_table_structure($table) $sql=”show create table `$table`; “; } ?> |
|
Usage Example:
| PHP Example : | |
$con= mysql_connect ( “127.0.0.1″, “root”, “”);
die(); |
|
for usage, you must connect to the database, then calling _mysqldump_table_structure(‘table’); and enter the table name into parameter function.
header(‘Content-type: text/plain’);
header(‘Content-Disposition: attachment; filename=”dumpstructure.sql”‘);
header script used to create file sql and saved on your directory.




Author : Ravi Valmikam
this is script function import sql to the database
we have 2 function
1. mysql_import_file : simply imports a file as is
2. mysql_install_db : creates a given DB as well as imports a given SQL file for that DB
| PHP Example : | |
|
|
Usage Example:
| PHP Example : | |
|
|
this script is simple. you can try use on cake php by placing that function on your controller. you must call the function use $this->mysql_import_file(); if the script use on cake php controllers.




You can download the required files at RSS WRITER
Usage:
example:
$result = mysql_query(“select * from beritas ORDER BY DESC id limit 25″);
now, you can try this script. that is very simple. good luck………




<?
$day=(mktime (0,0,0,6,17,2009) – mktime (0,0,0,5,1,2009))/86400;
$day=floor($day);
echo $day;
?>




The Extensible Markup Language (XML) is a markup language much like HTML or SGML. This is recommended by the World Wide Web Consortium and available as an open standard.
XML is a portable, open source language that allows programmers to develop applications that can be read by other applications, regardless of operating system and/or developmental language.
preg_match_all( “/\<Envelope\>(.*?)\<\/Envelope\>/s”,
$xml, $bookblocks );
foreach( $bookblocks[1] as $block )
{
preg_match_all( “/\<Filename\>(.*?)\<\/Filename\>/”,
$block, $author );
preg_match_all( “/\<MessageType\>(.*?)\<\/MessageType\>/”,
$block, $title );
preg_match_all( “/\<Owner\>(.*?)\<\/Owner\>/”,
$block, $publisher );
echo( $title[1][0].” – “.$author[1][0].” – “.
$publisher[1][0].”\n” );
}
?>




bagi temen2 yang membutuhkan scrip barcode writer dengan php silahkan
terima kasih……………….
AUTHOR: Walter Cattebeke
DATE: 08-July-2004
EMAIL: cachiweb@telesurf.com.py
LICENSE: This code is free. You can use it and/or modify it.
I only want to be mentioned and notified if you intend to do either.




Creating a Class with Properties and Methods on PHP programming
example (contoh):
A class can be created using code similar to the following:
class Foo
{
var $foo;
var $bar;
function setBar ($bar)
{
$this->bar = $bar;
}
function getBar ()
{
return $this->bar;
}
}
This class has the following characteristics:
* The name of the class is ‘Foo’.
* It contains the variables (properties) ‘$foo’ and ‘$bar’.
* It contains functions (methods) called ‘setBar’ and ‘getBar’.
* Function ‘setBar’ is used to insert data into the object variable ‘$bar’.
* Function ‘getBar’ is used to retrieve data from the object variable ‘$bar’.
In theory you are supposed to have a ‘set’ method and a ‘get’ method for each variable within the class, one to put data in and the other to get data out. These are commonly referred to as ‘setters’ and ‘getters’.
Note here that the syntax $this->bar is used to reference an object variable from within that object. These variables can be referenced by any function/method within the class. The syntax $bar identifies a variable whose scope is limited to the current function only.
The ‘constructor’ method
A class can contain a special method known as a ‘constructor’ which is automatically processed whenever an instance of that class is created. In PHP 4 this is a method which has the same name as the class. This can be used to set initial data for the object, as shown in the following example:
class Foo
{
var $foo;
var $bar;
function Foo ()
{
$this->foo = ‘initial value for $foo’;
$this->bar = ‘initial value for $bar’;
}
}
In PHP 5 you can use the standard name __construct() as the constructor.
Extending a Class
It is possible to create a new class which ‘extends’ an existing class. By this I mean that you can inherit all the properties and methods of the existing class, and either provide alternative code for existing methods or add completely new methods. An example of how to do this is shown below:
require_once ‘foo.class.inc’;
class Bar extends Foo
{
var $tom;
var $dick;
var $harry;
function setTom ($tom)
{
$this->tom = $tom;
}
function getTom ()
{
return $this->tom;
}
}
Note that you have to include the definition of the parent class before you can extend it.
Class Bar is now an extension of class Foo. It has the following characteristics:
* It has all the properties and methods of class Foo plus some properties and methods of its own.
* If class Bar contained a method with the same name as a method within class Foo then the Bar method would replace the Foo method.
* If class Bar does not have a constructor of its own then the constructor in class Foo will be used instead.
Creating an Object
Now that we have created a class how do we use it? The first step is to create an instance of the class known as an object. Note that you must include the definition of the class before you can create an object from that class, as shown below:
include ‘foo.class.inc’;
$object = new Foo;
Here the object is called ‘$object’, but I could have used any name. Note that it is possible to create more than one object from the same class:
include ‘foo.class.inc’;
$tom = new Foo;
$dick = new Foo;
$harry = new Foo;
Accessing an Object’s Properties and Methods
In order to perform a method within an object you need to specify both the object name and the function name as in:
$result = $tom->setFoo(‘value’);
It is also possible to access an object’s properties directly without going through a method, as in:
$var = $tom->Foo;
$tom->Foo = $var;
Although this approach is perfectly valid I should point out that if at some time in the future you decide that it is necessary to do some extra processing on the data before it is moved in or out of your object then you will have to modify all those places where the data is referenced. On the other hand if you force all object properties to be accessed though a get or set method then you will only have to change the contents of that method just the once.
You may have noticed that when you are outside of an object and you want to access the object’s properties or methods you must specify the object’s identifier as in $tom-> or $dick-> or $harry->, but when you are inside an object you can use the magic word $this-> as the object identifier.
Objects and Sessions
You may or may not be aware that you can maintain data between the execution of one script and another by using PHP’s session capability. It is also possible to save an object’s properties in this session data so that it can be reinstated by the next script within the same session. You can save an object’s properties by using the serialize() command as follows:
include ‘foo.class.inc’;
$dbobject = new Foo;
…
…
$_SESSION['dbobject'] = serialize($dbobject);
In a subsequent script you can reinstate the object to exactly the same condition by using the unserialize() command like this:
include ‘foo.class.inc’;
if (isset($_SESSION['dbobject'])) {
$dbobject = unserialize($_SESSION['dbobject']);
} else {
$dbobject = new Foo;
} // if


More Options ...
Categories
Tag Cloud
Blog RSS
Comments RSS


Void « Default
Life
Earth
Wind
Water
Fire
Light 