Using pageService and CBHelper in a custom plugin

Hello,

From the docs i learned, that i have to use this to have pageService and CBHelper in my plugin:



<cfset var thisPages = pageService.findPublishedPages(parent="", showInMenu=true)>

I got an execption :Error Messages: variable [PAGESERVICE] doesn’t exist

What did i wrong here?

Many thanks

cheers

Remove ID: from the inject.

Cool, this helped. Had to restart Railo afterwards, a bit odd…

Many thanks

cheers

I have a follow up question regarding e.g. the pageService:

How can make pageService available in let’s say in pages.cfm? This makes normaly no sense, but it’s is a good place to dump things out to see the data.

Thank you.

Actually, reinitting usually fixed that. Metadata for objects is cached inside of WireBox for performance, so event transients won’t pick up property changes until WireBox is shutdown and re-created (which happens on a reinit)

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Sorry to ask this newbie question: And how can i make the pageservice available in a regular cfm page? How does this init look like?

Hi Brad,

GetModel() was the missing thing.

Is it right that i can append the methods right away, like this:

<cfset myStuff = getModel(“pageService@cb”).findPublishedPages(parent="", showInMenu=true)>

Yes, that will work. If I’m going to call more than one method, I’ll usually set the service into an intermediate variable but it all comes down to your readability.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Got it…

Actually i dumped a bit to much to the screen, which blew me away -:slight_smile:
Using the methods from the API let me display what i like, great!

Thanks again…