PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




hw_insertanchors

Name

hw_insertanchors — Inserts one or more anchors into the text of a document.

Synopsis

string hw_insertanchors(, anchor_records, dest_records[, url_prefixes]);
int : ID of document into which to insert the anchors
array anchor_records: Array of anchor source object records
array dest_records: Array of anchor destination object records
array url_prefixes (optional): URL prefixes to use

Returns

TRUE on success; FALSE on error

Description

hw_insertanchors() inserts the anchors described by the object records in the anchor_records array into the document identified by doc_id . These object records must contain at least the attributes Position, TAnchor, and Dest. The anchor destinations are given by the object records contained in the dest_records array; these must contain at least the attributes ObjectID and Name. Both arrays must contain the same number of object records.

If the url_prefixes parameter is given, it must be an associative array containing the following five elements, with the value of each element giving the string prefix to prepend to links of the appropriate type. The required element keys are HW_DEFAULT_LINK, HW_IMAGE_LINK, HW_INTAG_LINK, HW_APPLET_LINK, and HW_BACKGROUND_LINK.

Version

PHP 4 since 4.0.4

Example

Example 509. Insert anchors into a text document

$doc = hw_new_document_from_file("ObjectRecord", "hw_testdocument.txt");
$sources = array("Position=0x0 0x9\nTAnchor=Src\nDest=0x5",
                 "Position=0x20 0x29\nTAnchor=Src\nDest=0x27");
$destinations = array("ObjectID=0x5\nName=FirstDestDoc",
                      "ObjectID=0x27\nName=SecondDestDoc");
$urlprefixes = array('HW_IMAGE_LINK' => 'images',
                     'HW_DEFAULT_LINK' => '',                     
                     'HW_APPLET_LINK' => 'applets',
                     'HW_INTAG_LINK' => '',
                     'HW_BACKGROUND_LINK' => 'images');
hw_insertanchors($doc, $sources, $destinations, $urlprefixes);
hw_output_document($doc);



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.