Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

How to get to the page content in PHP?

Started by Muut Archive 10 years ago · 2 replies · 592 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 2288 9 years ago
Archive · by Muut Archive, 9 years ago
2 1500 9 years ago
Archive · by Muut Archive, 9 years ago
2 4753 9 years ago
Archive · by Muut Archive, 9 years ago
1 3570 9 years ago
Archive · by Muut Archive, 9 years ago
3 1626 9 years ago