Jump to content

m1kcal

Members
  • Content Count

    10
  • Joined

  • Last visited

Community Reputation

0 Neutral

About m1kcal

  • Rank
    Member
  1. Update from above: $event_display="<html> <head> <title>Devils' match</title> <link rel='stylesheet' type='text/css' href='main.css' /> </head> </body> <div class='container'> <div class='container-inner'> <div class='datetime'>###FROM###</div> <div class='main'> ###TEAM_IMAGE### <div class='mid'>###TITLE###</div> ###TEAM_IMAGE2### </div> <div class='stadium'>###WHERE###</div> </div> </div> </body> </html>"; The only thing that is messed up is the ###FROM### which is in <div class='datetime'> . For some reason is all out of position unlike the rest, http://i58.tinypic.com/28gz7lc.png
  2. I actually got it to work, but, my last obstacle is echoing the other html elements. This is the entire page I need to be echoed out <html> <head> <title>Devils' match</title> <link rel='stylesheet' type='text/css' href='css/main.css' /> </head> </body> <div class='container'> <div class='container-inner'> <div class='datetime'>###FROM###</div> <div class='main'> <div class='left'>###TEAM_IMAGE###</div> <div class='mid'>###TITLE###</div> <div class='right'>###TEAM_IMAGE2###</div> </div> <div class='stadium'>###WHERE###</div> </div> </div> </body> </html> So what I tried is putting the entire code above between the following double quotes: $event_display=" "; The result is this: http://i62.tinypic.com/sg33if.png ; this is what it should be: http://i61.tinypic.com/9kyqsj.png I triple checked all the paths for the css and images everything is fine.
  3. I tried that, but it is always showing the unavailable.png logo; the name of all pictures are same as the team names in lower case with no spaces.
  4. Let me show you what I did and the result; the code you gave me few posts ago, I added to it, // default replacement ###TEAM_IMAGE### placeholder valuem an empty string $team_image = ''; // if the entry title contains the team name at the start of the string if (0 === strpos($entry->title, 'Arsenal')) { $team_image = "<div id='left'><img src='logos/sunderland.png' /></div>"; } elseif (0 === strpos($entry->title, 'Aston Villa')) { $team_image = "div id='left'><img src='logos/astonvilla.png' /></div>"; } elseif (0 === strpos($entry->title, 'Burnley')) { $team_image = "div id='left'><img src='logos/burnley.png' /></div>"; } elseif (0 === strpos($entry->title, 'Chelsea')) { $team_image = "div id='left'><img src='logos/chelsea.png' /></div>"; } elseif (0 === strpos($entry->title, 'Crystal Palace')) { $team_image = "div id='left'><img src='logos/crystalpalace.png' /></div>"; } elseif (0 === strpos($entry->title, 'Everton')) { $team_image = "div id='left'><img src='logos/everton.png' /></div>"; } elseif (0 === strpos($entry->title, 'Hull City')) { $team_image = "div id='left'><img src='logos/hull.png' /></div>"; } elseif (0 === strpos($entry->title, 'Leicester City')) { $team_image = "div id='left'><img src='logos/leicester.png' /></div>"; } elseif (0 === strpos($entry->title, 'Liverpool')) { $team_image = "div id='left'><img src='logos/liverpool.png' /></div>"; } elseif (0 === strpos($entry->title, 'Manchester City')) { $team_image = "div id='left'><img src='logos/manchestercity.png' /></div>"; } elseif (0 === strpos($entry->title, 'Manchester United')) { $team_image = "div id='left'><img src='logos/manchesterunited.png' /></div>"; } elseif (0 === strpos($entry->title, 'Newcastle United')) { $team_image = "div id='left'><img src='logos/newcastle.png' /></div>"; } elseif (0 === strpos($entry->title, 'Queens Park Rangers')) { $team_image = "div id='left'><img src='logos/qpr.png' /></div>"; } elseif (0 === strpos($entry->title, 'Southampton')) { $team_image = "div id='left'><img src='logos/southampton.png' /></div>"; } elseif (0 === strpos($entry->title, 'Stoke City')) { $team_image = "div id='left'><img src='logos/stoke.png' /></div>"; } elseif (0 === strpos($entry->title, 'Sunderland')) { $team_image = "div id='left'><img src='logos/sunderland.png' /></div>"; } elseif (0 === strpos($entry->title, 'Swansea')) { $team_image = "div id='left'><img src='logos/swansea.png' /></div>"; } elseif (0 === strpos($entry->title, 'Tottenham Hotspur')) { $team_image = "div id='left'><img src='logos/tottenham.png' /></div>"; } elseif (0 === strpos($entry->title, 'West Bromwich Albion')) { $team_image = "div id='left'><img src='logos/wba.png' /></div>"; } elseif (0 === strpos($entry->title, 'West Ham United')) { $team_image = "div id='left'><img src='logos/westham.png' /></div>"; } elseif (0 === strpos($entry->title, 'MK Dons')) { $team_image = "div id='left'><img src='logos/mkdons.png' /></div>"; } else { $team_image = "div id='left'><img src='logos/unavailable.png' /></div>"; } // replace the ###TEAM_IMAGE### placeholder $temp_event=str_replace("###TEAM_IMAGE###", $team_image,$temp_event); And the result of the modification is this picture: I can't figure out why it is echoing div id='left"> next to the picture. Also, yes, I know there are 3 far more efficient ways I can think off but I went for the simplest one for now. Any suggestion what it could be?
  5. That is interesting. What if I wanted to use a function instead of a single variable like in the case of $team_image given that the function would have couple echo spitting out , for example function TeamImgs() { ...... ....... ..... echo ("<div id='left'><img src='sun.png' /></div>"); echo ("<div id='right'><img src='sun2.png' /></div>"); } And then this would change to $temp_event=str_replace("###TeamImgs###", $team_image,$temp_event); And also this one to, $event_display="<P><B>###TITLE###</b> - from ###FROM### ###DATESTART### until ###UNTIL### ###DATEEND### (<a href='###LINK###'>add this</a>)<BR>###WHERE### (<a href='###MAPLINK###'>map</a>)<br>###TeamImgs### ###DESCRIPTION###</p>"; Would that work, or am I completely wrong here
  6. First I would like to thank you for helping me out. I just tried your suggestion/code , and it worked flawlessly. Second, although it works, I don't think I am fully understanding the entire code or process. I understand that the team_image variable is first set to an empty string. Then, in the if statement it is being set to the img tag if it matches the criteria, but then the last part I don't quite get; it's confusing me. In the last line of code, what is the point of using ###_### ? Why can't we just reference it by $team_image for example?
  7. What I am trying to accomplish is, for example, if the title returns as Sunderland - Manchester United, I want to check if the first word is Sunderland, and if it is, to echo a html img code, something like: if (0 === strpos($entry->title, 'Sunderland')) { echo "<div id='left'><img src='sun.png' /></div>"; }
  8. Yes, that was the second thing I tried Ch0cu3r, but, when I echo it, it returns all titles, not just the one
  9. Hey guys. I just recently started learning php and I like to learn hands on. So, my first project involves the Google Calendar. I found a script on github that is basically a Google calendar feed and I've been manipulating it to meet my personal needs and expectations, but the only thing I am struggling with is the xml part. All I want to do in this case is get the value from ###TITLE### (after it is sorted by newest date which is done automatically in the script) and store it in a new variable but no matter what I try or do and after reading a bunch of material on xml and php, I still cannot get it to work. If anyone knows how to do this and provide an explanation so I can actually learn I would really really appreciate it. Here is the github script https://github.com/media-uk/GCalPHP/blob/master/gcalphp.php Thank you and I am looking forward to any suggestions or anything.
×
×
  • 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.