Specify logo path as DOWN not UP?

hawkdrupal - December 5, 2007 - 20:01
Project:Logo Tool
Version:5.x-2.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I love this module.

It appears that the module's original purpose was to show some fun logos/graphics, but it actually solves a more complex problem of showing different logos in different sections of a large site. From that need comes my wish-list...

My main wish-list item is to be able to control the logo DOWN the URL path, not just UP. For instance, I have a path to a section named "boomer", path http://www.advisor.com/boomer/story/STORYNAME. So I specify /boomer/story/* with a logo. The asterisk affects pages DOWN from here. But this also changes logos UP from here, so I have to specify the next level up with a separate logo entry. But since this next level is the top, I never really use the default logo. In fact, I don't see when I'd ever use the default logo, because to use a special logo for a down-path page I must always then override it with another logo for the next path level up. Over time this can result in a complex decision tree.

Here's what I have now with just two logos at two levels. Path boomer by itself is a panel listing new stories, with its own logo in the panel, and our general logo in the logo postion. Path boomer/story/STORYNAME is all the articles in the section, and this is where I want to change the logo. As I add more sections I'll need to use this same pattern for each, which will become lengthy.

boomer/story/*|vlboom_200x51.gif
boomer/story|vlboom_200x51.gif
boomer*|advisorslogan_200x63.gif

It would be much easier if it worked like Drupal's block hide/show system. Then, I could have my logo advisorslogan as the default (which it really is), and specify something like this for every page in the boomer/story section: boomer/story*|vlboom_200x51.gif -- and that's all I'd need, nothing to override going UP.

Is this making sense?

The other wish-list item is a way to specify the additional elements of a logo -- dimensions, alt, title, alignment. Some of these attributes improve page appearance and performance, but alt and title are required for compliance with certain ADA rules for handicapped users and access via non-graphical browsers such as phones. Also, many logos are wrapped by an anchor link tag, which currently can't be controled per-logo. A way to do this might be to control the logos via an admin-managed 2 column database table. The first column would be the logo's lookup ID/name, and the second column the complete HTML to use, whatever tags and parameters are required. The script would see what logo name/ID is specified, look it up in col1, and return the content of col2 to the logo position on the page.

For example (using square brackets for HTML so the example isn't broken by Drupal):
COL1 = vlboom200
COL2 = [a href="http://boomer.advisor.com"][img src="/logos/vlboom_200x51.gif" width="200" height="51" alt="BOOMER ADVISOR Magazine" title="BOOMER ADVISOR Magazine" /][/a]

In Logo Tool, specify boomer/story/*|vlboom200. The script then looks up vlboom200 and sends the result to Drupal as the complete logo HTML code.

A thought....

#1

pobster - December 5, 2007 - 21:06

Hiya!

Thanks for your comments about my module, I have to confess it's one of those modules that I wrote and then never looked at again... Maybe it is a little overdue an overhaul. I have considered (since the integration of the locale module) storing the logos and paths in db tables, it'd make everything a whole lot more readable and structured. Maybe when I update for Drupal 6.x I'll do a rewrite in this way (don't worry, I always make everything backwards compatible and unlike most Drupal updates - I always make sure mine actually work...)

Now regards your questions...

I'm not entirely sure I grasp what you're asking about the whole logo up and down path thing... As far as I can work out you seem to be under the impression that you have to specify both; path* and path/* Well... You don't! You can just specify; path* and it'll match everything above it. Just don't forget that logotool returns matches on a first come first served basis, if a path match can apply then it *will* be applied.

I'm sure I've misread your original question - please feel free to elaborate! BTW, unfortunately without forcing the user to use proper regexp to create matches the match function will always be a little 'experimental'...

As for the second question... Logotool doesn't really *do* anything clever with regards the logo... But there's a very good reason as to why it doesn't, Drupal and your theme handle everything to do with your logo and they gain their information from certain site variables (site-name is usually the ALT tag for your logo), I really *really* don't think it's a good idea to encourage people to have to change their template files... The less 'core' files that change the better with regards to updating... Of course, you could always just alter the site-name variable temporarily but that's not a good solution either tbh. If there were a better way... I'd do it/ would have done it already...

Pobster

#2

pobster - December 5, 2007 - 21:19

Uhhhh just to make sure you understood the gibberish I just wrote, here's an example;

boomer*|advisorslogan_200x63.gif
boomer/story*|vlboom_200x51.gif

This won't work as the matches are first come first served, so *anything* above boomer will be matched by boomer*

Reversed;

boomer/story*|vlboom_200x51.gif
boomer*|advisorslogan_200x63.gif

This is what you're after; anything above boomer/story (and boomer/story itself) will return vlboom_200x51.gif and anything else which matches boomer* will return advisorslogan_200x63.gif, assuming you're running in the correct mode - anything with no matches returns the default logo.

I'm now completely sure I'm not understanding your question... As I can't see why you haven't just got advisorlogan_200x63.gif as your default logo anyway? And then are just using boomer/story* to match all the story nodes? I think perhaps you should give me some examples!

Pobster

#3

hawkdrupal - December 10, 2007 - 04:09

Thanks for your attempt to understand me... I'll try again.

I have a default logo.

But for a certain URL path, I need a different logo to show. The path is
http://www.advisor.com/boomer/story/
Everything with this path should show a secondary logo. I'm doing this with
boomer/story/*|vlboom_200x51.gif
and (both seem necessary):
boomer/story|vlboom_200x51.gif

But... this also shows the secondary logo on pages with paths such as
http://www.advisor.com/boomer
http://www.advisor.com

I understand this is correct behavior because the match with http://www.advisor.com/boomer/story/* follows the path UP.

But it's not what I want, so I force it back to the default by specifying this, which causes this logo to be shown from this point UP my path.
boomer*|advisorslogan_200x63.gif

What I'm suggesting is that it's more common to want to apply a logo from a starting page/path DOWN the path. If this was possible, I could simply specify the default logo, and override it for one path like this:
boomer/story/*|vlboom_200x51.gif

Again, this works DOWN thanks to the asterisk, but it also (apparently by design) works UP the path, which I then need to block. Unless I'm simply doing something wrong, I find it unusual that a path spec is deemed to describe what is ABOVE it rather than BELOW it.

If this is any clearer, that is....

#4

pobster - December 10, 2007 - 17:03

Hmmm... That's not entirely clearer, I had hoped you'd describe your problem again without using the confusing 'up' and 'down' (I'd say above and below myself) but you see the confusion for me is because the behaviour you're describing isn't what happens with my installation... I have a simple set up on my own site, logotool is set to;

Specified and Random

Random every page refresh

Specified;

admin*|logo.gif

And that's it... The logo.gif shows correctly on page /admin and every page above /admin eg. /admin/settings/logotool, /admin/build/modules and so on. Not that I have any, but being a wildcard it'd also match pages like /administrate/something/anything as that also begins with "admin". Random logos are displayed on *every* other page (as they should be?) This behaviour is exactly as you'd expect unix commands to be, for instance;

rm /home/my_porn_collection/*

Would delete every file in that folder but not the folder itself or the 'home' folder.

rm -rf /home/my_porn_collection*

Would delete that folder (but not the home folder).

...You seem to be telling me that your install is (speaking in terms of the example above) 'deleting the home folder' as well as the porn folder? More curiously you keep mentioning that this is 'by design'? Well... It's not intended to be and it's certainly not the case on my server where it works entirely as expected? Could you show me the code which is doing what you think it's doing 'by design'? If you've identified that something is happening 'by design' then I assume you must understand that design, else you wouldn't be able to pinpoint it? PLEASE post it here and explain using an example of what you think is happening?

I'm also a bit concerned as to why you said that both; boomer/story/*|vlboom_200x51.gif and boomer/story|vlboom_200x51.gif seem necessary? You should be able to (as I am myself) use boomer/story*|vlboom_200x51.gif which will match boomer/story, boomer/story/, boomer/story/anything... It WON'T match boomer/anything_other_than_story.

Could you perhaps post your entire specified pages here? I'm starting to wonder whether your problem is down to something else, maybe something else is matching which you haven't thought about. Obviously that's a complete guess, it's just weird because your servers behaviour is different from my own when it really shouldn't be.

Pobster

#5

hawkdrupal - December 15, 2007 - 15:47

>> admin*|logo.gif
>> And that's it... The logo.gif shows correctly on page /admin and every page above /admin eg. /admin/settings/logotool, /admin/build/modules and so on.

Apparently we're using opposite terms for the same thing. If you say /admin/settings/logotool is ABOVE /admin (therefore in an UP direction), that's the source of confusion. I've been an IT pro/software developer for 25 years and have never heard this way of looking at a directory/path.

The common use of ABOVE/UP vs. BELOW/DOWN stem from how a folder/directory tree is usually depicted, top to bottom, with the highest level being the "top" of the drive, "above" all the folders. Folders are then listed alphabetically for a given level, then alphabetically within each level, something like this:

/ (TOP OF DRIVE)
/admin
/admin/build/modules
/admin/settings/logotool
/files
/files/logos

etc.

Notice the TOP of the drive is, well, the top of the drive, therefore everything on the drive is below/DOWN from the top. This is how "DIR" or equivalent lists the contents of a drive, and it is how all the file managers I've seen list it (I use WinSCP with my Drupal server). In addtion to listing folders as shown above, they often include a pseudo-folder icon to navigate to the leftl that contains the current folder/files, and that icon always has an UP-pointing arrow. When in folder /admin/build, the UP icon jumps to folder /admin -- so it is UP. Yet your description of how logotool works indicates it works DOWN this standard tree view.

When looking at folder/file path, folders to the left are considered UP/ABOVE, folders to the right are considered DOWN/BELOW.

In this standard listing format, /admin/settings/logotool is BELOW /admin. If you are saying it is ABOVE, then that opposite terminology is a big source of my confusion, and why my explanation doesn't make sense to you!

Now that I know that your "up" is my "down" I can better understand how it works.

Again, terrific module, but perhaps unclear documentation?

#6

pobster - December 15, 2007 - 16:44

Ah yes I think I'll take full responsibility for this mix up ;o) You say you've worked in the IT industry for... 25 years? Well, I've never worked in it, not even for 25 minutes... I've not so much as read a book on PHP or had a lesson, I'm probably more novice with jargon and pronunciation than most people here, even the newbs... I'm afraid I learnt PHP from going over the PHP snippets in the Drupal handbook and although I've been asked to do some freelance work here and there, I'm certainly not a professional programmer. In fact, I was asked to write a PHP script for something un-Drupal related and I couldn't do it - I didn't realise that a lot of the stuff I use is Drupal specific and I didn't have a clue about starting from scratch! I'm a futures trader by profession - old style, before computers were involved with that as well. I used to stand in a trading pit with a wad of cards and a pencil, screaming, shouting and waving my arms around... I did however learn how to program Z80 machine code back at school nearly twenty years ago, hence how comes some of my coding is probably quite unnecessarily complicated as machine code is fairly restrictive!

Anyways, yeah I'd call the folder which index.php resides in the 'top-level' folder, I'd just not thought in my head about above/ below in regards for everything else. I just hoover up information which I read on forums and stuff, I've probably just read something which has misled me? Anyways... This mix up still doesn't actually answer your original query?

This *should* work fine for what you're after;

boomer/story*|vlboom_200x51.gif
boomer*|advisorslogan_200x63.gif

Obviously in that order as it's first match returned. You shouldn't need both story/* and story*...

...And I'll change the documentation.

Thanks,

Pobster

#7

hawkdrupal - January 5, 2008 - 03:45
Component:User interface» Code
Category:feature request» bug report

My Apache error logs has a whole bunch of lines like this, the same 5 error lines for EVERY VISITOR to a page that uses Logotool. What's going on?

[Fri Jan 04 09:17:33 2008] [error] [client 72.197.255.6] PHP Notice:  Undefined index:  q in/srv/www/htdocs/d/sites/all/modules/logotool-5.x-2.3/logotool.module on line 340
[Fri Jan 04 09:17:33 2008] [error] [client 72.197.255.6] PHP Notice:  Undefined index:  q in /srv/www/htdocs/d/sites/all/modules/logotool-5.x-2.3/logotool.module on line 340
[Fri Jan 04 09:17:33 2008] [error] [client 72.197.255.6] PHP Notice:  Undefined index:  q in /srv/www/htdocs/d/sites/all/modules/logotool-5.x-2.3/logotool.module on line 340
[Fri Jan 04 09:17:33 2008] [error] [client 72.197.255.6] PHP Notice:  Undefined index:  q in /srv/www/htdocs/d/sites/all/modules/logotool-5.x-2.3/logotool.module on line 340
[Fri Jan 04 09:17:33 2008] [error] [client 72.197.255.6] PHP Notice:  Undefined offset:  1 in /srv/www/htdocs/d/sites/all/modules/logotool-5.x-2.3/logotool.module on line 343

#8

pobster - January 5, 2008 - 10:36

Well... That line (and error) points to this;

$_GET['q']

Is there any reason why your installation would suddenly throw up this error? Have you recompiled php/ changed your php.ini file recently? This is probably just a simple server misconfiguration error.

Pobster

#9

pobster - January 5, 2008 - 11:24

...Try manually accessing the $_GET['q'] global variable by previewing a node using the php filter, see if it either works or gives the same error;

<?php
 
print $_GET['q'];
?>

Pobster

#10

hawkdrupal - January 8, 2008 - 22:55

All I get from testing $_GET['q'] is just the path portion of the current URL, such as node/16/edit.

#11

pobster - January 8, 2008 - 23:00

Well... That's exactly what it's supposed to return... The question now is why does the logotool return "Undefined index: q" from exactly the same query? Have you changed anything recently? ...Server wise I mean?

Pobster

#12

pobster - January 8, 2008 - 23:06

Hmmm... Change line 340 from;

    preg_match($regexp, $_GET['q'], $match);

To;

    if (isset($_GET['q'])) {
      preg_match($regexp, $_GET['q'], $match);
    }

Can you tell me if it changes the functionality (and removes the error).

Pobster

#13

pobster - November 12, 2008 - 08:57
Status:active» closed

Closed due to lack of information/ no response.

Please feel free to reopen if the issue persists.

Pobster

 
 

Drupal is a registered trademark of Dries Buytaert.