facebook instant article sdk step by step in core php in localhost - facebook-instant-articles

How to implement facebook instant article sdk for php with localhost.I am using graph api to submit my article in facebook but i want to change my html to facebook instant article html automatically.

The only option for integration you will have for localhost dev environment setup will be the GraphAPI ingestion.
And still, you will need to claim URL to get content ingested to that particular page.
Example: yourdomain.com
You can create a dev.yourdomain.com and claim this just for your development environment.
Then you can create Instant Articles using the SDK and use as your canonical URL the dev.yourdomain.com.
Example:
<!doctype html>
<html lang="en" prefix="op: http://media.facebook.com/op#">
<head>
<meta charset="utf-8">
<!-- URL of the web version of this article -->
<link rel="canonical" href="http://dev.yourdomain.com/article.html">
<meta property="op:markup_version" content="v1.0">
</head>
<body>
<article>
<header>
<!-- The title and subtitle shown in your Instant Article -->
<h1>Article Title</h1>
<h2>Article Subtitle</h2>
<!-- The date and time when your article was originally published -->
<time class="op-published" datetime="2014-11-11T04:44:16Z">November 11th, 4:44 PM</time>
<!-- The date and time when your article was last updated -->
<time class="op-modified" dateTime="2014-12-11T04:44:16Z">December 11th, 4:44 PM</time>
<!-- The authors of your article -->
<address>
<a rel="facebook" href="http://facebook.com/brandon.diamond">Brandon Diamond</a>
Brandon is a avid zombie hunter.
</address>
<address>
<a>TR Vishwanath</a>
Vish is a scholar and a gentleman.
</address>
<!-- The cover image shown inside your article -->
<!-- TODO: Change the URL to a live image from your website -->
<figure>
<img src="http://example.com/path/to/img.jpg" />
<figcaption>This image is amazing</figcaption>
</figure>
<!-- A kicker for your article -->
<h3 class="op-kicker">
This is a kicker
</h3>
</header>
<!-- Article body goes here -->
<!-- Body text for your article -->
<p> Article content </p>
<!-- A video within your article -->
<!-- TODO: Change the URL to a live video from your website -->
<figure>
<video>
<source src="http://example.com/path/to/video.mp4" type="video/mp4" />
</video>
</figure>
<!-- An ad within your article -->
<!-- TODO: Change the URL to a live ad from your website -->
<figure class="op-ad">
<iframe src="https://www.example.com/ss;adtype=banner320x50" height="60" width="320"></iframe>
</figure>
<!-- Analytics code for your article -->
<figure class="op-tracker">
<iframe src="" hidden></iframe>
</figure>
<footer>
<!-- Credits for your article -->
<aside>Acknowledgements</aside>
<!-- Copyright details for your article -->
<small>Legal notes</small>
</footer>
</article>
</body>
</html>

Related

Page Requires Multi Part, and presentation part Microsoft Graph API

I am trying to post a page to OneNote from the Microsoft Graph API, and when I enter in the section id that the page needs in order to post it throws me an error that states:
Page create requests require the content to be multipart, with a presentation part.
My Request header looks like this:
<!-- MyPartBoundary198374 -->
Content-Disposition:form-data; name="Presentation"
Content-Type:text/html
<!DOCTYPE html>
<html>
<head>
<title>A page with <i>rendered</i> images and an <b>attached</b> file</title>
<meta name="created" content="2015-07-22T09:00:00-08:00" />
</head>
<body>
<p>Here's an image from an online source:</p>
<img src="http://..." alt="an image on the page" width="500" />
<p>Here's an image uploaded as binary data:</p>
<img src="name:imageBlock1" alt="an image on the page" width="300" />
<p>Here's a file attachment:</p>
<object data-attachment="FileName.pdf" data="name:fileBlock1" type="application/pdf" />
</body>
</html>
<!-- MyPartBoundary198374 -->
Content-Disposition:form-data; name="imageBlock1"
Content-Type:image/jpeg
<!-- ... binary image data ... -->
<!-- MyPartBoundary198374 -->
Content-Disposition:form-data; name="fileBlock1"
Content-Type:application/pdf
<!-- ... binary file data ... -->
<!-- MyPartBoundary198374 -->
What could be the issue here?
You're missing the initial request:
POST https://graph.microsoft.com/v1.0/me/onenote/sections/{id}/pages
Content-length: 312
Content-type: multipart/form-data; boundary=MyPartBoundary198374

data-icon is not showing properly

I am newbie to jquery mobile. I am executing the attached code.I have anchor tags whose role is button and attached data-icon as arrow-r but it is not showing properly as I expected.please help.
Arrow icon is showing like this
but I expected to show like this
I expected to show like this
am I missing CDN?Please help.
<!DOCTYPE html>
<!--
Copyright (c) 2012-2014 Adobe Systems Incorporated. All rights reserved.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.css">
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
<style type="text/css">
.custom-btn{
width:200px !important;;
height: 50px !important;;
}
#btn1{
height: 8px;
}
</style>
</head>
<body>
<div id="home" data-role="page">
<div data-role="header">
<h1 class="head">home</h1>
Blog
Home
</div>
<p>Welcome to the view source app</p>
<!-- <div data-role="controlgroup"> -->
Blog
Videos
Photos
Tweets<!--
</div> -->
</div>
<div data-role="page" id="videos" data-title="View Source:Videos">
<div data-role="header">
<h1>Videos</h1>
Videos
</div>
<p>Videos page</p>
Home
</div>
<div id="Photos" data-role="page" data-title="View Source:Photos">
<div data-role="header">
<h1>Photos</h1>
Photos
</div>
<p>Photos page</p>
Home
</div>
<div id="Tweets" data-role="page" data-title="View Source:Blog">
<div data-role="header">
<h1>Tweets</h1>
Home
</div>
<p>Tweets</p>
Home
</div>
<!-- Start of first page: #one -->
</body>
</html>
Change your data-icon attribute to carat-r:
Home
Please take a look to the icon list: https://api.jquerymobile.com/icons/
And you have linked twice the jQuery Mobile JS library and the stylesheet. Try using only one of each at the same time.

Load Video to flow player in mvc application

I need to add a flow player to my MVC website. i have added a video to server. when i directly put src path in tag it shows video file not found
<div class="flowplayer">
<video>
<source type="video/mp4" src="my server file location">
</video>
</div>
In site.Master head file i have added
<head runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<!-- 1. skin -->
<link rel="stylesheet" href="//releases.flowplayer.org/5.4.6/skin/minimalist.css">
<!-- 2. jquery library -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<!-- 3. flowplayer -->
<script src="//releases.flowplayer.org/5.4.6/flowplayer.min.js"></script>
</head>
But when i run this it gets
I would try it with a video from one of the demos on the flowplayer site first.
It may be the video is either encoded incorrectly or the web browser that you tried it on does not support that format.
HTML5 browser support

How do I provide content for a general browser? (using the Useragent)

So I have some videos that I post to my blog - Be aware, it's kid pictures, and will probably put in in a child induced coma quickly.
I would like to display the HTTP Live streaming version of the video for those on iOS & Macs, but the standard MP4 file for everyone else. So, it would be great to have logic to provide anyone with Safari the m3u8, and everyone else the mp4. Thanks!
As it stands now, I have to provide 2 different players (which looks bad)
<!-- Begin Video.js Responsive Wrapper -->
<div style='max-width:800px;'>
<div class='video-wrapper' style='padding-bottom:45.875%;'>
<!-- Begin Video.js -->
<video id="example_video_id_2142731582" class="video-js vjs-default-skin" width="800" height="367" poster="http://blog.thetroutmans.net/wp-content/uploads/2013/04/1stBikeRide/poster.png" controls preload="none" data-setup="{}">
<source src="http://blog.thetroutmans.net/wp-content/uploads/2013/04/1stBikeRide/1stBikeRide.m3u8" type='video/mp4' />
</video>
<!-- End Video.js -->
</div>
</div>
<!-- End Video.js Responsive Wrapper -->
</p>
<!-- Begin Video.js Responsive Wrapper -->
<div style='max-width:800px;'>
<div class='video-wrapper' style='padding-bottom:45.875%;'>
<!-- Begin Video.js -->
<video id="example_video_id_621346600" class="video-js vjs-default-skin" width="800" height="367" poster="http://blog.thetroutmans.net/wp-content/uploads/2013/04/1stBikeRide/poster.png" controls preload="none" data-setup="{}">
<source src="http://blog.thetroutmans.net/wp-content/uploads/2013/04/1stBikeRide/First%20Bike%20Ride-Wi-Fi%20High.mp4" type='video/mp4' />
</video>
<!-- End Video.js -->
</div>
</div>
<!-- End Video.js Responsive Wrapper -->
</p>
You can add multiple <source> elements, and the browser will go through the list until it finds a source element that it supports:
<video id="example_video_id_621346600" class="video-js vjs-default-skin" width="800" height="367" poster="http://blog.thetroutmans.net/wp-content/uploads/2013/04/1stBikeRide/poster.png" controls preload="none" data-setup="{}">
<source src="http://blog.thetroutmans.net/wp-content/uploads/2013/04/1stBikeRide/First%20Bike%20Ride-Wi-Fi%20High.m3u8" type='application/x-mpegURL' />
<source src="http://blog.thetroutmans.net/wp-content/uploads/2013/04/1stBikeRide/First%20Bike%20Ride-Wi-Fi%20High.mp4" type='video/mp4' />
</video>
Here's a random blog post I stumbled across awhile ago and bookmarked that talks about this a bit more.

Dojo Fisheye in Grails app

I am building a web application using Grails. I decided to use dojo and I added a dojo fisheye menu for begining in the main.gsp so it would be available on all the application's pages.
It works fine for the (home) index.gsp page, but once I select another one, the fisheye menu disapears. If I go back to home it is there. I revised my settings and everything looks ok to me. I am not using anything fancy, just simple things. I am missing something but not able to figure it out.
here is the code in my main.gsp simplified for clarity:
<html>
<head>
...
<g:layoutHead />
<!-- use dojo library ... this has not effect at all -->
<g:javascript library="dojotk"/>
<!-- Load Dojo -->
<script type="text/javascript" src="js/dojotk/dojo/dojo.js"
djConfig="parseOnLoad:true, isDebug:false"></script>
<!-- need fisheye -->
<g:javascript type="text/javascript">
dojo.require("dojox.widget.FisheyeList");
</g:javascript>
<!-- required css for dojo fisheye -->
<style type="text/css">#import "js/dojotk/dojox/widget/FisheyeList/FisheyeList.css";</style>
</head>
<body >
...
<!-- fisheye bar -->
<div id="fisheyebar"><g:render template="/common/fisheyebar"/></div>
<g:layoutBody />
</body>
And here is the _fisheyebar.gsp
<g:javascript>
function load_app(target){
window.location.href=target
}
</g:javascript>
<center >
<div class="outerbar">
<div dojoType="dojox.widget.FisheyeList"
itemWidth="50" itemHeight="50"
itemMaxWidth="200" itemMaxHeight="200"
orientation="horizontal"
effectUnits="2"
itemPadding="10"
attachEdge="top"
labelEdge="bottom"
>
<div dojoType="dojox.widget.FisheyeListItem"
onClick= "load_app('${createLinkTo(dir:'/something')}');"
iconsrc="images/icon_something.png" caption="Web Browser">
</div>
.....
</div>
</div> <!-- outbar -->
</center>
All the pages including the index.gsp have the following:
<head>
<title>some titel</title>
<meta name="layout" content="main" />
</head>
Please not that the usage of template (_fisheyebar) is not the cause, I put the code directly in the main and had the same effect. So what am I missing?
it is in the relative url to dojo's location. it is relative to the root so that's why the index works and not the other pages.
using absolute URLs fixes the problem.
Did you try to move your dojo declaration and imports to your layout template page instead of putting it in your main.gsp ?

Resources