Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

API to create content via front end?

Started by Muut Archive 11 years ago · 2 replies · 456 views
11 years ago

I'm looking at Grav as an alternative for Kirby CMS. So far it looks very solid. Does it have an easy to use way of creating content outside of the admin though? I can't find information about this in the docs... If there is an easy way, an example would be much appreciated. Here's an example of how easy this works in Kirby:

page('mypage')->children()->create($current_user, 'mytemplate', array(
'title' => 'mytitle',
'date' => $today
));

11 years ago

Page does have a save() method on it, this is what the admin uses, but you basically have to create a page and set all the bits on it first, then call the save.

I suggest digging into the admin plugin and looking at the save() method in the controller.php class.

We do plan on creating a JSON API that will make a lot of this easier. BTW, you might find this handy too: http://learn.getgrav.org/api/

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1352 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4063 9 years ago
Archive · by Muut Archive, 9 years ago
1 2949 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago