2 azel Dec 15, 2004 16:04

EdB requested subcats for this, which I figured out, if and only if your categories are created in order, IE my post on my blog for this is in categories tech --> code --> b2evolution and I created category tech before code before b2evolution.
Change the $sql variable to :
$sql = "SELECT ep.postcat_cat_ID, ec.cat_name ";
$sql .= "FROM evo_postcats ep ";
$sql .= "JOIN evo_categories ec ON (ep.postcat_cat_ID = ec.cat_id) ";
$sql .= "WHERE ep.postcat_post_ID IN ($Item->ID) ";
$sql .= "GROUP BY ep.postcat_post_ID, ep.postcat_cat_ID, ec.cat_name ";
$sql .= "ORDER BY ep.postcat_cat_ID DESC LIMIT 1 ";
Thanks. That'll work for my application.
I'm a complete newb, so excuse the incompetence...
but I added the files and such, so now how do I get the icons into the page? What code do I have to add into _main.php to show the topic icon?
You don't have to add anything to the pages. You may have to do a mass update on the existing posts to insert my renderer into each post's renderer column. If you don't have too many posts, you can manually do this in backoffice.
oh! All right, thanks. I was a bit confused on that.
Thanks for this Matt, I've been looking for something like this for b2evolution for some time.
I've made a couple of small alterations, both of which are in the topic_icon() function:
1. I've added $imagename = ''; after the line $content = ''; to supress a warning when no images are found.
2. I've changed the $align = "left"; line to:
$style = "float: right; margin-left: 1em; margin-bottom: 1em; margin-top: -70px;";
and then changed the use of $align to $style. This for XHTML compliance. Obviously change the $style declaration to suit your own tastes.
Well I would really like to use this on my [url=http://www.luna-fx.com/blog]Blog[/url] but don't fully understand it.
I've uploaded it as a plugin and b2e is able to see it. But where do you put the files, and what do you have to name them?
I made a folder called icon, which is found at www.luna-fx.com/icon
In the code, I changed the url to http://www.luna-fx.com/icon , and the file path to /madsmhil/public_html/icon , and also just /home/madsmhil/public_html/icon (I tried both)
I have a cat called General Info , so I made a test gif file called General_Info.gif , and uploaded it to my icon folder. I then made a new post, the plugin box was checked, put it under General info, and I see nothing on the post.
Any ideas?
Well the first thing is to try is to either change the image name so it uses the prefix declared in $prefix on line 76. It's currently looking for an image called topic_general_info.gif, which doesn't exist. Give that a shot and LMK how it turns out.
I went and renamed the image to topic_general_info.gif
made a new test post with the plugin activated, and still nothing. Even tried topic_General_Info.gif
Then i would suggest changing line 74 to:
$topic_dir = "/home/madsmhil/public_html/icon/";
You need the trailing slash.
If that doesn't work, try:
$topic_dir = "/icon/";
Gave both of those a try with the image name topic_general_info.gif
But nothing is showing up
Do you have to define this in CSS?
Hrmm...
Nope, nothing should be needed in the css to get the image to show up.
A view of your source shows that the plugin is functioning, it just can't find the image file -- <!--no icon-->
how about
$topic_dir = $DOCUMENT_ROOT."/icon/";
Got it working with /home/madsmhil/public_html/icon/
I think I may have deleted the " " around it on accident which was keeping it from working.
Anyway, works fine now. Just have to design some icons.
---
Eh, I forgot IE is unable to display png images correctly, so it no longer matters.
Or maybe not. This is turning into a headache.
It was working, so I moved the icon folder inside my blog, changed both lines to include the new folder, and now it can't find the image again.
aye aye aye. I'll keep trying though, probably is something small.
Problem found
i was doing my image names as topic_general_info.gif when it should have been topicgeneral_info.gif
I have a question though. What would you have to modify in order to raise the icon to the top right. Right now it comes under the title / date (inside the post), but I would like it to be above those, in case of a short post. Then it owuld not overlap with the comment button.
Basically, is there any way to insert it up there above the date, and then just align right? I can't find the code that tells it where to insert the image.
Right now, the way the plugins are designed is that they search the post's content for things and then either insert or replace those searched things with their own. Currently, there is no way to get it to put it by the post title, unless you wrote a case statement and hard-coded that within your _main.php
I guess this is a bit extreme, but would anyone be able to help me do this (if it is a simple task) If it's a bit complex, then no need to bother. Or at least give a short overview.
I'm not exactly all that great with coding.
Error
[DBIM] Connection Failed: Access denied for user 'webmaster'@'%' to database 'olate'
Type: 256 File: E:\wwwroot\downloads\modules\core\dbim.php Line: 48 Debug Level: 1
when trying to download it
Should be good to go, I forgot to move that table over on my server rebuild.
I have been looking for this!
I am tring to get it to work, I am playing with the paths and so on, but I have 2 questions...
If the main Cat is nested under another, will it work?
What do the nake of the images have to be exacly to get it to work
topic_test image.gif for the cat "test image"
or do I have to define this somewhere cat by cat?
Thanks!!!!!!
Okay I am giving up...
*** Disclaimer, my blog is political in nature, I do not ask people to agree with me 100% of the time. ****
Here is what I have...
function topic_icon ($text)
{
global $Item, $DB;
$topic_uri = "http://www.bushsamerica.com/icons2/"; //site url to images
$topic_dir = "/icons2/"; //filepath to images
$align = "left"; //image align
$prefix = "topic"; //image prefix
$filetype = ".gif"; //image filetype
$topiconclass = "topicon"; //image css class
I am tring to add a cat banner at the top. My test Cat I am using is "Tom DeLay"
If you go to my icon folder, you will see that I have the image almost any way I can...
All I get in the source is
<h2>04/08/05</h2> <div class="bPost" lang="en-US">
<div class="bSmallHead">
<a href="http://www.bushsamerica.com/index.php?p=0&more=1&c=1&tb=1&pb=1" title="Permanent link to full entry"><img src="img/icon_minipost.gif" alt="Permalink" width="12" height="9" class="middle" /></a>
Categories: <strong><a href="http://www.bushsamerica.com/index.php?cat=32" title="Browse category">Tom DeLay</a></strong> <img src="http://www.bushsamerica.com/img/flags/h10px/us.gif" alt="English (US)" class="flag" /> </div>
<h3 class="bTitle"></h3>
<div class="bText">
<!--no icon--> <p>asdasdasd
</p>
</div>
<div class="bSmallPrint">
<a href="http://www.bushsamerica.com/index.php?p=0&more=1&c=1&tb=1&pb=1#comments" title="Display comments / Leave a comment">Leave a comment</a>
<!--no icon-->
Do I have to fill out the
if ($imagename) {
list($width, $height, $type, $attr) =
getimagesize($filename);
$content .= "<img src='" . $imagename . "'";
$content .= " align='" . $align . "'";
$content .= " width='" . $width . "'";
$content .= " height='" . $height . "'";
$content .= " class='" . $topiconclass . "'";
$content .= " alt='" .$linktitle . "'";
$content .= " title='" .$linktitle . "'";
$content .= " />\n";
} else {
$content = "<!--no icon-->";
part, I assume it is not even being looked at right now, because I am getting the else <!--no icon-->
PS Any banners you see on my site are there manualy, that is why I think this plug in will rock!
Can you try changing
$prefix = "topic";
to
$prefix = "topic_";
and LMK if that works?
Worked! Sweet!!!!
THANK YOU
This is what I have:
$topic_uri = "http://home.hccnet.nl/van.denbroek/van.denbroek/images/avatars/"; //site url to images
$topic_dir = "/van.denbroek/images/avatars/"; //filepath to images
$align = "left"; //image align
$prefix = "topic_"; //image prefix
$filetype = ".gif"; //image filetype
$topiconclass = "topicon"; //image css class
But it doesn't work...
Hi -
Looks like nobody really uses topicon. Is it still something that works? I'd like to install it, but if it's not been checked out with the most recent b2evo updates, then I'll just let it go.
Thanks,
Todd
This is definitely not going to work in any recent B2evo blog. The best you can do is a post in [url=http://forums.b2evolution.net/viewforum.php?f=34]Request a Plugin or Hack[/url] where you point to this post.
Good luck
What's the difference between this and the Avatars plugin?
Looking at the link in the first post this plugin was for b2evo 0.9 and only did categories, the avatars plugin does icons for users, posts, categories, and blogs, and runs on b2evo 1.10.
Thank you for reposting this, mattbta. I appreciate it, and I'm sure many others do as well. I hope to implement this on my site soon. Very nice-looking site by the way!