I first noticed this bug in the k2 theme which uses the same pencil icon for Edit:
The pencil icon appears OK in teaser listing pages, but it does not appear in node pages.
I found that this bug is caused by the $directory variable in 'node.tpl.php', which is supposed to return the theme's path but it returns a *relative* path 'themes/contented7'. As a result:
- In a teaser listing page, the $directory path resolves to '/themes/contented7' (right).
- In a node page, the $directory path resolves to '/node/themes/contented7' (wrong).
- In any page with an alias, the $directory path resolves to '/alias-path/themes/contented7' (wrong).
Maybe this is a core bug, but for now you can put a slash in front of $directory to make it an absolute path. Change
<img src="<?php print $directory ?>/images/pencil.png" alt="Edit Link" />
to
<img src="/<?php print $directory ?>/images/pencil.png" alt="Edit Link" />
and everything works OK.
By the way, you could add t() functions to the english strings in the tpl files to make them translatable.
Comments
Comment #1
hswong3i CreditAttribution: hswong3i commentedsorry that i can't sure if it is really a bug
in both my personal blog page, and my final year project page in source forge, there are no problem:
http://edin.no-ip.com/html/
http://tcp-lp-mod.sourceforge.net/
since i don't use root dir
http://edin.no-ip.com/
as drupal's rootbut a sub directory
html/
withRedirectMatch ^/$ /html
in .htaccess, or httpd.conf directlyif i follow your suggestion by adding a slash will let the page bugged...
the pencil icon will never show out...
i will add t() to CVS version as soon as i can
sorry that carelessly forget them ;-)
i think there is no custom wording from theme directly...
forget to check ;-)
Comment #2
cog.rusty CreditAttribution: cog.rusty commentedHeh, I cannot see the pencil in your pages because I don't have edit permissions. :)
I suspect that the reason you don't see a problem is that you don't use "clean URLs". So, 'node' or path aliases are never in your page's path.
Comment #3
hswong3i CreditAttribution: hswong3i commentedOoops, surly that i can't give the admin right of my personal blog to you Orz...
you are right that "clear URLs" is disable in my case, as usual
i try to strat it and face the problem that you take about
if i disabe clear URLs
only face problem when using path alias
the target node edit page can't be found, which means the herf is not valid :$
so now come to a choice:
1. enable "clear URLs", and fix the bug by your method (sorry that i didn't fully test your solution, i don't use clear URLs)
2. disable "clear URLs", and nothing need to be changed, most case function ;-)
i think that is not easy to say it is really a bug of theme directly
because that may be due to the problem of drupal core
BTW, i18n supporting is added to both CVS and DRUPAL-4-7
please feel free to try it out ;-)
Comment #4
cog.rusty CreditAttribution: cog.rusty commentedAnother idea. Instead of:
<img src="<?php print $directory ?>/images/pencil.png" alt=t("Edit Link") />
you can use:
<img src="<?php print $base_url . '/' . $directory ?>/images/pencil.png" alt=t("Edit Link") />
This works in all cases that I tried, with or without clean URLs, and also in a subdirectory. Maybe this is the right way to use $directory.
Comment #5
hswong3i CreditAttribution: hswong3i commentedplz see the following bug report:
http://drupal.org/project/issues/68243
Comment #6
(not verified) CreditAttribution: commented