Jump to content

Windows 8 Metro Tiles


Craig Hopson

Recommended Posts

Hi guys I have been playing with the new windows 8 metro system and tiles i created this test file but cant get it to work as anyone had any dealings with this

<?phpif($_GET['id'] == ''){?><!DOCTYPE html><html><head>    <meta charset="utf-8" />    <META name="msapplication-badge" content="frequency=30; polling-uri=http://chsites.co.uk/test.php?id=1"/>    <title>Test Site</title></head><body>    <h1>TwitterRooms</h1>    <p>Some content here</p></body></html><?php}else{header("Content-type: text/xml");$xml_output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";$xml_output .= "<badge value="newMessage"/>\n";echo $xml_output;?><?php}

Link to comment
Share on other sites

Why isn't DOCTYPE at the top of your script.
because he has it in a conditional statement. I assume he only want to output the HTML under the condition that $_GET['id'] is equal to an empty string. to the OP, could you please specify your problem and expectations? Just saying it doesn't work isn't very helpful. You have a conditional. is one part working and one part not? What debugging haver you tried? What about checking for errors? There's not much to go on with what you've given us.
Link to comment
Share on other sites

I still have no idea which part of the code is causing you problems. It might be helpful to point us to some documentation, and reference whatever tutorials, references you are using so we can follow along. Does the code work in just a regular browser environment?

Link to comment
Share on other sites

This is what I was following http://msdn.microsoft.com/en-gb/library/ie/hh880842(v=vs.85).aspx basically if you put meta tages on your site with a polling URL then windows will check your site for updates every 30min looking for XML output I just wanted to test it to see if it would work so I wrote the script above to test it but it didn't work so I post here

Link to comment
Share on other sites

it goes back to the basics....

What debugging haver you tried? What about checking for errors?
Does the code work in just a regular browser environment?
Link to comment
Share on other sites

I haven't done any debugging cos I don't see any errors in my script (above) and I there are no errors in my script then it must be a windows problem?????
Or your script is doing just what you told it to, but you told it to do the wrong thing.
Link to comment
Share on other sites

What about adding the META tag? It seems like that's important. They give you a checklist of things to do right at the top.
You must provide several pieces of information to correctly implement pinned site notifications in Windows 8
  • The location of the web service to poll for notifications
  • An up-to-date XML file that reflects the current badge state
  • The frequency with which updates should occur

looks you are only implementing 1 of 3.
Link to comment
Share on other sites

I have the meta tags in the script
technically. you have the meta tag in the if clause. your XML output is in the else clause. Are you familiar with how control structures work? Do you know exactly how your code is working? This is why you have to debug. Use it to prove that your code works, or use it to figure out why it isn't. I can prove my point simply by looking at the source of your page when I add ?id=somevalue to your url. All you get is the XML output. i.e http://chsites.co.uk/test.php?id=test (view source)
<?xml version="1.0" encoding="utf-8"?><badge value="newMessage"/>

If that's not what you intended, then you need to debug and figure out why.

Edited by thescientist
Link to comment
Share on other sites

Ahhh.... -_- Just... replace

header("Content-type: text/xml");$xml_output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";$xml_output .= "<badge value="newMessage"/>\n";echo $xml_output;

with

header("Content-type: application/xml");$xml_output = '<?xml version="1.0" encoding="utf-8"?><badge value="newMessage"/>';echo $xml_output;

And retry it. You may need to re-pin the site before the changes take effect.@thescientist While I can see you're trying to teach a man to fish, rather than giving him fish, which is all well and good... I think after the first failure, you may've wanted to postpone the fishing lesson, figuratively speaking.

Link to comment
Share on other sites

again, the source of http://chsites.co.uk/test.php?id=test

<?xml version="1.0" encoding="utf-8"?><badge value="newMessage"/>

doesn't show any of the other requirements from the link/spec you posted

What about adding the META tag? It seems like that's important. They give you a checklist of things to do right at the top. looks you are only implementing 1 of 3.
Edited by thescientist
Link to comment
Share on other sites

There is a meta tag at http://chsites.co.uk/test.php*. And with a frequency specified too. With the syntax error in the XML part now fixed, and http://chsites.co.uk/test.php?id=3 now pointing to a valid (according to the MSDN page) XML file, that's now 3 out of 3.If you're trying to give a different kind of hint, he's not getting it, and neither am I.* Unless what you're trying to say is that THAT page needs to be pinned, and not the XML file, or anything else with "?id" attached. Craig, you are doing that, right? You are not trying to pin the XML file?

Link to comment
Share on other sites

There is a meta tag at http://chsites.co.uk/test.php*. And with a frequency specified too. With the syntax error in the XML part now fixed, and http://chsites.co.uk/test.php?id=3 now pointing to a valid (according to the MSDN page) XML file, that's now 3 out of 3. If you're trying to give a different kind of hint, he's not getting it, and neither am I. * Unless what you're trying to say is that THAT page needs to be pinned, and not the XML file, or anything else with "?id" attached. Craig, you are doing that, right? You are not trying to pin the XML file?
I'm just going by what the OP has provided for documentation.
where at the time the top link gave clear instructions on what needed to be done
You must provide several pieces of information to correctly implement pinned site notifications in Windows 8
  • The location of the web service to poll for notifications
  • An up-to-date XML file that reflects the current badge state
  • The frequency with which updates should occur

His code has an if/else statement, where the if shows the meta tag, and the else shows the xml. Those two can't happen at the same time. My impression was that the XML output was relevant to the badge showing. Edited by thescientist
Link to comment
Share on other sites

My impression was that the XML output was relevant to the badge showing.
You're right. It is. However, if you look carefully at the "if" section, you'll see the URL being pointed at the meta tag is that exact same PHP file, except with an "?id" attached, which in turn triggers the XML file to show.With the XML's MIME type and syntax error fixed, I'm personally out of ideas, given the docs. I don't yet use Windows 8, so I can't debug this personally.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...