Open Source Content Management System

PHP midgard_blob method write_content

  1. Example

Write content to the file which is associated with attachment.

bool write_content($content);

midgard_blob method write_content takes 1 parameter:

  • content, a string which should be written to file

This method writes given content to a file and returns TRUE if file has been modified. In any other case returns FALSE

Example

<?php

$id = 123;
try {
    $article = new midgard_article($id);
} catch (midgard_error_exception $e) {
    echo $e->getMessage();
} 

$attachment = $article->create_attachment("my_note");

try {
    $blob = new midgard_blob($attachment);
} catch (midgard_error_exception $e) {
    echo $e->getMessage();
} 

$content = 'This is my simple note.';

$blob->write_content($content);

?>

Prior to Midgard 1.9, one has to define correct location manually. midgard_blob defines location internally.

More details about fails can be found in [midgard-core docs][0].

Designed by Nemein, hosted by Anykey