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

How to get to the page content in PHP?

Started by Muut Archive 10 years ago · 2 replies · 458 views
10 years ago

Hello,

I would like to append page content in PHP by:

$page = $this->grav['pages']->get('<how to get to specific page>');

$content = $page->getRawContent();

// Prepend the output with the custom text and set back on the page
$page->setRawContent($content . "

Some text");

but I am not able to get specific page. Any help/hint?

Vlada

10 years ago

See reply in Gitter. Pages::get() requires the full page path. Page::find() accepts a route.

10 years ago

Thanks, get() works with full system path!

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 4064 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