View previous topic :: View next topic |
Author |
Message |
mikelittle
Joined: 11 May 2002 Posts: 376 Location: UK
|
Posted: Mon Aug 19, 2002 10:04 pm Post subject: Recently updated list not escaped enough |
|
|
Michel,
The recently updated list which now includes the subject of the most recent blog as a tool tip (great idea by the way), needs some more html chars escaping in it.
It's stopping my page form validating.
For instance someone had used italic tags in their subject. resulting in <i> in the tooltip. As this ends up inside an attribute of the anchor tag, it needs escaping to be <i>
Thanks,
Mike |
|
Back to top |
|
 |
michel v Site Admin
Joined: 25 Jan 2002 Posts: 799 Location: Corsica
|
Posted: Tue Aug 20, 2002 12:32 pm Post subject: |
|
|
Oops. Off to update this. |
|
Back to top |
|
 |
.Chris
Joined: 30 Apr 2002 Posts: 186 Location: Hawaii
|
Posted: Tue Aug 20, 2002 6:51 pm Post subject: |
|
|
Is there any way to limit the output? Instead of 50 something links just 10 or 20? Not in the main output, just in the way it shows up on your own site. |
|
Back to top |
|
 |
michel v Site Admin
Joined: 25 Jan 2002 Posts: 799 Location: Corsica
|
Posted: Wed Aug 21, 2002 12:48 am Post subject: |
|
|
[php:1:ee4e812d8c]<?php
$how_many_links = 20;
$b2updates = file('http://cafelog.com/changes.php');
for($i=0; $i<$how_many_links; $i++) {
echo $b2updates[$i]."\n";
}
?>[/php:1:ee4e812d8c] |
|
Back to top |
|
 |
mikelittle
Joined: 11 May 2002 Posts: 376 Location: UK
|
Posted: Wed Aug 21, 2002 1:02 am Post subject: |
|
|
Thanks Michel.
A very useful tip. |
|
Back to top |
|
 |
.Chris
Joined: 30 Apr 2002 Posts: 186 Location: Hawaii
|
Posted: Wed Aug 21, 2002 1:09 am Post subject: |
|
|
Thanks Michel!
(I can't help but feel stupid, I probibly could have found that on the net somewhere.) |
|
Back to top |
|
 |
dotdotspace
Joined: 15 Mar 2002 Posts: 138 Location: Seattle, WA
|
Posted: Thu Aug 29, 2002 1:26 am Post subject: |
|
|
my only problem with this code (and note: windows, iis 5, php4.2.2 or 4.2.3) was that the for loop would show as many links as $how_many_links defined, minus 1. so i was getting 19 links when i wanted 20 (as an example).
my quick code mod lies on line 5, where the second expression was "$i<$how_many_links", it is now:
[php:1:5e7896087a]<?php
$how_many_links = 25;
$b2updates = file('http://cafelog.com/changes.php');
for($i=0; $i<=$how_many_links; $i++) {
echo $b2updates[$i]."\n";
}
?>[/php:1:5e7896087a] |
|
Back to top |
|
 |
michel v Site Admin
Joined: 25 Jan 2002 Posts: 799 Location: Corsica
|
Posted: Thu Aug 29, 2002 3:19 am Post subject: |
|
|
This is pretty weird.
According to the original loop, $i goes from 0 to 24, since [0] is the first element of the array and [24] is the 25th.
Try putting echo $i; in the loop to see which values $i is assigned as the loop rolls. It just doesn't seem right that it displays only 24 elements... |
|
Back to top |
|
 |
dotdotspace
Joined: 15 Mar 2002 Posts: 138 Location: Seattle, WA
|
Posted: Thu Aug 29, 2002 3:43 am Post subject: |
|
|
yeah i was confused too, but my mod seems to have fixed it. either way, it works now. |
|
Back to top |
|
 |
dotdotspace
Joined: 15 Mar 2002 Posts: 138 Location: Seattle, WA
|
Posted: Thu Aug 29, 2002 8:03 pm Post subject: |
|
|
and today i just saw that the script was outputting 26 instead of 25.. odd, seeing as how it did not do that yesterday. so the code is back to the way you gave it, michel. odd, again. |
|
Back to top |
|
 |
mikelittle
Joined: 11 May 2002 Posts: 376 Location: UK
|
Posted: Fri Aug 30, 2002 12:42 am Post subject: |
|
|
I too noticed that it would sometimes output one less than expected.
When I last noticed it, my page would not pass muster as XHTML compliant.
Looking into it I discovered that the last entry was an incomplete tag.
It appears that if the name of the blog has a new line in it, the code which returns an array of strings counts that as two lines, therefore two entries in the array. Hence you get one less link output.
Sorry I didn't report it at the time, I must have been busy.
Now if only I could remember which blog it was... |
|
Back to top |
|
 |
dotdotspace
Joined: 15 Mar 2002 Posts: 138 Location: Seattle, WA
|
Posted: Fri Aug 30, 2002 6:56 am Post subject: |
|
|
mine list is exiting at either Lele's (drollery.lethien.com) or the Alicia Keyes Fan - Live News (akf.monosyllabically.com) blogs. the output is
Quote: | 7-8. Lele
9-9. Alicia Keys Fan - Live News
|
the code to output this is in the for loop:
[php:1:a5c748869b]for($i=0; $i<$how_many_links; $i++) {
echo $i."-";
echo $b2updates[$i]."\n";
}[/php:1:a5c748869b]
so we know where it's escaping, but why (most likely a newline somewhere) is another story. |
|
Back to top |
|
 |
dotdotspace
Joined: 15 Mar 2002 Posts: 138 Location: Seattle, WA
|
Posted: Sat Aug 31, 2002 9:37 pm Post subject: |
|
|
ideas? |
|
Back to top |
|
 |
mikelittle
Joined: 11 May 2002 Posts: 376 Location: UK
|
Posted: Sat Aug 31, 2002 10:08 pm Post subject: |
|
|
As I mentioned previously. Some of the url's seem to have newlines in them.
Right this minute, the most recently updated is Lele's site. The code comes out like this:
Code: |
<h4>recently updated b2 blogs</h4>
1. <a href="http://drollery.lethien.com
" title="Updated @ 20:30 GMT - Last post : 'Guess who\'s back, back again...'">Lele</a><br />
2. <a href="http://www.adamwalker.34sp.com/index.php" title="Updated @ 20:13 GMT - Last post : 'b2archives hack V1.02'">The B2 Dev Suite</a><br />
|
Note that there is a newline before the closing quote in the first href.
Here's one theory:
I'm guessing that the registered users who ping cafelog.tidakada.com are stored in a database somewhere. It would seem that some entries have a newline at the ned of them thus when the software retrieves the data and outputs it as html, we get the effect above.
If this IS the case I guess Michel needs to clean his database.
Hope this helps,
Mike |
|
Back to top |
|
 |
.Chris
Joined: 30 Apr 2002 Posts: 186 Location: Hawaii
|
Posted: Sat Aug 31, 2002 10:14 pm Post subject: |
|
|
It doesn't do any of the things you all have discribed seeing it doing for me? |
|
Back to top |
|
 |
|