HTML content in an iPhone app - html

I am currently developing an iPhone app showing the contents of sports related articles available in my website. Each article contains one title, one picture and some content. When I refer to the content I include the text of the article, the youtube videos that can be here or not, the link refering to other articles that are or are not in my website (depending on the article) etc...
In the first version of my app I had two screens. The first one was a customized UITableView looking like this :
Then when I clicked on an article I had the article open up in a second screen like this :
I retrieve all of the data I need by calling a PHP file that it making a MySQL request to my server's database and then sending the data back to my app via JSON. The problem I have is that the content of the article is given in HTML and I cannot parse it so it can be dynamically used. For instance when there is a link to a website I'd like to have it clickable. When there is an embeded youtube video I'd like it to be viewable inside of my app. In order to accomplish that do I have to use a UIWebView ? (Note that I don't want to show the article page from the website directly into the app. I want to be able to customize it anyway I want).

You will need to take take the HTML content from your JSON. If you have valid HTML, you can simply load it in a UIWebView in your view using the following call:
[self.webView loadHTMLString:htmlString baseURL:nil];
Short of writing your own HTML parser, this is you best bet. So you view can have static UIImageView and UILabels for the title and image, and a webview that will display your HTML (which can be customized however you'd like).

Related

embed blog in website

I'm building a custom html website from the ground up and one of my navigation tabs at the top is called "blog". Instead of populating that tab with content created in my code, I'd like to populate it with content that is maintained externally (for example blogger or WordPress or some easy blog formatting tool).
Can't seem to figure out an easy way to embed my externally maintained blog into my website. If at all possible, I'd like for the embed to be responsive, customizable, and searchable. Any ideas?
If you want to embed code from another site into your own site, you have to
1) link it in OR 2) retrieve and parse it.
1) The typical solution for this was iframe. It's not simple, but you can use the width and height settings for the iframe with #meda css queries to obtain a measure of responsiveness.
2) If you have php as a tool, you can look at this stack overflow answer to get an idea how to retrieve the website code, then parse the code out.
for instance, if I wanted only the information after the closing head tag, I could do
// get the webpage source -- depends on allow_url_fopen
// see the previously mentioned stack overflow answer for alternates
$externalWebpage = file_get_contents('http://yoursite.com/your-page.html');
// split the webpage by </head>
$websiteSections = explode($externalWebpage, '</head>',);
// don't neglect to add the '</head>' back if you want to use that
// portion somewhere else
$head = $websiteSections[0] . '</head>';
$body = $websiteSections[1];
Assuming you went with the php solution, all this could be done in the backend of the site prior to generating the html. Further parsing is obviously possible, but depends on your knowledge of the external page's structure.

Incorrect data from Facebook Share button

for test i use https://developers.facebook.com/tools/debug/sharing/ site gmk.ru, but data loaded from site amobile-studio.ru
site gmk.ru contains another content.
iam use open graph properties on news page (share have only this page), example: http://gmk.ru/news/view/id/826
but the data is still not correct

birt tool dynamic text with dynamic HTML having embedded image not showing in pdf

I am trying to display HTML content in PDF using eclipse Birt. Birt has Dynamic text(HTML format) pallets where we can display clob data. Here one of my HTML content is embedded image base64. While viewing in PDF the embeded html image is not displaying instead showing error msg "The resource content not found".
Birt expert please comment - On how to show Clob data embeded image dynamic HTML !
This is not going to work out of the box. BIRT HTML content is only meant for text formatting. Neither images nor HTML tables are supported (well, HTML tables actually are working to a minimal extent).
The best solution I can think of is: Parse the HTML yourself and extract the images yourself. But be warned, that's going to be tricky!
You would create two scripted DataSets, one for the text and one for the images.
Both DataSets would receive the HTML as input parameter.
The first one would just replace embedded images with a text like "see image #N" and return exactly one row.
The second one would extract the embedded images and return the image number, its URL and embedded data.
You could then use a List item in the layout to render the images after the text.
The script code will be complicated...

Using JSF to render images

Part of my application are URLs that can be embedded in other sites much like a banner ad. Here is
an example.
That page is generated on-the-fly with the latest data to update the pie chart in it -- in other words just a normal JSF page. The links in it work and does what I want it to. This is OK for web page developers, since I can generate an iframe tag for them with the src attribute pointing to that URL.
What I would like to do is generate a URL and HTML code fragment that could be cut and pasted into other web pages and user forums so that the image is shown in the page, not just a link to it. Most user forum software will allow this but not allow inserts like iframe. For example the following doesn't work here:
<iframe src="http://www.myqwip.com/banner.xhtml?windowId=5b5&width=300&height=400&qwipID=2" width="300" height="300"> </iframe>
I think in order to do this I would have to provide a URL that serves a JPEG or PNG file on the fly, so the image could be displayed elsewhere. Most user-forum software allows such hot-links.
I have been looking for a way of doing this. Any suggestions?

How do I stop images or flash from loading into the browser?

I am creating a web page that accepts a hyperlink from the user and displays that page in an iframe. While rendering the page, I would like to show just the text and simple colors, thats it.
I would like to block all the media files like images and flash scripts from showing up.
If not an extensive one, for the starters, I would like to confine the scope to .gif, .jpeg, .jpg, .png, .swf.
Or does anyone know of a site with similar functionality?
You can write a simple dom parser and parse the page before show it in iframe. Then before showing it you can remove whatever you want.
your iframe whould like
<iframe src="your_parser.php"></iframe>
In your parser you can get the content from page using file_get_contents() or curl() it is your choise (i would use curl). Then you can remove the media you want.
If you're using Firefox, use the Adblock Plus extension. You can specify the types of items to block via a filter rule. An example (using Safaribooks) looks like this:
||techbus.safaribooksonline.com/static/201109-2191-techbus/images/6.0/*.jpg
However, if you're talking about incorporating functionality into your page to strip out a specific list of content-types, this approach wouldn't help you. You'd need to pull the html source and strip out the offending content-types.
also if you are using cms. you should be turn off bbcode image, and embed html