Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Activate slider function from link on previous page

Tried this:
Featured #3

Did not work.

My goal is to make this scenario work.

From this page ( link from one image in "Featured Items" ) :
http://www.glmt.com/

to

This page ( remove class "hide" and slide to div id="sixteen" ) :
http://www.glmt.com/main/cd-dvd-bd/index.php

Is this possible? Could someone lead me in the right direction?

Thanks!



Comments

  • CyGuyCyGuy Posts: 312Member
    there is no element with id="sixteen"
  • PixelPusherPixelPusher Posts: 4Member
    Sorry.
    Looking at the HTML, near the end, you'll
    find " [code]
    [/code] "

    id="sixteen"

    Will the hyperlink code that I used above work? What am I missing?

    Thanks.
  • PixelPusherPixelPusher Posts: 4Member
    Sorry for the repost. Just wondering if I could get more insight on the above question?

    Thanks.
  • CyGuyCyGuy Posts: 312Member
    Cookies are the best
    [green]WHAT you;see_is_what=you.get;[/green]
    -Russ aka DangeRuss
  • PixelPusherPixelPusher Posts: 4Member
    How will cookies allow the user to see this page
    [link=http://www.glmt.com/main/cd-dvd-bd/index.php]glmt.com[/link], plus remove class "hide" and slide to div id="sixteen" after clicking
    on a link in this [link=www.glmt.com]page[/link]?

    I'm afraid that I don't have much practice using cookies.
    I'm I doing this correctly? Please see the following:

    [color=Orange]Page one:[/color]
    [code]

    function writeCookie(templatespage, feature3button, 1)
    {
    var expire = "";
    if(hours != null)
    {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
    }
    document.cookie = name + "=" + escape(value) + expire;
    }


    Featured #3

    [/code]

    [color=Orange]Page two[/color]
    [code]

    write("$('sixteen').removeClass('hide');return false;") =
    readCookie('feature3button');
  • CyGuyCyGuy Posts: 312Member
    I'm afraid that there are two intertwined programming languages here that run on separate machines: Javascript and PHP

    javaScript is a client technology that works well with the HTML (that contains the ID attribute) and CSS (where the style is at). All of these are client technologies.

    Your server runs PHP to deliver, and collect, the content to the client computers to run the content. Although PHP can rewrite the code to be interpreted by the client computer, it is the HTML, CSS and javaScript mechanisms that load content to be displayed on the computer.

    The cookie stores a value, because the client computer doesn't keep anything on a document when the address changes and PHP sends another page.

    In your first post you attempted a to make a link to this address: [color=Grey]../main/cd-dvd-bd/index.php?$('sixteen').removeClass('hide');return false;[/color]. The problem is that the ? in the link tells php that there are additional values it should be aware of when broadcasting the code. This behavior is similar to submitting a form, whereas a cookie stays on the client computer. And the above is javaScript code that will not be understood by PHP. That is the reason I recommend cookies.

    Moving on, here is some javaScript code that might help:
    [code]
    function writeCookie(name,escape)
    {
    document.cookie = name + "=" + escape(value);
    }


    Featured #3
    [/code]

    By adding the above code to page one, you inform the next page to that the cookie [italic]templatespage[/italic] has the value of the desired slider location. There is more work for the next page. Some hints: load the cookie value first so the client has a value to compare... remember these are conditional effects that you desire... the document is where the client stores the effects, so [b]document[/b] is your top level container.
    [code]
    var featuredButton = readCookie('featuredButton')
    slidingtabs.changeTo(featuredButton);
    document.getElementById(featuredButton).removeClass('hide');[/code]

    The first line in the above code is from some commented out scripts on line 325 of the second page and probably depends on the SlidingTabs object found in one of the includes from the script tags starting around line 30.

    I could go on, but this ought to get you started. I suggest a slimmed down test-bed to get the configuration right. I typically remove everything that is not neede to provide the desired effect.



    [color=Green]document.referrer[/color]
Sign In or Register to comment.