View previous topic :: View next topic |
Author |
Message |
pelao
Joined: 08 Jul 2003 Posts: 4
|
Posted: Tue Jul 08, 2003 11:44 pm Post subject: |
|
|
hi everybody! xD
thx mike 4 this hack, but i need a little help here, i dunno how to do this, i downloaded b2links with the hope of do this, but i can't figure it out how to do it.
here's a sshot , this i want to do...
(its ugly i know, i do it fast only for u get the idea)
there's a title
img, description and link.
i want to make sort of catalog, but after try alot i give up... anyone can help me?
thx!
ps: sorry for my english |
|
Back to top |
|
 |
confused_juvenille
Joined: 28 May 2003 Posts: 52 Location: bleh
|
Posted: Tue Jul 08, 2003 11:47 pm Post subject: |
|
|
I dont see the advantage really. =\ Sorry if that sounds insulting its not supposed to. What better would it do than just a simple Code: | <a href="" target="_blank">lala</a> | ? |
|
Back to top |
|
 |
mikelittle
Joined: 11 May 2002 Posts: 376 Location: UK
|
Posted: Wed Jul 09, 2003 1:05 am Post subject: |
|
|
Hi pelao
I like your ideas, but it is a lot more sophisticated than b2links' current functionality.
I do have some more things I want to do with b2links (probably the version built in to WordPress). So I will keep in mind these ideas of yours.
Mike _________________ Mike Little
http://zed1.com/journalized/
"Share what you know. Learn what you don't." |
|
Back to top |
|
 |
confused_juvenille
Joined: 28 May 2003 Posts: 52 Location: bleh
|
Posted: Wed Jul 09, 2003 1:24 am Post subject: |
|
|
I still dont understand what makes it better though? Does anyone want to explain? |
|
Back to top |
|
 |
Chuckie
Joined: 13 May 2002 Posts: 4
|
Posted: Thu Jul 10, 2003 5:33 am Post subject: |
|
|
I don't know if anyone has caught this or not .. but there is a bug in the SQL. Atleast when I tried to install it on mysql 4.
Code: |
CREATE TABLE b2links (
link_id int(11) NOT NULL auto_increment,
link_url varchar(255) NOT NULL default '',
link_name varchar(255) NOT NULL default '',
link_image varchar(255) NOT NULL default '',
link_target varchar(25) NOT NULL default '',
link_category int(11) NOT NULL default 0,
link_description varchar(255) NOT NULL default '',
link_visible enum ('Y','N') NOT NULL default 'Y',
link_owner int NOT NULL DEFAULT '1',
link_rating int NOT NULL DEFAULT '0',
PRIMARY KEY (link_id)
) TYPE=MyISAM;
|
if you look at this line
link_category int(11) NOT NULL default 0,
it's missing the ' ' around the zero.
it's an easy fix if your familar with SQL .. if not ...
Here is the name of the file I downloaded: b2links-1.2.zip
Thanks
Chuck |
|
Back to top |
|
 |
flickerfly
Joined: 06 May 2003 Posts: 49
|
Posted: Thu Jul 10, 2003 9:17 pm Post subject: |
|
|
confused_juvenille wrote: | I still dont understand what makes it better though? Does anyone want to explain? |
No direct editing of code, WYSIWYG like interface, easy to turn certain links on and off or do the auto-toggle thing. It would make life go a bit quicker for those who don't want to learn php or html or rss or any of "that cofusing letters and numbers and funny looking characters" things. _________________ Buzzing Bye | CougarNet News |
|
Back to top |
|
 |
confused_juvenille
Joined: 28 May 2003 Posts: 52 Location: bleh
|
Posted: Thu Jul 10, 2003 9:43 pm Post subject: |
|
|
oh alright. x_x it looks more useful now but ill stick to the old fashion way. |
|
Back to top |
|
 |
mikelittle
Joined: 11 May 2002 Posts: 376 Location: UK
|
Posted: Thu Jul 10, 2003 11:20 pm Post subject: |
|
|
Chuckie wrote: | I don't know if anyone has caught this or not .. but there is a bug in the SQL. Atleast when I tried to install it on mysql 4.
...
if you look at this line
link_category int(11) NOT NULL default 0,
it's missing the ' ' around the zero.
Chuck |
Ho Chuckie,
I'm surprised that that is a problem with MySQL 4. I currently use 3.23.x and there is no problem with this. Nor should there be, the default value for an integer column shoud not need to be a quoted string. How strange!
Thanks for this though, I will correct it in the next release.
Mike _________________ Mike Little
http://zed1.com/journalized/
"Share what you know. Learn what you don't." |
|
Back to top |
|
 |
mikelittle
Joined: 11 May 2002 Posts: 376 Location: UK
|
Posted: Wed Jul 16, 2003 11:53 pm Post subject: |
|
|
After pelao and wonka (by PM) asked about more expressive use of b2links, I have come up with this halfway attempt at meeting their requirements.
The result could look like this.
There are a few changes required and a caveat.
Firstly you will need to edit file b2links.php. Change the following in the function get_links() around line 150
From: Code: |
if (($row->link_url != null) || ($row->link_url != '')) {
$the_link = $row->link_url;
}
echo("<a href=\"".$the_link."\" title=\"" .
stripslashes($row->link_description) .
"\" target=\"$row->link_target\">");
if (($row->link_image != null) && $show_images) {
echo("<img src=\"$row->link_image\" border=\"0\" alt=\"" .
stripslashes($row->link_name) . "\" title=\"" .
stripslashes($row->link_description) . "\" />");
} else {
echo(stripslashes($row->link_name));
}
if ((($row->link_image != null) && $show_images) || !$show_description) {
echo("</a>");
} else {
echo("</a>$between" . stripslashes($row->link_description));
}
|
to Code: |
if (($row->link_url != null) && ($row->link_url != '')) {
$the_link = htmlspecialchars(stripslashes($row->link_url));
}
$desc = htmlspecialchars(stripslashes($row->link_description), ENT_QUOTES);
echo("<a href=\"".$the_link."\" title=\"" .
$desc . "\" target=\"$row->link_target\">");
if (($row->link_image != null) && $show_images) {
echo("<img src=\"$row->link_image\" border=\"0\" alt=\"" .
stripslashes($row->link_name) . "\" title=\"" .
$desc . "\" />");
} else {
echo(stripslashes($row->link_name));
}
echo('</a>');
if ($show_description) {
echo("$between" . $desc);
}
|
In the file b2linkmanager.php around line 236 change the following:
Code: |
<td height="20" align="right">Description:</td>
<td><input type="text" name="description" size="80" value="<?php echo $link_description; ?>"></td>
|
into Code: |
<td valign="top" height="20" align="right">Description:</td>
<td><textarea name="description" cols="60" rows="5"><?php echo $link_description; ?></textarea></td>
|
Finaly my sample template to produce the output above looks like this:
Code: |
<?
require_once('./b2config.php');
require_once('b2links.config.php');
require_once($b2inc.'/b2functions.php');
require_once('b2links.php');
?>
<html>
<body>
<h1>A test</h1>
<h2>link heading</h2>
<table border="1" width="50%">
<?php get_links(2, '<tr><td>', '</td></tr>', '</td><td valign="top">', true, 'name', true) ?>
</table>
</body>
</html>
|
Wonka change the border="1" to 0 to remove the border.
The caveat is that the description field can only hold 255 characters.
I hope this helps,
Mike _________________ Mike Little
http://zed1.com/journalized/
"Share what you know. Learn what you don't." |
|
Back to top |
|
 |
pelao
Joined: 08 Jul 2003 Posts: 4
|
Posted: Sat Jul 19, 2003 8:47 pm Post subject: |
|
|
thx mike! |
|
Back to top |
|
 |
tiezeman
Joined: 23 Jul 2003 Posts: 10 Location: Groningen - The Netherlands
|
Posted: Wed Jul 23, 2003 6:12 pm Post subject: |
|
|
Hello all,
When using the b2link by sumbitting a simple number, like this:
Code: | echo get_linkcatname(1);
get_links(1); |
it works fine.
But when I want to select the links based on the b2 categorie, and try this:
Code: |
$a = the_category_ID();
echo $a;
echo get_linkcatname($a);
get_links($a); |
it echoes the categorie number, but then reports: Couldn't query the db for categories.
"Perhaps me being very stupid?" (J.J. Binks) |
|
Back to top |
|
 |
mikelittle
Joined: 11 May 2002 Posts: 376 Location: UK
|
Posted: Wed Jul 23, 2003 10:22 pm Post subject: |
|
|
Hi Tiezeman,
The function the_category_ID() echoes the category id onto the page. You cannot assign it to a variable.
But if you do this:
Code: |
<?php
$a = $post->post_category;
echo get_linkcatname($a);
get_links($a);
?>
|
it will work ok.
Mike _________________ Mike Little
http://zed1.com/journalized/
"Share what you know. Learn what you don't." |
|
Back to top |
|
 |
tiezeman
Joined: 23 Jul 2003 Posts: 10 Location: Groningen - The Netherlands
|
Posted: Thu Jul 24, 2003 12:18 pm Post subject: |
|
|
Hi Mike,
Thanks for the answer!
I added the code like you sumbitted, but recieved the following error:
Code: | Couldn't query the db for categories:SELECT cat_name FROM b2linkcategories WHERE cat_id=You have an error in your SQL syntax near '' at line 1 |
It looks like the $a gets no value?
Regards,
T |
|
Back to top |
|
 |
mikelittle
Joined: 11 May 2002 Posts: 376 Location: UK
|
Posted: Thu Jul 24, 2003 12:59 pm Post subject: |
|
|
Hi Tiezeman,
This will only work inside the b2 main loop.
From your previous example, using the_category_ID(), I had presumed that was where you wanted to use it.
If not, where on your template are you trying to use it? What value for category are you expecting?
Mike _________________ Mike Little
http://zed1.com/journalized/
"Share what you know. Learn what you don't." |
|
Back to top |
|
 |
tiezeman
Joined: 23 Jul 2003 Posts: 10 Location: Groningen - The Netherlands
|
Posted: Thu Jul 24, 2003 1:14 pm Post subject: |
|
|
Hi Mike,
You're fast!
My quest is as follows:
I open complete posts (by clicking for 'more') or comments in another page than the home index.php
This page is called content.php; it uses a slightly different layout.
Because the posts, which open in content.php belong to a certain category, I've made the same categories for the links. So my category [Design] has number 2 in [b2categories]cat_ID and in [b2linkcategories]cat_id as well.
What I would like to happen, is that when content.php opens with a posting from post-category 2, the list of link-category 2 is shown.
So, outside of the loop, in another <td> I've put
Code: | Links in category <?php the_category_ID() ?>: <?php the_category() ?>: |
which results in the phrase Links in category 2: Design
Underneath that fancy line I than would like to display the related links.
So, in fact I would like to use the category number of the postings to use in the link-statement.
Is that possible? |
|
Back to top |
|
 |
|