Example #1
0
otherwise default to 0.  They are 'unknown1' and 'unknown2'.</p>


<h3>Example</h3>

<?php 
ShowExample('
// Create an instance of the class
$pdb = new PalmDatebook();

// Create a repeating event that happens every other Friday.
// I want it to be an all-day event that says "Pay Day!"
$Repeat = array(
   "Type" => PDB_DATEBOOK_REPEAT_WEEKLY,
   "Frequency" => 2,
   "Days" => "5",
   "StartOfWeek" => 0
);
$Record = array(
   "Date" => "2001-11-2",
   "Description" => "Pay Day!",
   "Repeat" => $Repeat
);

// Add the record to the datebook
$pdb->SetRecordRaw($Record);

// Advance to the next record just in case we want to add more events
$pdb->GoToRecord("+1");
');
StandardFooter();
Example #2
0
<dl>

<dt><b>ConvertToText()</b></dt>
<dd>Returns the code as a giant string, which can be saved to a regular
file.  This also adds the <tt>#sec:</tt> tags to allow simple conversion
back to Palm OS format.</dd>

<dt><b>ConvertFromText($String)</b></dt>
<dd>Takes the .BAS file and converts it to the internal Palm OS format.  It
also splits apart the <tt>#sec:</tt> sections into separate records.</dd>
<dd>$String = The entire contents of the file that you need converted.</dd>
<dd>Returns false on success.</dd>
<dd>If there is an error, returns an array of the [0] section number, [1] 
section name, and [2] the size of the section in bytes.</dd>

</dl>

<h3>Example</h3>

<?php 
ShowExample('
$contents = file("your_file.bas");
// You should check to make sure the file
// was loaded properly before proceeding
$contents = implode("", $contents);
$pdb = new PalmSmallBASIC("your_file.bas");
$pdb->ConvertFromText($contents);
$pdb->DownloadPDB("doc_test.pdb");
');
StandardFooter();
Example #3
0
<p>There are no utility functions defined yet.  Sorry.</p>

<h3>Record Format</h3>

<p>All records in a MobileDB database are arrays.  Since there are no
utility functions for manipulating records yet, it is suggested that you
do not create new MobileDB databases.</p>


<h3>Example</h3>

<p>This example is of poor quality since MobileDB support has just barely
been added.  It is better to load a MobileDB and then work on it instead of
trying to make one yourself.</p>

<?php 
ShowExample('
// Create an instance of the class
$pdb = new PalmMobileDB();

// Create a new record
$Record = array("one", true, 35);

// Add the record to the database
$pdb->SetRecordRaw($Record);

// Advance to the next record just in case we want to add more
$pdb->GoToRecord("+1");
');
StandardFooter();
Example #4
0
?>

<p>Spade is a <b>s</b>imple <b>ad</b>dress book <b>e</b>ditor, written by
Roman Schindlauer &lt;<?php 
HideEmail('roman', 'fusion.at');
?>
&gt;  It's
just getting started and shows a great deal of potential.</p>

<p>The current version is 0.1:</p>

<ul>
<li><a href="../tools/spade.tar.gz">Download</a></li>
<li><a href="spade/">Online Demo</a></li>
</ul>

<p><i>Warning:</i> Since people can edit the records however they see fit,
there might be vulgarity or other assorted nastiness.  Also, since Spade
is somewhat new, this might crash.  However, the database is cleared
nightly so problems will dissapear and any edits will eventually be lost.</p>

<p>I have made a couple changes to Spade so that it works without errors
on my setup, but the changes are very minimal.</p>

</ul>

<p>As quoted from his email to me:</p>

<?php 
ShowExample("\ni attached my Simple ADdressbook Editor (spade :). it expects php-pdb to\nbe a subdirectory, but this path can be changed at the top of index.php,\nas well as the path of the addressbook pdb file itself. the code is very\nbeta, so don't use your one and only pdb with it :) but actually, i\ndidn't have any critical problems concerning loosing data. if it reaches\na release-able stage and you think it fits into the source bundle, you\ncan of course include it! eventually this would be an incentive to make\nsomething real useful out of it!\n\nthere is no documentation included yet. if you click on a name of the\nfirst column, you can edit this record. a deleted record can be\nundeleted (unless synchronized yet). deleted and edited records are\nhighlighted in the list. there is an http-authentication included,\nuser=\"user\" and password=\"pwd\", both can be changed in auth.php. that's\nall, basically.\n\nregards,\nroman\n");
StandardFooter();
Example #5
0
ShowExample('
// Read Example
$pdb = new PalmTodoList();
$fp = fopen(\'./tdread.pdb\', \'r\');
$pdb->ReadFile($fp);
fclose($fp);

echo "Name: $pdb->Name<BR>\\n";
echo "Type ID: $pdb->TypeID<br>\\n";
echo "Creator: $pdb->CreatorID<br>\\n";
echo "Attributes: $pdb->Attributes<br>\\n";
echo "Version: $pdb->Version<br>\\n";
echo "ModNum: $pdb->ModNumber<br>\\n";
echo "CreationTime: $pdb->CreationTime<br>\\n";
echo "ModTime: $pdb->ModificationTime<br>\\n";
echo "BackTime: $pdb->BackupTime<br>\\n";
echo \'NumRec: \'.$pdb->GetRecordCount()."<br>\\n";
$recids = $pdb->GetRecordIDs();
$record1 = $pdb->GetRecordRaw($recids[0]);
$attrib = $pdb->GetRecordAttrib($recids[0]);
echo "record1 = $record1<br>\\n";
echo "Desc: " . $record1[\'Description\'] . "<br>\\n";
echo "Note: " . $record1[\'Note\'] . "<br>\\n";
echo \'Due Date: \' . $record1[\'DueDate\'] . "<br>\\n";
echo \'Cat: \' . $record1[\'Category\'] . "<br>\\n";
$categories = $pdb->GetCategoryList();
echo "NumCat = " . count($categories) . "<br>\\n";
foreach ($categories as $k => $v) {
  echo "categories[$k] = $v<br>\\n";
  foreach ($categories[$k] as $key => $val) {
    echo "  categories[$k][$key] = $val<br>";
  }
}
');
Example #6
0
<dt><b>GetCategoryList()</b></dt>
<dd>Returns an array containing the different categories.  See
SetCategoryList() for the format of the array.</dd>

<dt><b>SetCategoryList($data)</b></dt>
<dd>Sets the categories to what you specified.  $data is in one of two
different formats:</dd>
<dd><?php 
ShowExample('
// Easy way:
$data[$id] = "Name";

// Harder, but this is how GetCategoryList() returns data
$data[$index] = array(\'Name\' => "Name",
                      \'Renamed\' => false,
	   	      \'ID\' => 27);
		   
/* $index is a number from 0 to 15.
 * "Name" is the category\'s name
 * The Renamed flag is true/false.  Not sure what it does.
 * ID is the unique ID given to that category.
 */
');
?>
</dd>
<dd>Tips/Rules:<br>
<ul>
<li>The first category ($index = 0, 'ID' => 0) is reserved for the 'Unfiled'
category.  If you specify anything otherwise, it will be overwritten.</li>
<li>There's a maximum of 16 categories, including 'Unfiled'.  This means
that you only have 15 to play with.</li>
Example #7
0
discretion.</dd>

<dt><b>EraseDocText()</b></dt>
<dd>Erases all text from the document being generated.</dd>

<dt><b>GetDocText()</b></dt>
<dd>Returns a single string (potentially very large) that contains the entire
document's text.</dd>

</dl>

<h3>Example</h3>

<?php 
ShowExample('
$pdb = new PalmDoc("Doc Test");
$pdb->AddDocText("This is a test.
This is a test of the PHP-PDB DOC class.\\n");
$pdb->AddDocText("This is only a test.\\n");
$pdb->AddDocText("This DOC will be automatically compressed.");
$pdb->DownloadPDB("doc_test.pdb");
');
?>

<p>Another example is the <a
href="../samples/bookmark_test.php">Bookmark Test</a> that I use in order to
find out what bookmark types are supported with each DOC reader I have 
listed.</p>

<?php 
StandardFooter();
Example #8
0
ShowExample('
// How to read a database
$addr = new PalmAddress();
$fp = fopen(\'./address.pdb\',\'r\');
$addr->ReadFile($fp);
fclose($fp);
echo "Name: $addr->Name<br>\\n";
echo "Type: $addr->TypeID<br>";
echo "Creator: $addr->CreatorID<br>\\n";
echo "Attributes: $addr->Attributes<br>\\n";
echo "Version: $addr->Version<br>\\n";
echo "ModNum: $addr->ModNumber<br>\\n";
echo "CreationTime: $addr->CreationTime<br>\\n";
echo "ModTime: $addr->ModificationTime<br>\\n";
echo "BackTime: $addr->BackupTime<br>\\n";
echo "NumRec: ".$addr->GetRecordCount()."<br>\\n";
$recids = $addr->GetRecordIDs();
foreach ($recids as $ID) {
  $record = $addr->GetRecordRaw($ID);
  echo "Record $ID:<BR>";
  $attrib = $addr->GetRecordAttrib();
  echo "- Category: " . ($attrib & PDB_CATEGORY_MASK) . " = " .
    $addr->CategoryList[$attrib & PDB_CATEGORY_MASK][\'Name\'] . "<br>\\n";
  echo "- Private: " . 
    (($attrib & PDB_RECORD_ATTRIB_PRIVATE) ? "Yes" : "No") ."<br>\\n";
  echo " Fields:<br>\\n";
  foreach ($record as $reck => $rec) {
    echo "-- $reck => $rec<br>\\n";
  }
}
echo "Field Labels<br>";
$labels = $addr->GetFieldLabels();
foreach ($labels as $k => $v) {
  echo "$k = $v<br>";
}
');