Logotool: Display mode - Specified logos not working
criscom - July 26, 2009 - 11:57
| Project: | Logo Tool |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | criscom |
| Status: | active |
Description
When assigning logos to specific site the Specified logos display mode wouldn't work. Logotool only displayed the default logo.
Apparently we found a quick fix to the problem in line 285 in logotool.module. There we changed a single number. After that change Logo tool Specified logos display worked like a charm.
line 285:
before:
preg_match($regexp, substr($_SERVER['REQUEST_URI'], 1), $match);
after:
preg_match($regexp, substr($_SERVER['REQUEST_URI'], 4), $match);

#1
Sorry, to have posted one issue twice.
In the above description, sentence one goes as follows:
When assigning logos to specific nodes ...
#2
Automatically closed -- issue fixed for 2 weeks with no activity.
#3
Here's what worked for me. The above solution did not work. This also works if path is an alias, node or view:
function logotool_fetch_matches() {$path = drupal_lookup_path('source', substr($_SERVER['REQUEST_URI'], 1)) ? drupal_lookup_path('source', substr($_SERVER['REQUEST_URI'], 1)) : substr($_SERVER['REQUEST_URI'], 1);
foreach (explode("\n", variable_get('logotool_pages', '')) as $page) {
$explode = explode("|", $page);
$regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($explode[0], '/')) .')$/';
preg_match($regexp, $path, $match);
if ($match) {
return $explode[1];
}
}
return FALSE;
} // logotool_fetch_matches
#4
thanks, @awolfey - that's almost it.
if anyone doesn't know where to place your correction, it's lines 281 - 291 of logotool.module .
@pobster: care to make an official release with this nice bug fix? :]
also, there's a difference between example.com AND example.com/node.
to solve it, enter both descriptions below:
<front>|home.png|home.png
(that's right - nothing to the left but the pipe.)
one more thing - if you're using i18n (I am) you'll need to specify */ eg.: example.com/en/
hope this helps ;] cheers
#5
I am tempted to make an official release but there's a few things holding me back still and tbh, I've too many modules and not enough time to make them all perfect... Here's what I'm currently thinking I should finish;
Pobster
#6
ok! thanks for the reply.
unfortunately, I can only help with testing. I'm not that fluent in PHP ;]
as for i18n I think it makes sense to have a logo for each language - therefore example.com would show the original logo, example.com/pt the Portuguese logo, example.com/nz the Maori logo and so on.
there might even be an integration with Domain Access - but once again, no time for that :/
#7
I think the reason the original fix fails on the front page here is due to the fact that the front page path is usually just the empty string. So an extra case needs to be put in place to handle that. Here's a patch that should work with aliases as the original fix does as well as fix the front page issue.
#8
Ah yeah, that looks more like it. I'll test and roll out, thanks.
Pobster