Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
WP REST API: Internals and Customization
Apr 14, 2016 @ 16:24:28

TutsPlus.com has posted the latest part of their series focusing on the WordPress REST API. In this new part of the series they look at some of the internals of the API code and the customizations you can make on the data returned.

In the previous part of the series, we learned about creating, updating, and deleting content remotely through the WP REST API. It allows us to create platform-independent applications that work seamlessly with a WordPress powered back-end, providing a rich experience to the user.

In the current part of the series, we will take a look at the internals of the WP REST API and how they work together to power the API. After that, we will learn to modify server responses for the default endpoints to include custom fields.

They walk you through a few different topics around the API including the internal classes that power it, how to modify the server and making custom fields editable. There's a bit of code involved when it comes to modifying the custom fields in the response and registering an editable field. The rest is mostly about configuration and what methods are doing what during the request.

tagged: wordpress tutorial wpapi api rest internals customization fields editable

Link: http://code.tutsplus.com/tutorials/wp-rest-api-internals-and-customization--cms-24945

Kevin Schroeder:
Excluding Fields in the MongoDB/MongoDB Library
Mar 31, 2016 @ 16:18:05

In this new post to his site Kevin Schroeder has shared a helpful hint around the MongoDB library and excluding fields from the results of a query.

I am using the mongodb/mongodb library for a project of mine. The API seems fairly different from the old PECL library and it also came with some other, albeit unexpected, baggage. [...] One of the practices I’ve heard about Mongo is to get Mongo to do as much as it can, but not to worry too much about complicated joins and such as you would in SQL. In other words, don’t shy away from bringing data into the application to do some processing. That was the practice I followed, which worked fine up until my data size started to increase.

He started seeing some major performance issues when his data set grew to a significant size (50% of the response time). He went searching for a solution, tried MapReduce but eventually came upon an optional parameter letting him tell the Mongo DB to omit a value (or values) from the result set. Using this he dropped 7.5 seconds off of his wall clock time.

tagged: exclude fields result set mongodb library example parameter

Link: http://www.eschrade.com/page/excluding-fields-in-the-mongodbmongodb-library/

CodeSnipers.com:
HTML Helpers - Ruby Wannabes in PHP
Dec 07, 2005 @ 13:15:00

On CodeSnipers.com today, there's a look at Nola's creation of HTML helpers based off of the same types of objects in Ruby.

I've gone back and forth on the idea of using ALL html generation functions to hammering it all out in a template like Smarty. Templates are nice, It sure is nice to use functions. I was looking at RoR and saw these HTML helper functions. I thought, hey I can write them in php. (Yeah to all you php hating ruby folks, this may be an effort in futility, but thinking how to implement some of these things in PHP helps me understand the concept, like my MVC articles).

Her examples include the creation of text fields, text areas, and opening/closing tags for a form. The two field functions also take in values and attributes to specify in the outputed HTML.

tagged: HTML helper Ruby form fields HTML helper Ruby form fields

Link:

CodeSnipers.com:
HTML Helpers - Ruby Wannabes in PHP
Dec 07, 2005 @ 13:15:00

On CodeSnipers.com today, there's a look at Nola's creation of HTML helpers based off of the same types of objects in Ruby.

I've gone back and forth on the idea of using ALL html generation functions to hammering it all out in a template like Smarty. Templates are nice, It sure is nice to use functions. I was looking at RoR and saw these HTML helper functions. I thought, hey I can write them in php. (Yeah to all you php hating ruby folks, this may be an effort in futility, but thinking how to implement some of these things in PHP helps me understand the concept, like my MVC articles).

Her examples include the creation of text fields, text areas, and opening/closing tags for a form. The two field functions also take in values and attributes to specify in the outputed HTML.

tagged: HTML helper Ruby form fields HTML helper Ruby form fields

Link:


Trending Topics: