/    Sign up×
Community /Pin to ProfileBookmark

Populating timetable through xml?

I’m having a bit of a problem trying to figure out how to accomplish the following:

I have these two time table blocks as below and I want to read content from an XML file to populate them using PHP.

Using the following XML to populate the blocks:

[CODE] ….

<entry id=”1″>
<block1>
<name>Class 1</name>
<start>12:00</start>
<end>2:00</end>
</block1>
</entry>

<entry id=”2″>
<block2>
<name>Class 1</name>
<start>12:00</start>
<end>1:00</end>
</block2>
</entry>

<entry id=”3″>
<block1>
<name>Class 2</name>
<start>2:00</start>
<end>3:30</end>
</block1>
</entry>

….[/CODE]

So the outcome would be:
[URL=”http://imgur.com/4JKQDBP”]http://imgur.com/4JKQDBP[/URL]

The problem I’m having is I can’t figure out how to dynamically fill in the blocks based on the XML. I was thinking about slicing up each block into equal parts (maybe by 15 minutes) then filling them in depending on the length of each class but I feel there would be an easier way of doing so and I want to overlay the name over each block (so it might be easier to have full blocks not multiple small ones combined). I think I’ll be using simpleXML to check the names of each block from the XML to know which block to fill but can’t figure out how to set the times so could do with some tips on where to start. Sorry if this is a bit unclear, I can elaborate if needed.

to post a comment
HTML

0Be the first to comment 😎

×

Success!

Help @james92 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 6.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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...