ansonphong / postworld

Wordpress Theme Development Framework
GNU General Public License v2.0
7 stars 0 forks source link

Load-Feed Directive #28

Closed michelhabib closed 10 years ago

michelhabib commented 10 years ago

Hi Phong, i was discussing with Haidy the Load-Feed Directive. it seems that all related PHP functins are already created. However i am still going to work on the JS part, it seems simple given that we have the framework already in place. I just needed to confirm how it works from a user perspective. Where will the user register feed [administrator feature only?] Should he have a button where he can register a feed after changing parameters in the live feed component on the page? Load Feed seems to be only a feed, no search panels, since it will just display pre-cached results. The more you tell about the user experience, the easier it will be for me to figure out what needs to be done. i will do something quickly to prototype it for now.

ansonphong commented 10 years ago

Hi Michel, Good questions. Load feed will be used in instances such as commonly used feeds where many users will be seeing the same feed and it would cause too much server cycles to re-parse the query outline every time. For instance, front pages, where you want the feed to load very quickly, also main category pages, etc, which get lots of traffic and which have no options how to sort or order the feed.

Examples of a load-feed would be - front page of this client's site : Reality Sandwich (see attached image) rsv2-front_page

Here you have 2 feeds. One Features feed, and one Stream feed, both which query by different post types.

Cached feeds are not sortable or order-able, with no search panels, and they can not change into live-feeds - they are relatively static, with the ability to infinite-scroll.

One thing you will notice on the attached image is that there are advertisements spliced into the feeds. One of the next things after the feeds are all tested and working will be to make a directive (which I haven't mentioned until now) for advertisement templates - something like an inject-feed controller, which (optionally) sits on top of a feed and inserts ads every X number of posts, with different options. We can talk about this later.

Are there any more questions that come to mind?

michelhabib commented 10 years ago

That perfectly describes it. I am working on it now and trying to reuse the live feed controller since they share most functionality, and i want to avoid any duplication of the code here.

On Mon, Oct 7, 2013 at 6:19 PM, phong notifications@github.com wrote:

Hi Michel, Good questions. Load feed will be used in instances such as commonly used feeds where many users will be seeing the same feed and it would cause too much server cycles to re-parse the query outline every time. For instance, front pages, where you want the feed to load very quickly, also main category pages, etc, which get lots of traffic and which have no options how to sort or order the feed.

Examples of a load-feed would be - front page of this client's site : Reality Sandwich (see attached image) [image: rsv2-front_page]https://f.cloud.github.com/assets/4825055/1281940/24e01f34-2f6b-11e3-9a2b-6c5ac8eb5718.png

Here you have 2 feeds. One 'Features' feed, and one 'Stream' feed, both which query by different post types.

Cached feeds are not sortable or order-able, with no search panels, and they can not change into live-feeds - they are relatively static, with the ability to infinite-scroll.

One thing you will notice on the attached image is that there are advertisements spliced into the feeds. One of the next things after the feeds are all tested and working will be to make a directive (which I haven't mentioned until now) for advertisement templates - something like an inject-feed controller, which (optionally) sits on top of a feed and inserts ads every X number of posts, with different options. We can talk about this later.

Are there any more questions that come to mind?

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/28#issuecomment-25822561 .

ansonphong commented 10 years ago

One more thing to note about load-feed, is that register_feed() will (for now) just be inserted via PHP into the template, until we have the capacity to make a cached feeds manager on the backend, which can happen at a later time.

Here is an example of that function: https://github.com/phongmedia/postworld/tree/master/php#pw_register_feed--args-

ansonphong commented 10 years ago

Yes, good idea to share the same code for them. You may be able to break out a render feed function or something, which both live-feed and load-feed both use. Where live-feed just has a live query mechanism sitting up-stream, whereas the load-feed has a function loading from the cached feed. You probably know better than I.

ansonphong commented 10 years ago

The core difference between the two directives is where they source the feed_outline from.

michelhabib commented 10 years ago

That's a good idea, breaking it into 2 directives. I need to put some thought into how to do this. The rendering i guess is already separated from the point where the feed gets into feed_data object. It is simply streamed through the repeater and infinite scroll directives from this point onward. The only difference is how the data is retrieved at first (and maybe the scrolling too).

On Mon, Oct 7, 2013 at 6:31 PM, phong notifications@github.com wrote:

The core difference between the two directives is where they source the feed_outline\ from.

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/28#issuecomment-25823598 .

michelhabib commented 10 years ago

@phongmedia I added a little functionality to be able to register/edit feeds using our live-feed directive and a simple register-panel, this should help with testing the load feed. just please note that you need to be an admin user to be able to post this function. Commit in 9958893bfc35c212807a2803318d13eca80bc7c6

ansonphong commented 10 years ago

Good idea - yes, they should definitely only be an admin to be able to do this.

Phong

On Tue, Oct 8, 2013 at 9:14 AM, michelhabib notifications@github.comwrote:

@phongmedia https://github.com/phongmedia I added a little functionality to be able to register/edit feeds using our live-feed directive and a simple register-panel, this should help with testing the load feed. just please note that you need to be an admin user to be able to post this function. Commit in 9958893https://github.com/phongmedia/postworld/commit/9958893bfc35c212807a2803318d13eca80bc7c6

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/28#issuecomment-25904396 .

michelhabib commented 10 years ago

load-feed directive is ready for your test, you will need to do the following:- 1- Login as admin 2- Open \postworld\templates\pages\pwLiveFeedWidget.html and review/change configuration for feed_settings['feed1'] as you like them to be and refresh the feed to see it 2- Register the Feed, by typing a name for it [loadfeed1], and click register. 3- back to pwLiveFeedWidget, update feed name in feed_settings and div attribute:- feed_settings['loadfeed1']

4- back to Search Page, the loadfeed1 should be loading as configured. 5- Open the chrome console to view the details, all ajax calls and outlines, updates, scrolls will appear over there.

michelhabib commented 10 years ago

Just rethinking the load-panel idea above... First idea: in AngularJS, we use ng-view and routes - the concept of SPA - to make it faster to load the page once and only change what's needed. that's already implemented in our case. Second idea: If we are loading Ajax content, what we can normally do [will be in next commit] is to have a div with an ajax load image [generated here http://www.ajaxload.info/], which is shown until the ajax request returns, then hidden and the content is shown. Third idea: if you are going to load any other generic page that we do not have control on, that would be the tricky scenario, we would need load it hidden and detect the page load and then show it and hide the ajaxload image.

Let me know if idea 3 is in our scope?

ansonphong commented 10 years ago

OK thanks, I will begin to test load-feed soon.

Re: load-panel The second idea is good, and the third idea is out of scope, so no need to do that.

ansonphong commented 10 years ago

Hi Michel, We should have a parameter which gets passed in feed_settings for inputting a pre-generated feed_outline. This will be especially useful when giving a readout of a user's favorites, or view_later posts which are already stored in the DB.

Then you could add a pre-populated feed_outline which prevents it from loading a registered feed from the DB.

ie.

feed_settingst['favorites'] = {
    feed_outline : [24,48,128,512,2048], // generated by <?php json_encode(get_favorites());  ?>
     preload: 10,
     load_increment : 10,
     view : {
          current : 'detail',
          options : [ 'list', 'detail', 'grid' ],
     }
}
michelhabib commented 10 years ago

Added Cached Feed Outline in last commit e89e1bba11dd0fce090e4870aa3e8e4bb31ebf37 available here:- http://localhost/wordpress/search/#/load-feed-cached-outline/