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);

CommentFileSizeAuthor
#7 front_fix_531216.patch1 KBhadsie

Comments

criscom’s picture

Sorry, to have posted one issue twice.

In the above description, sentence one goes as follows:

When assigning logos to specific nodes ...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

awolfey’s picture

Status: Closed (fixed) » Active

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
luco’s picture

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

pobster’s picture

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;

  • <front> should be able to cope with all frontpage situations, you shouldn't need to specify both <front> and nothing to match the frontpage
  • Move all the matching out of variables and into db tables, I feel that the overuse of variables in this module confuses people
  • Put the internationalisation back in... The system should (again) be able to cope with handling different languages, it's unacceptable to expect users to enter individual matches for each language they want to support, this should be more automated
  • Testing... This module when I created it for D6.x was used on two sites, one of mine which I don't even really use anymore and a work one; http://www.redbeemedia.com/tvproduction - I didn't (and still haven't) tested it thoroughly enough for every situation, I highly expect there are things I've overlooked still? But what puzzles me the most is that some of the 'fixes' I've seen on these threads don't make sense in my head? I can only assume perhaps that apache handles things differently to other webservers? I need to sort out a common method which will work for *everyone* before there can be an official release

Pobster

luco’s picture

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 :/

hadsie’s picture

StatusFileSize
new1 KB

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.

pobster’s picture

Ah yeah, that looks more like it. I'll test and roll out, thanks.

Pobster

pobster’s picture

Version: 6.x-1.x-dev » 6.x-2.0-beta1
Status: Active » Fixed

Moved to drupal_match_path for matching, will hopefully be fine now.

...Incidentally, locale support is back.

Pobster

luco’s picture

cool, thanks a lot. :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.