Last active
August 29, 2015 14:24
-
-
Save isaactopo/9705e7a57a8dcddaa32a to your computer and use it in GitHub Desktop.
Read and Write a Kirby text File Data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Read the Kirby Data from the page Text File 'kd' | |
$doc = data::read($page->textfile(), 'kd'); | |
// Add or modify the entries | |
$doc['Text'] = 'Lorem ipsum dolor…'; | |
$doc['Likes'] = 22; | |
// Write the Text File with the new data | |
if(data::write($page->textfile(), $doc, 'kd')) { | |
echo 'Done'; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment