Hello all,

First of all, let me say that I know very little about php, and have reached my limit with this one. I've been working on this for a week now to no avail, and only now found this fine forum. I hope someone here can help!

I use SPGM for a photo gallery script on my website. Test site is here.

Now, you can see the little folder images. What I'd very much like to do is add an ALT attribute to those images. Now, I WAS able to do this same thing (but with a title attribute) to the text links right next to the images. Hover over the text links to see. That's not native of SPGM. I added it.

I have figured out how to add an ALT attribute, but the variable doesn't seem to be working. Here's what I specifically found in the php file, lines 443-445:

// key in $cfg | ALT value | CLASS value | alternative (if resource is N/A)
array('gallerySmallIcon', 'Enter the '.$strHtmlGalleryName.' gallery here', CLASS_IMG_FOLDER, ''), 
array('galleryBigIcon', 'Enter the '.$strHtmlGalleryName.' gallery here', CLASS_IMG_FOLDER, '»'),

...but if you go to the test site, you only see "Enter the gallery here", not "Enter the GALLERY NAME gallery here" Why not?

I basically did the same thing with the anchors right next to the folder icons. That part of the code I changed to:

// display the gallery title
print '   <td class="'.CLASS_TD_GALITEM_TITLE.'"><img alt="Just a transparent spacer image" src="http://www.chrisbartlett.net/pix/spacer.png"/>'."\n"; 
print '  <a title="Enter the '.$strHtmlGalleryName.' gallery here" href="'.$cfg ...

THAT has worked. Why doesn't the other one?

I made a text file version of the php file that controls everything for the script so you can see it here. Could someone have a look, please, and help me figure this out? Much appreciated!

Chris

PS. I really don't know much about php coding at all, so please explain things to me like I'm a 5 year old!

    OK, I visited your site, and aside from the fact that it loaded extremely slow....... I didn't get any hover titles on any of the links at all... (In IE6) In Mozilla, it loaded faster, but nothing popped up on the folders at all... The text links worked fine though.

    Not trying to be lazy here, but I don't particularly have time to sift through the entire text file you posted, so if you have a chance, post back the applicable lines of code, and we can go from there.

      TheDefender wrote:

      OK, I visited your site, and aside from the fact that it loaded extremely slow....... I didn't get any hover titles on any of the links at all... (In IE6)

      Whole site or just the single photo galleries page? Every single link on every single page has an ALT or TITLE attribute or both. That's weird. BTW, the reason it's so slow is because it is only a test site on MY personal server with only a cable connection with a 256k upload speed. The real site is much faster.

      TheDefender wrote:

      In Mozilla, it loaded faster, but nothing popped up on the folders at all... The text links worked fine though.

      That's also weird. You're right.

      TheDefender wrote:

      Not trying to be lazy here, but I don't particularly have time to sift through the entire text file you posted, so if you have a chance, post back the applicable lines of code, and we can go from there.

      Ummm, I did. See above, please. Those seem to be the applicable lines of code. I even numbered them for people.

      I really appreciate the reply!

      Chris

      PS. Congratulations on the new baby! First? Second? Tenth?

        Fourth and Final child. 😉

        I will take a look at the site tomorrow sometime. Sorry, but between the baby and family, I don't have time right now. I will pull your entire text file into my editor so I can review more code arund the original ones you posted, because I think there's a bit more I need to see.

          TheDefender wrote:

          Fourth and Final child. 😉

          I will take a look at the site tomorrow sometime. Sorry, but between the baby and family, I don't have time right now. I will pull your entire text file into my editor so I can review more code arund the original ones you posted, because I think there's a bit more I need to see.

          Thank you for taking the time, and please do just that. TAKE YOUR TIME! Your kids are far more important than my stupid script. 🙂

          I've been working on this for a week now, including having several gurus look at it, and no one has been able to figure this out. So, if you can... AWESOME!

          I can certainly wait for that.

          Chris

            Hello!

            some browsers (IE maybe) make use of ALT='....' in a NOT intended way
            ALT means alternative, something that is not ORDINARY information about an image
            in <IMG tag.
            Opera, which I use and modern Browsers that conforms to W3C standard,
            use these parameters correctly.

            <IMG SRC="image.png" TITLE="ordinary attribute" ALT="alternative attribute">

            Now hovering:
            Opera displays ordinary attribute, NOT alternative attribute

            if I remember correctly:
            when an image is NOT FOUND, a placeholder with 'alternative attribute' is displayed

            You can do a search with google
            Keywords: img title alt problem OR display browser opera firefox

            🙂 🙂 🙂

              I've talked with the script creator a bit, but what he's telling me is way beyond my scope.

              At this point, I have added

              Enter the '.$strHtmlGalleryName.' gallery here
              

              to the ALT attributes of lines 444, 445, 942, and 970. You can see it in the code.

              Now, oddly enough, the creator told me that by adding that to lines 444-445 it would actually do nothing because

              The piece of code you've modified resides in an initialization block of code, not a rendering one. The current design does not allow to be able to change ALT tags dynamically.

              But the weird thing is that the code on those lines is, in fact the only changes I've ever done that DOES display an ALT tag! But I admit there's no dynamics.

              He suggested

              A solution would be to insert a special character sequence in the tab you've mentionned above (like '[>GALLERY_NAME<]' for instance) and then perform an str_replace on it whenever used...

              I have no idea how to do that...

              I will not touch the file until I get some advice, so as not to confuse things.

              Thanks!

              Chris

                Just checking in again... How's the baby, Defender?

                Have you had a look at the file?

                Thanks a million!

                Chris

                  halojoy wrote:

                  Hello!

                  some browsers (IE maybe) make use of ALT='....' in a NOT intended way
                  ALT means alternative, something that is not ORDINARY information about an image
                  in <IMG tag.
                  Opera, which I use and modern Browsers that conforms to W3C standard,
                  use these parameters correctly.

                  <IMG SRC="image.png" TITLE="ordinary attribute" ALT="alternative attribute">

                  Now hovering:
                  Opera displays ordinary attribute, NOT alternative attribute

                  if I remember correctly:
                  when an image is NOT FOUND, a placeholder with 'alternative attribute' is displayed

                  You can do a search with google
                  Keywords: img title alt problem OR display browser opera firefox

                  As you probably chose NOT to read my explaination to, what might very well be your problem,
                  I have to repeat it.

                  no fun helping those, who do not want to be helped, Really.

                  :bemused: :bemused:

                  bottomeline again:
                  TITLE is the important attribute
                  ALT isnt all that necessary

                  With browser that has a correct ( W3C srtandard ) DISPLAY of TITLE
                  you wouldnt miss ALT (second ALTernative attribute, exxcept for some rare fault situations

                  I give up on you.
                  There are those who read us
                  when we try to help

                  🙁

                    First of all, halojoy, I don't appreciate the condescending tone of your post. If you don't think someone is paying attention to your posts, perhaps they have a reason. Perhaps they looked at your suggestion, looked at their code/problem, perhaps even tried it, but it just didn't work though they failed to mention this.

                    At any rate, no matter what the appropriate HTML attribute is (though your use of overly large text surely emphasized what you thought), the problem will not be solved by changing "ALT" to "TITLE". The problem is not with displaying the correct text using the correct method named by the correct standard at all. It's with filling in the value of WHATEVER attribute he decides to use with a variable, which, at present, is not being displayed at all (in the HTML code).

                    Now, on to my suggestion.

                    Could this perhaps be a scope issue? Try changing this (lines 371-372):

                    function spgm_PostInitCheck() {
                    global $cfg;

                    to this:

                    function spgm_PostInitCheck() {
                    global $cfg, $strHtmlGalleryName;

                      Brad (I assume that's your real name),

                      I appreciate your support, and your assistance with this file. Unfortunately, your fix has not helped. 🙁 Not that I understand it, anyway. LOL

                      Halojoy, you went completely OT for no reason. I am well aware of the differences between title & alt, but that is not the point, nor do I care. I may be new to THIS forum, but I'm a member and/or moderator at a great many others, and in any of those forums, you probably would have been banned many times over for that kind of ridiculous post. I consider the matter between you and I closed. Please don't bother replying anymore to this thread for your sake, my sake, and that of the community's.

                      Brad, would you happen to have any other ideas?

                      Thank you very much!

                      Chris

                      PS. I've updated the text link to include Brad's changes.

                        Yes, my name is indeed Brad.

                        I still am unconvinced that this is not a scope problem. To ensure that it isn't, we're going to add this variable you're using to as many scopes as possible :p

                        Here's what you do. Do a find and replace, replacing this:

                        global $cfg;

                        with this:

                        global $cfg, $strHtmlGalleryName;

                        I believe you should find 18 occurances that need to be replaced as such. Give that a shot and let us know.

                          I have done what you asked. Yes, there were 18 occurances. No change, I'm afraid.

                          Updated the text file again, so you can make sure I did this right if you're so inclined.

                          Chris

                            Write a Reply...