Closed (fixed)
Project:
Flag
Version:
6.x-1.0-beta6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2009 at 21:36 UTC
Updated:
11 Mar 2009 at 03:40 UTC
I'm trying to make flag images instead of text i've done everything that was suggested by the flag's documentation the images are showing in the teasers but in the node page it doesn't show saw on on firebug that the image link was ok but it doesn't show i'm using drupal 6.9 and flag 6.x-1.0-beta6
Comments
Comment #1
quicksketchWe'll need more information to help with your request. What CSS did you use to add the images (and in which file)? If it's working on teasers but not on the node page, my guess is that the CSS file you're using isn't being added to the page.
Comment #2
youkho commentedPlace this function as recommanded on the documentation page
function phptemplate_preprocess_flag(&$vars) {
";
$image_file = path_to_theme() . '/flag-' . $vars['flag_name_css'] . '-' . ($vars['action'] == 'flag' ? 'off' : 'on') . '.png';
// Uncomment the following line when debugging.
// drupal_set_message("Flag is looking for '$image_file'...");
if (file_exists($image_file)) {
$vars['link_text'] = "
}
}
then placed my template flag-recommand.tpl (exact copy of flag.tpl) in my theme's folder and the images too (flag-recommand-on.png & flag-recommand-off.png) as i said everything works fine in the teaser but in the node's page the image is missing
right now there's no CSS for the flags
Comment #3
mooffie commented(He's using the recipe shown at "How to show images instead of text". I think I see the problem.)
Youness,
Right now your URL looks like "http://example.com/node/23". Change it to "http://example.com?q=node/23". Does this make the images appear?
Comment #4
youkho commentedHi moofie,
Since i'm using the clean urls and pathauto my url is (http://localhost/mooroki/news/obama-bin-laden-error-hits-yahoos-homepage...) changed to mooroki?q=node/31 same problem no image is shown i think i'll consider the CSS method and hope this issue will be fixed
Comment #5
mooffie commentedYouness, I believe I fixed the code in that handbook page (I prefixed the image URLs with base_path()).
Comment #6
youkho commentedYeah since no one reported the same issue maybe there's something wrong on my code thanks anyway
Comment #7
mooffie commentedThere was a bug in the code in that handbook page and I have fixed it.
If the new code still doesn't work for you, do "View Source" in your browser, locate the IMG tag, and paste its content here so we can inspect the image URL.
Comment #8
youkho commentedAh ok will do that asap and report back the result
Comment #9
mooffie commentedYouness, it might help you to know that the line that had the bug was this one:
I changed it to:
So if it's easier for you, you can replace only this one line.
Again: if that doesn't solve your problem, paste here the IMG tags generated so we can try to figure out what's wrong.
Comment #10
youkho commentedHello moofie,
Don't know what happened but when i upgraded to the latest version 6.x-1.0-rc1 lost of even the flag's counts used
print $flag->get_count($content_id);in flag-recommand.tpl and the images aren't showing this time not even in the teasers should i downgrade ?Comment #11
mooffie commentedThe latest version switched to use two dashes in the tempalte file-names.
In other words, you need to rename "flag-recommand.tpl" to "flag--recommand.tpl". And make sure to clear Drpual's cache or it won't notice this new file.
And note that computers aren't human. If you named your flag "recommend", with "e", don't expect Drupal to forgive you for spelling it with "a" in the template filename.
Comment #12
mooffie commented"images aren't showing" isn't helpful. Either the image URLs are bad, or the custom code didn't kick in at all. To find which of the two possibilities it is, inspect the HTML and see if the IMG tags are there.
Comment #13
youkho commentedNow it's fixed changed to the two dashes cleared the cache and everything works now as it should be.
ps : i know it's not the place for this kind of questions but i don't want to open a new issue ^^ it's like the Ajax reloading function isn't working even if the link type is javascript toggle when i click it's seems like reloading the whole page.
Thank you so much mooffie appreciate your help :)
Comment #14
mooffie commentedSo it doesn't work for the "recommend" links. But does it work for other flags? In other words, perhaps the fault is somewhere in your altered "flag--recommand.tpl" file. Delete this file (of course, save it first somewhere), clear Drupal's cache, and see if the AJAX now works.
Is your site on a public-accessible server where I can see the problem?
Comment #15
youkho commentedOk now that i've tested the default flag template it's working since the code changed with the new version i had to update my template too to make the ajax work with the "
print $flag->get_count($content_id);"in line 44 in the new version 6.x-1.0-rc1 there's no
echo $action;So it was a little bit my fault xD thanks a lot mooffie without you couldn't make it work ;)
Comment #16
mooffie commentedThanks for bringing this to our attention. (This will be dealt with in another issue.)
Comment #17
youkho commentedOkay i'll help testing