Announcement

Collapse
No announcement yet.

inconsistent variable contents

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    inconsistent variable contents

    Hi all. I've done a search for this and found this post (http://community.actinic.com/showthread.php?t=22964) - it's a bug report in v8. Not sure how closely my problem is related to this, but I'm not sure where to go from here.

    The variable "ProductImageFileName" contains the value
    "NOT_CATALOG\Web Images\m_8420Burgundy.jpg"

    but when it's used as the source of an image, it outputs
    "m_8420Burgundy.jpg"

    Since the image is in the acatalog folder on the site, the image displays fine, but a javascript rollover that references the variable to locate the image fails and I get the little cross to show that the browser can't find the image.

    1) is it normal that the variable outputs two different things?

    2) how do I fix my javascript? I only need the filename, not the filepath. is there another variable I can use?

    #2
    What you get when Previewing is different to what happens on the live site.

    Search here for basename and you may find some help.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Sorry, I mean the variable outputted two different values on the live site. I tested it by outputting the variable into an HTML comment right next to where the image was generated. Both instances were different!

      I'll have a look at basename , cheers!

      Comment


        #4
        do you have a URL where this is happening, Ian?
        Tracey

        Comment


          #5
          http://www.sitebetatest.co.uk/shop/PR2084.html

          if you view the source code and search for
          <!-- test 21/10/08 14:37 NOT_CATALOG\Web Images\m_8420Burgundy.jpg -->

          you can see where I've outputted the variable in the first comment.

          Three lines lower, a javascript picks up this variable:
          current = 'NOT_CATALOG\Web Images\m_8420Burgundy.jpg';

          A few lines later, I've outputted another comment:
          <!-- test 21/10/08 14:29 NOT_CATALOG\Web Images\m_8420Burgundy.jpg -->

          and after that the variable is used in an HTML img tag:
          <img src="m_8420Burgundy.jpg"

          I'm experimenting with Basename here (but actinic has just crashed!):
          var ProdImgFileName=m_8420Burgundy.jpg

          Comment


            #6
            I'm making some progress here. The source code is looking closer to what I'm after. It still doesn't work but I'm getting there. Thanks for your help so far.

            Comment


              #7
              Here's what I generally use:
              Code:
              <actinic:block php="true" >echo basename(str_replace('\\','/', '<actinic:variable name="ProductImageFileName" encoding="perl" selectable="false" />'));</actinic:block>
              PS I see an lot of V7 add-ons in this V9 site. It's unlikely that you'll get them to work properly, when V9 can do these things in much better ways.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                It's essentially my first actinic project and I'm upgrading a v7 site to v9 (against the recommendations of pretty much everyone here ).

                Why do you use that particular method? are there occasions when the basename contains slashes?

                Comment


                  #9
                  against the recommendations of pretty much everyone here
                  Indeed - I see that half days work has become a week already

                  Comment


                    #10
                    I know, I know, but my boss is insistent. I've learned an awful lot already.

                    How would you identify what's a v7 add-on and the best way to replace it? Experience I imagine?

                    Comment


                      #11
                      Why do you use that particular method? are there occasions when the basename contains slashes?
                      Well you want to put that info into a JavaScript variable. Actinic (via Windows) uses backslashes in path names. So lets generate (while Previewing)

                      var image = 'myFolder\myImage.jpg';

                      All is fine

                      Now lets try using an image called testImage.jpg and we have:

                      var image = 'myFolder\testImage.jpg';

                      Looks OK, but whoops, that \t is interpreted by JavaScript as a Tab character.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        How would you identify what's a v7 add-on and the best way to replace it? Experience I imagine?
                        You had a V7 site so they're all V7 add-ons. Best start with a clean slate.

                        After your second week on this half-day project you'll see why we're suggesting this.
                        Norman - www.drillpine.biz
                        Edinburgh, U K / Bitez, Turkey

                        Comment


                          #13
                          Originally posted by NormanRouxel View Post
                          Well you want to put that info into a JavaScript variable. Actinic (via Windows) uses backslashes in path names. So lets generate (while Previewing)

                          var image = 'myFolder\myImage.jpg';

                          All is fine

                          Now lets try using an image called testImage.jpg and we have:

                          var image = 'myFolder\testImage.jpg';

                          Looks OK, but whoops, that \t is interpreted by JavaScript as a Tab character.
                          Ah I see. Cheers!

                          Comment


                            #14
                            Originally posted by NormanRouxel View Post
                            You had a V7 site so they're all V7 add-ons. Best start with a clean slate.

                            After your second week on this half-day project you'll see why we're suggesting this.
                            I really don't intend to offend anyone or suggest I don't believe them or wouldn't take their advice, I'm just doing it the way I've been asked to, and I think (hope) I'm making fair progress.

                            And it's all part of the learning curve for me.

                            Comment


                              #15
                              And it's all part of the learning curve for me.
                              It may be part of the learning curve for you BUT you need to think about your clients site - you have been asked to upgrade the site to V9 not hack V7 code to try and make things work. Many of us on here have been using the software for many many years and upgraded many many sites and wht you are doing is not the best way as it will leave alsorts of legacy code in the site.

                              Your client should be the first priority in all this and they will not thank you in the long run but as you say its up to you - lets hope your client does not find out.

                              Comment

                              Working...
                              X