/    Sign up×
Community /Pin to ProfileBookmark

generate webpage from config file

Hi,

I’m building a website wich will give realtime information to journalists during bike races. Bikeraces don’t allways have the same format (time trial, mountain stage, intermediate sprint) so i can’t allways display the same modules on my page.
I’ve created an .xml wich describes the details of every different race.

Now i’m looking for the best way to tackle page setup/generation. For example if there’s an intermediate sprint during the race the module wich shows the result of that sprint needs to be generated/displayed, if it is a timetrial on the other hand i want to display starttimes of the riders and no intermediate results…

I’m sure someone somewhere has already solved this so pointing me in the right direction will already be a great help!
When i type the keywords into Google it keeps giving me unusable results.

Thanks for any help/guidance,

oredge

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumFeb 04.2016 — It should be not problem creating your page(s) based on the information in your XML file. You could use PHP for doing this. Do you already know about PHP? I'm sceptic if there is a ready-to-use script for you purpose.
Copy linkTweet thisAlerts:
@tracknutFeb 04.2016 — In Google search for "php simplexml" and that will get you a library of php routines you can use to read the xml file. You can then display the results based on what's in the file.
Copy linkTweet thisAlerts:
@oredgeauthorFeb 04.2016 — when i open the page in a browser the page gets (AJAX) my .xml config file and every item in my .xml file will call a PHP page wich will return a HTML node (a <div>) or something wich goes into my htmlpage...

is that more or less what you mean?

i will need to build menus as well, can PHP send me javascript code to make buttons etc.

thanks for the response!!
Copy linkTweet thisAlerts:
@oredgeauthorFeb 04.2016 — In Google search for "php simplexml" and that will get you a library of php routines you can use to read the xml file. You can then display the results based on what's in the file.[/QUOTE]

parsing xml with PHP is not my problem, the .xml contains information about the elements wich i need. For each element i need to generate the html and a menu-item etc. wich has to go into the page in the browser.
Copy linkTweet thisAlerts:
@tracknutFeb 04.2016 — No need for ajax or javascript in what you're describing, though.

in PHP

Open the xml file

Output the menu with soimething like: echo "<ul class=menu><li>$item_1</li></ul>"

Or echo "<button>.....</button>"
Copy linkTweet thisAlerts:
@SempervivumFeb 04.2016 — when i open the page in a browser the page gets (AJAX) my .xml config file and every item in my .xml file will call a PHP page wich will return a HTML node (a <div>) or something wich goes into my htmlpage... [/QUOTE]That's one way you could do it. This would need one PHP page for every node in your document. Or you might control the PHP by using a query string. Did you already code these PHP pages?

However I would find it more straight forward parsing your XML document on the server and creating the HTML by PHP
Copy linkTweet thisAlerts:
@SempervivumFeb 04.2016 — BTW: Here is a similar task: Creating web pages based on a structured text file. We did it completely using PHP and it works fine.

http://www.webdeveloper.com/forum/showthread.php?351831-Flow-a-list-into-a-table
×

Success!

Help @oredge spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...