Get content of page in PHP

Permalink
I'm writing a little snippet for C5. I need to pull the content from a specific page and a specific content area into a variable and do a regex on it.

Can anyone provide an example to get me started? I'm looking at the API right now, but it's not easy.

Thanks!

Darkwater23
 
synlag replied on at Permalink Reply
synlag
If you want to save some time, check out

http://www.concrete5.org/marketplace/addons/popup/...

Does a great job!
Darkwater23 replied on at Permalink Reply
Darkwater23
Thanks, but that's more than I need. I'm still new to the C5 MVC and I'm trying to get the content of a page and avoid doing a direct query to the database.

The pop up block doesn't give me anything I need right now.
ScottC replied on at Permalink Reply
ScottC
$a = new Area('Main');
$c = Page::getByID(56);
$regexMatchThis = $a->display($c);


so do your match on $regexMatchThis..
Darkwater23 replied on at Permalink Reply
Darkwater23
That didn't work as expected. When display is invoked, output is dumped to the browser regardless of the variable assignment. Also, I have an area called 'Main' on the page already and it doesn't display anything when I do this.

I would think that the Page object should have a method I need without using an Area.

Is that not so?
ScottC replied on at Permalink Reply
ScottC
$fh = Loader::helper('file');
$nh = Loader::helper('navigation');
$content = $fh->getContents($nh->getCollectionURL($c));
?
that's from remo's cache package but that gives you the entire page's html

that's all i got ;)
Darkwater23 replied on at Permalink Reply
Darkwater23
Thank, Scott! I'll see what I can do with it.