TFD3 Posted April 4, 2009 Share Posted April 4, 2009 I have been trying to find a way to add a atom feed and a xsl style file into a php file. I have searched and searched and can not find anything. The atom feed: http://www.weather.gov/alerts-beta/al.atom The xsl style sheet: http://www.alabamaweather.org/rss/capatom.xsl somehow both of those need to go into a php file i.e. warn.php I have tried but keep getting an error. Thanks, Kenny Quote Link to comment Share on other sites More sharing options...
Maq Posted April 4, 2009 Share Posted April 4, 2009 And what's your question? Quote Link to comment Share on other sites More sharing options...
TFD3 Posted April 4, 2009 Author Share Posted April 4, 2009 I need to be able to display the output of both of those files using PHP. It would be as if I wanted to use an include statement to display two php pages in one php file. Quote Link to comment Share on other sites More sharing options...
TFD3 Posted April 4, 2009 Author Share Posted April 4, 2009 OK. I got half of this working. Here is the script that is half complete: <?php - xsl line - $homepage = file_get_contents('http://www.weather.gov/alerts-beta/al.php?x=0'); echo $homepage; ?> I need to add the xsl line in the php script: <?xml-stylesheet href='capatom.xsl' type='text/xsl'?> however I cant just add that under <?php Any ideas on how to include this?? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted April 4, 2009 Share Posted April 4, 2009 Just echo it above the other echo... Quote Link to comment Share on other sites More sharing options...
TFD3 Posted April 4, 2009 Author Share Posted April 4, 2009 Just echo it above the other echo... It didnt work: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home2/alabamaw/public_html/rss/test2.php on line 3 <?php $homepage = file_get_contents('http://www.weather.gov/alerts-beta/al.php?x=0'); echo '<?xml-stylesheet href='capatom.xsl' type='text/xsl'?>'; echo $homepage; ?> Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted April 4, 2009 Share Posted April 4, 2009 You cannot have a single quote within a single quote delimited string without escaping it. Quote Link to comment Share on other sites More sharing options...
TFD3 Posted April 4, 2009 Author Share Posted April 4, 2009 You cannot have a single quote within a single quote delimited string without escaping it. If this is what your talking about I tired it and still got an error. <?php $homepage = file_get_contents('http://www.weather.gov/alerts-beta/al.php?x=0'); echo '\<?xml-stylesheet href=\'capatom.xsl\' type=\'text/xsl\'?\>'; echo $homepage; ?> Quote Link to comment Share on other sites More sharing options...
TFD3 Posted April 4, 2009 Author Share Posted April 4, 2009 any possible ideas? i have not touched PHP in a long time. thanks Quote Link to comment Share on other sites More sharing options...
TFD3 Posted April 4, 2009 Author Share Posted April 4, 2009 i finally got it with some outside help. thanks to those who helped me get half way Quote Link to comment Share on other sites More sharing options...
Maq Posted April 5, 2009 Share Posted April 5, 2009 Looks like you solved this but, you didn't mark it [sOLVED] so... You can use single quotes for attributes inside a double quoted string: $homepage = file_get_contents('http://www.weather.gov/alerts-beta/al.php?x=0'); echo ""; echo $homepage; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.