Jump to content

What is of() ?


rick
 Share

Recommended Posts

I have seen, 

$user->of(false);
// do something with $user
$user->save();
$user->of(true);

in a few places. But I can't find it's reference in the cheatsheet or doc.

What the heck is of() ? :)

Link to comment
Share on other sites

Thanks adrian.

One follow-up question. Why is this necessary?

When searching for 'of(', '->of', etc., no results are found. In fact, the cheatsheet search renames my search to '- of' (greater than is replaced with a space). I don't know what software is used to present the docs, so I don't know how difficult it would be to add an 'un-filtered' search option.

Can the references be 'upgraded' to include the 'why'?

In the technical docs I've written in the past, I always included the 'what' (what it is), the 'how' (how its used, as in examples), and 'why' (why its used). Currently, the references only provide the 'what', with the ocassional 'how' in response to a specific question.

I'm not knocking the docs. As a beginner with PW, the additional information would answer almost all of my noob questions. :)

On a related note, PW has quite a few people that contribute to it's functional development, and it's support here in the forums. I don't have the internal PW knowledge to make those contributions, ...yet. The only skill set I posses at this juncture is assisting in ehancing the docs. I'll be glad to volunteer to extend the reference materials, if that is something y'all have had on the drawing-board. </ thinkingoutloud>

Thanks again adrian.

  • Like 2
Link to comment
Share on other sites

Thanks adrian.

One follow-up question. Why is this necessary?

When searching for 'of(', '->of', etc., no results are found. In fact, the cheatsheet search renames my search to '- of' (greater than is replaced with a space). I don't know what software is used to present the docs, so I don't know how difficult it would be to add an 'un-filtered' search option.

Can the references be 'upgraded' to include the 'why'?

In the technical docs I've written in the past, I always included the 'what' (what it is), the 'how' (how its used, as in examples), and 'why' (why its used). Currently, the references only provide the 'what', with the ocassional 'how' in response to a specific question.

I'm not knocking the docs. As a beginner with PW, the additional information would answer almost all of my noob questions. :)

On a related note, PW has quite a few people that contribute to it's functional development, and it's support here in the forums. I don't have the internal PW knowledge to make those contributions, ...yet. The only skill set I posses at this juncture is assisting in ehancing the docs. I'll be glad to volunteer to extend the reference materials, if that is something y'all have had on the drawing-board. </ thinkingoutloud>

Thanks again adrian.

I'm the creator of the cheatsheet.processwire.com 

Searching for "->of" of "of()" works fine. It uses a fuzzy live search clientside with javascript using quicksilver (and some nifty code by jQuery creator John Resig). 

I remember having some problems with special chars like > but I think some of it was in Firefox but can't recall what. Actually I replace > with a > as this html entity is also used in source.

So far I can't reproduce it but maybe you use a sepcial browser or anything else, so please let me know.

Link to comment
Share on other sites

@Soma

I'm using FF so it could be the issue you speak of. Great work, btw.

One question. Is there a setting or query string option to have the complete lists expanded by default?

@adrian

I use the page content search as well, but wasn't sure whether my search result would be on that page, since I'm new to how everything functions.

Link to comment
Share on other sites

One notable difference between setOutputFormatting() and of() is the difference in return value.

// setOutputFormatting is chainable and returns the page object
$page->setOutputFormatting(false)->set("field", "value")->save();

// of() is not chainable, but does return the previous OutputFormatting status
$oldOf = $page->of(false);
$page->set("field", "value");
$page->save();
$page->of($oldOf);
  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...