Announcement

Collapse
No announcement yet.

Different JavaScript for different pages?

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

    Different JavaScript for different pages?

    Hi, I'm new to actinic, but not to web design.

    I have two conflicting .js files, both needed for different pages - I was wondering if anyone could give me a guide on how to use a certain js file depending on which page you are on?

    Both pages are brochure pages - one is using a smooth scrolling script with jQuery, the other is using domtab. As both scripts use bookmarks, it means they interfere with each other.

    So ideally I want something that says
    ' If downloads page, use domtab.js and if news page, use smoothscroller.js '

    Can anyone me on how to do this in Actinic?

    #2
    Have a read up on BlockIfs, they will sort this for you, some tutorials by Gabe in the forum on these. You'll add them to your head area and have a switch on the pages in question that chooses whether they are loaded or not, well worth learning, adds massive power to what actinic can do. 'Tutorial' thread has them i think.

    Comment


      #3
      I have looked up on blocks and block ifs, but I find the whole thing kind of confusing to be honest.

      When it gets to the point where there are %30%23%3c sort of things, I have no idea what's going on.

      From using the advanced manual I tried to do this on a blockif that surrounded a .js file :

      <actinic:variable name="PageTitle" /> != "Downloads"
      But it didn't work.

      Comment


        #4
        Right, I managed to sort it out!

        I found the tutorial went in a different direction and confused me quite a bit. The Advanced Guide for actinic helped a bit, but doesn't really go into enough detail.

        Anyway. I did this.

        <actinic:block if="%3cactinic%3avariable%20name%3d%22BrochureName%22%20%2f%3e%20%21%3d%20%22Downloads%22" >
        <script type="text/javascript" src="smoothscrolling.js"></script>
        </actinic:block>
        One of the things that confused me is the % characters in there...

        In case anyone comes across this, and gets confused in the same way - I'm going to type it out the way its seen on screen.

        block if
        <script type="text/javascript" src="smoothscrolling.js"></script>
        /block if
        You double click on "block if" to get the conditions of it. And this is what I used.

        BrochureName != "Downloads"
        So if the name of my brochure page is Downloads, the smooth scrolling.js file won't load.

        Comment


          #5
          You can run on page name or often better still i'd have your own variable (true/false) that you can switch on/off on any page and thus activate your custom code on pages you'd like. Much more flexible than adding page names like you have, although that is probably fine for your example.

          From a designer's perspective you don't want client going into design tab to switch something on, a simple yes/no question in the area they always use is much better for them ime.

          The %20 is crap i agree, it's the way the gaps and certain characters are formatted into readable code for the php engine i believe, best way is to hover over your blockif to see what it does adn it has a tooltip type feature. Don't have screen in expanded mode either, use the green icon to compress it, easy to read and you can just click on the blockif to see what it is doing.

          Comment

          Working...
          X