Jump to content

cahamilton

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cahamilton's Achievements

Member

Member (2/5)

0

Reputation

  1. Scratch that, just found the Apache server access in OS X. Cheers
  2. As in install these on my hard drive?? How would I go about doing that?
  3. Is it possible to set up some kind of "virtual web host" on my computer? I want to be able to start trying out things such as Wordpress and various other server side apps beforehand, and arrange some sort of hosting once my site is complete. I'd buy some hosting now, but I'm going travelling in 2 weeks for about 4 months, so it would be wasted money if I didnt have a site complete by then. On a side note, I'm currently running Mac OSX and use Dreamweaver CS3.
  4. Well anyway of doing it would be great. Would there be any advantages using explode() over the preg_replace?
  5. Hello again....quick question! How would I rewrite a variable, so that everything after a certain point in the text, is deleted? Currently, Im trying to do something like this: The Offspring – Long Way Home <<< Starting with this The Offspring <<< End like this So anything after the " – " I want to delete. I think it has something to do with preg_replace, but I cant quite seem to get my head around the actual function itself to rewrite it. Would anyone be able to explain it to me?
  6. That worked great thanks! I'll keep that in mind for next time
  7. Hey guys. I've been working on a script recently, which Im going to be using to take my recent "Tweets" from Twitter, and post them into my portfolio site. So far, all is good and I've been able to retrieve this data using the API feeds. The only problem is, I cant find anywhere in the API that allows me to control how many entries will show up on my page. Is there any way using PHP, to restrict how many entries are fed out? Here's the code I've been working with so far.... <?php $user_id = "USER_ID"; $feed_url = "http://twitter.com/statuses/user_timeline/".$user_id.".rss"; $sxml_twitter = @simplexml_load_file($feed_url); ?> <?php foreach ($sxml_twitter->channel->item as $entry) { $news_title = $entry->description; $date = $entry->pubDate; ?> <?php echo " <ul> <li class='tweet'>$news_title</li> <li class='date_twitter'>$date</li> </ul>"; ?> <?php } ?>
  8. Good stuff lol. I managed to get a caching system working in there last night aswell, which Im pretty proud of lol. A friend off my course messaged me, to tell me that she found her friend on there as well lol
  9. As part of my final year dissertation, I was required to produce a website that uses data scraping and feeds. With all this in mind, I have come up with Music Mashup. A website which takes advantage from the Flickr, Youtube, Last FM and Idiomag API's. Please take a look around and let me know what you think! If you also have a spare moment, please give the feedback form in the bottom right hand of the site a go. Or just post your comments back on here . www.cahamilton.at-uclan.com/fyp While I'm here, I just want to say cheers to some of the guys on here, who helped me out on this project. Very much appreciated !
  10. Bah fuck. I've figured it out. Thanks everyone for helping. If your interested, heres what fixed it: <?php if ($news_content2 != "") { echo "<ul class=\"news_item\"> <li><h2>$news_title2</h2></li> <li><span class='news_date'>$news_date2</span></li> <li>$news_content2...</li> <li><a href=\"$news_article_url\" title='$news_title2' class='readmore' target='_blank'>Read More</a></li> </ul>";} ?> <?php } ?> <?php if ($news_content2 == "") { echo "<p class='error'>Sorry, News For This Artist is Currently Unavailable.</p> <img src='images/error.gif' alt='Error' title='Error' class='center' /> <p class='error'>Please try again Later</p>";} ?> </div>
  11. The whole page code <?php $news_url = 'http://www.idiomag.com/api/artist/articles/rss?key=42306fb6d05692ad116515c562f48254&artist='; $artist_name = str_replace(" ","+",$artist_name); $artist_name_normalised = normaliser($artist_name); //takes out special charcters for news search $news_result = $news_url.$artist_name_normalised; // read feed into SimpleXML object $sxml_news = @simplexml_load_file($news_result);?> <h1 class="news_title">News Content</h1> <div id="news_stream"> <?php if($sxml_news && $sxml_news) // iterate over entries in feed foreach ($sxml_news->channel->item as $news_entry) { // Get news title $news_title = $news_entry->title; $news_title2 = ucwords($news_title); // sentence case // Date of publishment $news_date = $news_entry->pubDate; $news_date2 = str_replace(" +0100"," ",$news_date); // take out +0100 timezone from date in entry // URL to the news article $news_article_url = $news_entry->source; // Author of Article $news_author = $news_entry->author; $news_content = $news_entry->description; $news_content2 = strip_tags($news_content,''); $news_content3 = substr($news_content2,0,200); ?> <?php if ($news_content2 != "") { echo "<ul class=\"news_item\"> <li><h2>$news_title2</h2></li> <li><span class='news_date'>$news_date2</span></li> <li>$news_content2...</li> <li><a href=\"$news_article_url\" title='$news_title2' class='readmore' target='_blank'>Read More</a></li> </ul>"; } elseif ($news_content2 == "") { echo "<p class='error'>Sorry, News For This Artist is Currently Unavailable.</p> <img src='images/error.gif' alt='Error' title='Error' class='center' /> <p class='error'>Please try again Later</p>";} ?> <?php } ?> </div>
  12. No it doesnt work. I really cant see why. Any item that contains data echoes out fine, but if there anything that doesnt include data, the error message isn't echoing out for some reason. I cant figure it out, it was working fine last night. I cant remember what part of it I changed, which would be quite nice to know lol. Just an example Artist with News http://cahamilton.at-uclan.com/fyp/query.php?artist=Muse Artist without News http://cahamilton.at-uclan.com/fyp/query.php?artist=Bad+Astronaut+vs.+Armchair+Martian As you can see, the news echoes out nicely without a problem. With the artist with no news, nothing happens. It should generate an error message like the one below it.
  13. Yeh some of it is left out, its part of of a foreach loop, but I only changed that specific segment last night. I couldn't remember what I had done, so I only posted that bit. Ill give it a shot now once my FTP decides to start working...
  14. Can anyone figure out why this IF statement isn't currently working. I was working on part of my website last night and altered the code slightly. Now for some reason, I cant figure out what I did and how to fix it. <?php if ($news_content2 != "") { echo " <ul class=\"news_item\"> <li><h2>$news_title2</h2></li> <li><span class='news_date'>$news_date2</span></li> <li>$news_content2...</li> <li><a href=\"$news_article_url\" title='$news_title2' class='readmore' target='_blank'>Read More</a></li> </ul>"; } elseif ($news_content2 == "") { echo "<p class='error'>Sorry, News For This Artist is Currently Unavailable.</p>"; echo "<img src='images/error.gif' alt='Error' title='Error' class='center' /> "; echo "<p class='error'>Please try again Later</p>"; } ?> <?php } ?>
×
×
  • 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.