View previous topic :: View next topic |
Author |
Message |
sh0ck
Joined: 02 May 2004 Posts: 56 Location: Norway
|
Posted: Mon Sep 06, 2004 8:53 am Post subject: <link rel="bookmark"> tags |
|
|
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 |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 906 Location: Oslo, Norway
|
Posted: Mon Oct 18, 2004 2:19 pm Post subject: |
|
|
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 |
|
 |
sh0ck
Joined: 02 May 2004 Posts: 56 Location: Norway
|
Posted: Fri Oct 29, 2004 6:50 pm Post subject: |
|
|
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 |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 906 Location: Oslo, Norway
|
|
Back to top |
|
 |
sh0ck
Joined: 02 May 2004 Posts: 56 Location: Norway
|
Posted: Sun Oct 31, 2004 10:07 am Post subject: |
|
|
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 |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 906 Location: Oslo, Norway
|
|
Back to top |
|
 |
sh0ck
Joined: 02 May 2004 Posts: 56 Location: Norway
|
Posted: Wed Nov 03, 2004 10:50 pm Post subject: |
|
|
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 |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 906 Location: Oslo, Norway
|
Posted: Wed Nov 17, 2004 1:04 pm Post subject: |
|
|
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 |
|
 |
Sigg3
Joined: 03 Jul 2003 Posts: 906 Location: Oslo, Norway
|
|
Back to top |
|
 |
|