Jump to content

Kritical_V

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Kritical_V's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I have been working on a small piece of code for the last day or so, and I have gone through over one hundred resources, and frankly it's beaten me. What I am attempting to do is pull a small bit of data from a XML file served through the youtube api. I have am attempting to pull data from a xml file through a url like the below: https://gdata.youtube.com/feeds/api/playlists/CA22CCE64DD2CCBE?v=2&max-results=1 The code should pull data about latest video from a selected playlist on youtube... <?php // FEED URL $feedURL = 'https://gdata.youtube.com/feeds/api/playlists/CA22CCE64DD2CCBE?v=2&max-results=1'; // read feed into SimpleXML object $sxml = simplexml_load_file($feedURL);?> //Code to output a specific piece of data from the xml file <?php echo $sxml->entry->{'media:group'}{'media:description'}; ?> I have skimmed the fat off the xml file so you can see the piece of data easily that I am trying to output. <?xml version='1.0' encoding='UTF-8'?> <feed xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:gd='http://schemas.google.com/g/2005' xmlns:yt='http://gdata.youtube.com/schemas/2007' gd:etag='W/"CUAFSH47eCp7I2A9WhJQEE4."'> <entry gd:etag='W/"YDwqeyM."'> <media:group> <media:player url='https://www.youtube.com/watch?v=dCVmk66ldkE9w&feature=youtube_gdata_player'/></media:group> </entry> </feed> I need my code above to pull the media:player url and echo it out in plain text form. It's seems like I don't no my syntax for working with xml and I guess it's something simple. If anyone can help I would be greatly appreciated.
  2. Okay so I am really new to php and xml and I'm a little over my head, What I am looking to do seems simple enough but I cannot figure it out.. So I put together this quick snippet to create a url to a xml file for different users <?php $stream = "ipllol"; // ADD A USERNAME FROM JUSTIN.TV HERE $user_data = "http://api.justin.tv/api/channel/show/" . $stream . ".xml"; ?> This creates the following url: http://api.justin.tv/api/channel/show/ipllol.xml Now I want to output the data off that xml document into my page, I also want to input each variable separately for styling purposes such as: <?php some code that displays the subcategory from the xml document ?> and so on. Thanks
  3. Okay, <?php $filename = bloginfo('template_directory') . '/images/hubs/' . single_cat_title() . '.jpg'; if (file_exists('bloginfo('$filename')) { //show it } else { echo "IMAGE NOT FOUND"; } dc ?> That's the exact code I'm using, It's outputting the following as text: http://www.mysitesadress.com/content/themes/mythemeEntertainment The http://www.mysitesadress.com/content/themes/mytheme is from the bloginfo('template_directory') bit and Entertainment is from the single_cat_title() bit It should out put the image found at: http://www.mysitesadress.com/content/themes/mytheme/images/hubs/Entertainment.jpg and if its not found should run the Else clause.
  4. No I have already tried that its still not outputting. Thats the actual code, The URL isn't tho. I'm considering rewarding whoever can do this...
  5. Okay been playing with it for the last hour and still nothing so I ask again for help. Please someone lend a hand.
  6. It outputs the url wrong: http://www.mywebsite.com/content/themesEntertainment (Entertainment is the category name) It should print http://www.mywebsite.com/content/themes/images/hubs/Entertainment.jpg The /images/hubs/ & .jpg does not print.
  7. Okay I fixed that problem, <?php $filename = bloginfo('template_directory') . '/images/hubs/' . single_cat_title() . '.jpg'; if (file_exists($filename)) { //show it } else { } dc ?> However the following is not printing: . '/images/hubs/' . . '.jpg' again any ideas Thanks
  8. Thats on the line you just gave me any ideas whats wrong? <?php $filename = bloginfo('template_directory') . '/images/hubs/' . single_cat_title() . '.jpg'; if (file_exists('bloginfo('$filename')) { //show it } else { echo "IMAGE NOT FOUND"; } dc ?>
  9. Hello. This is my first post here and I was hoping someone can give me a hand, I am trying to develop a small piece of code that will display and image on my blog however if it cannot be found it shows some text. <?php $filename = '<?php bloginfo('template_directory');?>/images/hubs/<?php single_cat_title();?>.jpg'; if (file_exists('bloginfo('$filename')) { //show it } else { echo "Hello World"; } dc ?> The problem is with the second line, I am using two wordpress functions to generate the URL however I am new to PHP and there is something wrong with my code. Can anyone help Please... Thank You
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.