boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

<link rel="bookmark"> tags

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
sh0ck



Joined: 02 May 2004
Posts: 56
Location: Norway

PostPosted: Mon Sep 06, 2004 8:53 am    Post subject: <link rel="bookmark"> tags Reply with quote

If you want to create <link bookmark> tags to add a navigation tool to those who use text-based browsers, such as Lynx. Insert this before </head>:

Code:

<?php

require "blog.header.php";

$last_10 = mysql_query("SELECT ID, post_title, post_date FROM $tableposts WHERE post_category != '0' ORDER BY post_date DESC LIMIT 10");
while ($post = mysql_fetch_array($last_10)) {
    if ($p != $post['ID']) {
        echo "<link rel=\"bookmark\" href=\"".$HTTP_SERVER_VARS['PHP_SELF']."?p=".$post['ID']."&more=1&c=1\" title=\"".stripslashes($post['post_title'])."\" />\n";
    }
}
?>


This will give the user a list of your 10 most recent articles in the top of the page. It gives your site an additional accessibility feature. It will not be visible to graphical browsers.

The output will look like this:
Code:

<link rel="bookmark" href="http://www.url.to.posts" title="title of post" >
<link rel="bookmark" href="http://www.url.to.posts" title="title of post" >
<link rel="bookmark" href="http://www.url.to.posts" title="title of post" >


Update 01/11/04: If you get an MySQL error put the code into another file (i.e. tags.php) and include it using <?php include "tags.php";>. You should also get the HTML semantics right by placing it directly before </head>. Ergo, after <title> and your stylesheet.
_________________
http://www.licklinux.com


Last edited by sh0ck on Mon Nov 01, 2004 11:01 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Sigg3



Joined: 03 Jul 2003
Posts: 906
Location: Oslo, Norway

PostPosted: Mon Oct 18, 2004 2:19 pm    Post subject: Reply with quote

I got a:
Quote:
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/.sites/144/site218/web/index.php on line 215

Where 215 was:
Code:
<?php while($row = mysql_fetch_object($result)) { start_b2(); ?>

when your script as posted above was put before </head> in my index.php. Any idea what's wrong?

The reason why I was installing it was something I read at slashdot, where several geeks(?!) stated that pages incompatible with lynx were not noteworthy:) A good read: Web authoring and Lynx by Extremely Lynx.

I removed the mirror @ b2RC temporary, till the problem is solved.
_________________
Sigg3.net - You know you're worth it! | b2 Cafelog Resource Center | Fight my BattleImp!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
sh0ck



Joined: 02 May 2004
Posts: 56
Location: Norway

PostPosted: Fri Oct 29, 2004 6:50 pm    Post subject: Reply with quote

sorry to reply so late, but i've been absent for a bit.

anyway, are you sure that it is before the <head> tag and the b2-loop start? i've helped a couple via e-mail to get it installed, without any problem.

demo: view source at http://www.licklinux.com

hmm... maybe you have mixed some variables from other non-related scripts which interrupts the process... i dunno... sorry.

any other ideas?
_________________
http://www.licklinux.com
Back to top
View user's profile Send private message Visit poster's website
Sigg3



Joined: 03 Jul 2003
Posts: 906
Location: Oslo, Norway

PostPosted: Sat Oct 30, 2004 11:54 pm    Post subject: Reply with quote

I had it before <head> and the loop, but was it supposed to be above the line calling blog.header.php as well. Like, Really on top of everything?
_________________
Sigg3.net - You know you're worth it! | b2 Cafelog Resource Center | Fight my BattleImp!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
sh0ck



Joined: 02 May 2004
Posts: 56
Location: Norway

PostPosted: Sun Oct 31, 2004 10:07 am    Post subject: Reply with quote

create at new file called tags.php, and copy the code in there. then include it in your blog using:
Code:
<? include "tags.php"; ?>

it should do the trick.
_________________
http://www.licklinux.com
Back to top
View user's profile Send private message Visit poster's website
Sigg3



Joined: 03 Jul 2003
Posts: 906
Location: Oslo, Norway

PostPosted: Wed Nov 03, 2004 5:02 pm    Post subject: Reply with quote

I had to remove the require blog.header.php (it's already mentioned at the top of the index.php anyway...), is that all right in security-perspective?

Updated http://sigg3.net/cafelog with the working script!
_________________
Sigg3.net - You know you're worth it! | b2 Cafelog Resource Center | Fight my BattleImp!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
sh0ck



Joined: 02 May 2004
Posts: 56
Location: Norway

PostPosted: Wed Nov 03, 2004 10:50 pm    Post subject: Reply with quote

yes of course. thats fine! the script is supposed to fully functional on any page, and therefore the "require" tag. if you insert it directly, you can (must?) remove it.
_________________
http://www.licklinux.com
Back to top
View user's profile Send private message Visit poster's website
Sigg3



Joined: 03 Jul 2003
Posts: 906
Location: Oslo, Norway

PostPosted: Wed Nov 17, 2004 1:04 pm    Post subject: Reply with quote

Uhm.. there's a "flaw" in the script.
My code is not valid, because the ampersands, &, aren't coded.

Code:
Line 73, column 44: cannot generate system identifier for general entity "more"
[quote]...el="bookmark" href="/index.php?p=513&more=1&c=1" title="Scariest picture of t[/quote]


Can you fix it so that it codes & to &?
_________________
Sigg3.net - You know you're worth it! | b2 Cafelog Resource Center | Fight my BattleImp!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Sigg3



Joined: 03 Jul 2003
Posts: 906
Location: Oslo, Norway

PostPosted: Thu Nov 18, 2004 11:15 pm    Post subject: Reply with quote

It also makes an:
Quote:
end tag for element "HEAD" which is not open
which screwes up the validation.

I've noticed that this is an issue when linking RSS as well. Any tips?
_________________
Sigg3.net - You know you're worth it! | b2 Cafelog Resource Center | Fight my BattleImp!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group