Displaying Only Certain XML data In HTML Page - html

I'm completely new to website development and I'm learning things on the fly. I am a Sports Information Director at a small university and need some help spicing up our website. For most sports, we use a program called Stat Crew.
Below is an example of the xml data file.
<player name="Player 1" checkname="Player 1" uni="00" code="00" pos="G" year="SR" gs="4" gp="5" fgm="21" fga="42" fgm3="2" fga3="6" ftm="17" fta="24" tp="61" oreb="8" dreb="8" treb="16" blk="0" stl="10" ast="28" to="20" pf="10" tf="0" min="128" dq="0"/>
My html is already in a tablet format with each "player" having their own table. What I want to do is display season statistics (updated every game of course) without having to update the html manually. Can I set up my page to pull certain data from the XML (fgm, fgm3, etc) and have it automatically go into the designated html table?
I've tried to just read the questions on this site that have to do with XML but, to be honest, It's confusing.
Thanks for your help!

You should consider looking into XSL Transforms. This will allow you to utilize your XML data and generate the visualization you want with your HTML familiarity.

Related

Dynamically produce html based on templates

I am trying to automate a workflow for automatically creating HTML newsletters based on information stored in a spreadsheet.
Currently, I am using a newsletter drag and drop tool, in which several pre-programmed blocks are available (e.g. full column block, 2 column block etc). When creating a newsletter, I drag and drop a block and fill in my content (e.g. uploading an image, inserting a url). This is all well and good, however, since I have to create the same newsletter in 10 different languages, this process is quiet time consuming and prone to human error. While all newsletters are the same in terms of layout, the images and urls differ.
To solve this issue, I would like to get rid of the drag and drop process, and instead automate the workflow in some other way.
One idea that I have already tried, but that doesn't seem like the perfect option to me, is to dynamically create the needed HTMLs in Excel. Basically, the idea is to take the existing block template structure, and put it into Excel with some formulas.
I could then copy and paste the links to the images (in a simple format, such as EN1.jpg, ES1.jpg, etc.), as well as to urls (url.com, url.es).
This is some example block:
<img alt="" align="center" width="700" style="max-width:700px;" class="resetWidth" border="0" src="IMAGE" />
My final expected result is something like this:
I define the layout in a very quick manner (e.g. writing fullcolumn, half column, fullcolumn). The corresponding code is taken from the template. I then provide the attributes (image url, link url) in the form of a list or so. The end result should then be 10 html files that I simply have to upload to the newsletter software.
I would appreciate it very much if anyone had any ideas on this.
Another option for translating the page is to do something like this https://www.w3schools.com/howto/howto_google_translate.asp
it adds a selection for languages to translate into.
As for automating the images, you could set up folders for each langauge and reuse the name of images based on where you want them so they would be placed in the correct location.
All you'll have to do it replace the images with the same file names and swap the default language on the Google Translator.
So something like this that the html will stay the same with regards to the image names
For the link variables you may be able to write some JS or another language to take advantage of the
<html lang="">
and based on which lang is set, insert a set of links to the file.

How to best transfer a document to a SAPUI5 framwork?

I'd like to achieve the following and I'm looking for ideas. I have a document and I want to represent/transform this content in/to a nice SAPUI5 framework. My idea is the following: a split app with having the paragraph titles in the master view (plus a search function on top) and the respective content in the detail view.
I'd like to know from you if
a) you might want to share your ideas and hints on alternatives.
b) this can be achieved within one single file (i.e. all the code for the split app and document content in one html) and maybe using pure html code (xml also feasible) - against the background of easily handing a large amount of text available in html.
c) if you happen to have/know a reusable template.
Thanks in advance!
An interesting question. I went through a similar exercise once, re-presenting my site with UI5.
To your questions:
(a) I would think that the approach you suggest is a good one
(b) You can indeed include all the app in a single file, I do that often by using script templates, even with XML Views. You can see some examples in my sapui5bin repository, in particular in the SinglePageExamples folder. Have a look at this html file for example: https://github.com/qmacro/sapui5bin/blob/master/SinglePageExamples/SAP-Inside-Track-Sheffield-2014/end.html
What I would suggest is, rather than intermingle the document content and the app & view definitions, maintain the content of your document separately, for example, in XML or JSON, and use a client side model to load it in and bind the parts to the right places.

How can I import html content to pdf template?

I created a pdf template with open office draw. it has textboxes and I can set values with acrofield. But I can't import a html content to template.
I can convert html contents to pdf file; but for template, how can I do it?
My problem is with template; also my html content have to map on page, for example center of page.
Thanks
I am not quite sure if I understand your question, but it seems like you need some kind of template where you will enter your content.
My thinking goes to OpenXML as the best fit. But since it is rather complex you can save some time by using third party tools.
From my experience, Docentric gives you good value for the money. You can prepare a template in Word and then merge it with data from any source that can fit into .NET object. Your document can be converted to pdf or xps if required.
Templates are generated in MS Word (2007 or newer) using special Docentric Add-in for template generation. All MS Word formatting can be applied here. Placeholders for data are set where the data will appear at runtime.
The process is straight forward so even end users can design reports. Developers then focus on bringing data in from various sources (database, XML). Chech the product documentation for ideas how to use it.

XML data to be sorted by HTML Form

I would like to do a basic search functionality but the data I am using is XML - How would I got about making a search form that can filter the data from the XML and display it in HTML whether it meets the HTML form's criteria.
I have not yet tried to use a HTML form to display the XML data as I do not know how to do this, therefore I am asking for direction or examples that may be elsewhere in the web, as I ma having trouble doing so.
<UKPRN>10004048</UKPRN>
<ACCOMURL>http://www.londonmet.ac.uk/accommodation/</ACCOMURL>
<PRIVATELOWER>5000</PRIVATELOWER>
<PRIVATEUPPER>8300</PRIVATEUPPER>
<COUNTRY>XF</COUNTRY>
<NSP>1</NSP>
<Q24>51</Q24>
<Q24POP>2242</Q24POP>
<KISCOURSE>
<TITLE>FdSc Crime Scene and Forensic Investigation</TITLE>
<UCASCOURSEID>F411</UCASCOURSEID>
<VARFEE>10</VARFEE>
<FEETBC>1</FEETBC>
<WAIVER>0</WAIVER>
<MEANSSUP>0</MEANSSUP>
<OTHSUP>0</OTHSUP>
<ENGFEE>5700</ENGFEE>
</KISCOURSE>
There is just a basic look at my XML set up - any help is appreciated!
EDIT: Further to the question asked below, The XML data is structured as above, and I wish for some PHP or Html Form to search the Title of the title KISCOURSE and then display relevant searches.
Since this is rather a bigger project than a short question my answer just aims to give you some ideas on how I would approach this. Tell me whether you think it is helpful and if you have further questions.
Assuming that you have your data in one XML file, e.g. data.xml, and you have access to PHP and its XSLTProcessor class I would do the following:
Create an HTML form with inputs for the fields you want to query
Write an XSL transformation to filter data.xml on the wanted parameters
Write a PHP script that gets parameters from the HTML form, applies them to the transformation, executes it and outputs the result
Tell me if you find this approach suitable for you and I can add more detail. Good luck!

How do I grab figures from a url and place them in my page?

http://www.bloomberg.com/markets/ has several figures that I would like to display on my html page.
If I just have a div and say I want it to display how much percent some financial market has changed, how to I get the div to display whatever figure is published to Bloomberg? So that whenever I reload my website the most up to date figure from Bloomberg is displayed in plain text in my div?
So instead of
<div>0.05%</div>
I have
<div>(some code here to pull the correct figure from bloomberg)</div>
Bloomberg has an API that you can use to get their market data for free:
http://www.openbloomberg.com/open-api/
Now, you can adopt Bloomberg’s market data interfaces without cost or restriction.
What you are asking is called data parsing and it is pretty common request. If you want to do it using PHP, PHP Simple HTML DOM parser or phpQuery provide plenty of examples.