|
|
|
|
Thread title: JavaScript feeds |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
06-02-2005, 07:25 PM
|
#1
|
Status: I love this place
Join date: Jan 2005
Location: The Netherlands
Expertise: Frontend, vBulletin
Software: Coda, Photoshop
Posts: 607
|
JavaScript feeds
I made this file that generates feeds with JavaScript and PHP, simular to what W3Reports uses.
The file is called feed.php for now and when I view it I see this:
Code:
document.write('<a target="_blank" href="http://localhost/tutorial/7/a-design-tutorial/">A design tutorial :)</a><br />');
document.write('<a target="_blank" href="http://localhost/tutorial/6/a-design-tutorial/">A design tutorial :)</a><br />');
document.write('<a target="_blank" href="http://localhost/tutorial/5/some-tutorial-that-teaches-you-the-basics-of-php/">Some tutorial that teaches you the basics of PHP</a><br />');
document.write('<a target="_blank" href="http://localhost/tutorial/4/Tutorial test yada-yada/">Tutorial test yada-yada</a><br />');
document.write('<a target="_blank" href="http://localhost/tutorial/3/3-column-layout-with-divs/">3 Column layout with divs</a><br />');
document.write("<br />Tutorials by <a href="http://www.xamer.net" title="Visit Xamer">Xamer</a>");
Which is good.
Now to include it on a page I'll have to use code like this:
Code:
<script src="http://localhost/feed.php" type="text/javascript"></script>
Nothing's showing up on my page though, does anyone know why this is happening?
|
|
06-03-2005, 03:11 PM
|
#2
|
Status: I love this place
Join date: Jan 2005
Location: The Netherlands
Expertise: Frontend, vBulletin
Software: Coda, Photoshop
Posts: 607
|
11 views in almost 24 hours ..
No one?
|
|
06-03-2005, 05:55 PM
|
#3
|
Status: Member
Join date: Feb 2005
Location: UK
Expertise:
Software:
Posts: 335
|
As far as I can tell, it should work.
Tried removing the space between the document.write's?
|
|
06-03-2005, 08:18 PM
|
#4
|
Status: Member
Join date: Aug 2004
Location: United States
Expertise:
Software:
Posts: 244
|
A link to the actual site where it is used might be useful.
When you say you see the javascript "document.write...", do you see this when you goto the PHP page (parse it), or when you include the script to a page (in the way you showed us)?
|
|
06-03-2005, 08:44 PM
|
#5
|
Status: I love this place
Join date: Jan 2005
Location: The Netherlands
Expertise: Frontend, vBulletin
Software: Coda, Photoshop
Posts: 607
|
I just realized I used " for the last rule instead of '
Thanks for responding all
|
|
06-11-2005, 09:06 AM
|
#6
|
Status: I'm new around here
Join date: Jun 2005
Location: Dallas, TX
Expertise:
Software:
Posts: 8
|
if you named it "feed.php", the server is going to see it as "php"...so i think ure problem lies in the original program. you forgot the opening/closing tags of php, so it should read:
Code:
<?php
document.write('<a target="_blank" href="http://localhost/tutorial/7/a-design-tutorial/">A design tutorial :)</a><br />');
document.write('<a target="_blank" href="http://localhost/tutorial/6/a-design-tutorial/">A design tutorial :)</a><br />');
document.write('<a target="_blank" href="http://localhost/tutorial/5/some-tutorial-that-teaches-you-the-basics-of-php/">Some tutorial that teaches you the basics of PHP</a><br />');
document.write('<a target="_blank" href="http://localhost/tutorial/4/Tutorial test yada-yada/">Tutorial test yada-yada</a><br />');
document.write('<a target="_blank" href="http://localhost/tutorial/3/3-column-layout-with-divs/">3 Column layout with divs</a><br />');
document.write("<br />Tutorials by <a href="http://www.xamer.net" title="Visit Xamer">Xamer</a>");
?>
hope this helps, if not, keep posting.
|
|
06-11-2005, 10:39 AM
|
#7
|
Status: Member
Join date: Feb 2005
Location: UK
Expertise:
Software:
Posts: 335
|
But then you would have to write "echo 'document...';"
Its fixed now anyway.
|
|
06-11-2005, 11:29 AM
|
#8
|
Status: I love this place
Join date: Jan 2005
Location: The Netherlands
Expertise: Frontend, vBulletin
Software: Coda, Photoshop
Posts: 607
|
Hey drew
It is PHP, I just posted the outcome of when I view the file in my browser.
|
|
06-11-2005, 06:38 PM
|
#9
|
Status: I'm new around here
Join date: Jun 2005
Location: Dallas, TX
Expertise:
Software:
Posts: 8
|
Originally Posted by Bas
Hey drew
It is PHP, I just posted the outcome of when I view the file in my browser.
|
whats up bas.
the thing is though, if you really put the code above it (the one you wrote, not the one i did), then that really isnt php. all you did was name it a php document, but it was all javascript. so you really wrote a javascript program, not a php program.
|
|
06-11-2005, 07:06 PM
|
#10
|
Status: Member
Join date: Jan 2005
Location: Warrington, England
Expertise:
Software:
Posts: 285
|
He means he put all of the code you put into it, but because he had an error in his code, when viewing the actual document it actually displayed that section of code from feed.php. It didnt display the <?php and echo's, just them lines, instead of actually putting them to use.
I think.
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|