php links "breaks" each other

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • carramba

    php links "breaks" each other

    Hi!

    Sorry for the stupid subjekt, but coudn't get it better.
    I want that the user can chouse the skin of the site that I do by :

    *************** *************** *************** *
    <?
    if(empty($_GET['style'])){
    $_SESSION['stylesheet'] = "master";
    }
    else {
    $_SESSION['stylesheet'] = "jojje";
    }
    echo '<style type="text/css" media="all">@im port
    "'.$_SESSIO N['stylesheet'].'.css";</style>';
    ?>

    ///////

    Change skin to:
    <br>
    <a href="?style=jo jje"> Jojje</a>
    <br>
    <a href="?"> Default</a>
    <br>
    *************** *************** *************** ***

    then I use similary metod for the meniu:
    *************** *************** *************** ***
    <?php
    switch($_GET['page']){

    case 'banner':

    include('banner .html');

    break;
    default:

    include('main.p hp');
    }
    ?>
    ///////

    <a href="?page=ban ner">Banner</a>

    *************** *************** *************** ***

    well abbiosly it don't work... whats heppends is that when I change
    skin to jojje and click om banner link the banner page is getting
    loadet but made skin choise disappears ....

    so please can somebody help my to get to follow upps to work!
    getting desperate....

    thanx in advance
  • Pedro Graca

    #2
    Re: php links &quot;breaks&qu ot; each other

    carramba wrote:[color=blue]
    ><?[/color]

    // if there is no "style" in the URL[color=blue]
    > if(empty($_GET['style'])){[/color]

    // change "stylesheet " to default[color=blue]
    > $_SESSION['stylesheet'] = "master";
    > }[/color]

    // if there is a "style" in the URL[color=blue]
    > else {[/color]

    // change "stylesheet " to jojje[color=blue]
    > $_SESSION['stylesheet'] = "jojje";
    > }[/color]

    I think you need to refine the first part of this if() to something like:
    if there is no "style" in the URL
    AND the "stylesheet " is not previously defined


    [color=blue]
    > echo '<style type="text/css" media="all">@im port
    > "'.$_SESSIO N['stylesheet'].'.css";</style>';
    > ?>
    >
    > ///////
    >
    > Change skin to:
    ><br>
    ><a href="?style=jo jje"> Jojje</a>
    ><br>
    ><a href="?"> Default</a>[/color]

    Maybe better, in accordance to the redefined if()

    <a href="?style=ma ster"> Default</a>


    and then change the else part of the if() to use the value of "style"
    from the URL instead of the constant "jojje".
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    • carramba

      #3
      Re: php links &quot;breaks&qu ot; each other

      Thank you very mutch

      Comment

      • carramba

        #4
        Re: php links &quot;breaks&qu ot; each other

        well, it's work very fine untill you want to change the style back to
        default.
        ex if Iam on banner page (not index) and I change the style I ll get
        chucked to index page with default style...

        how can I prevent this?

        Comment

        • Pedro Graca

          #5
          Re: php links &quot;breaks&qu ot; each other

          carramba wrote:[color=blue]
          > well, it's work very fine untill you want to change the style back to
          > default.
          > ex if Iam on banner page (not index)[/color]

          something like http://www.example.com/banner.php in the URL?
          [color=blue]
          > and I change the style[/color]

          how?
          by going to http://www.example.com/index.php?style=master
          [color=blue]
          > I ll get chucked to index page with default style...[/color]

          Well ... that's the script specified in the URL!
          simply make that URL be http://www.example.com/banner.php?style=master
          and do the style change for all pages.
          [color=blue]
          > how can I prevent this?[/color]

          Hint:
          make the style changing script a file apart and include (I prefer
          require_once) it on all pages.
          --
          --= my mail box only accepts =--
          --= Content-Type: text/plain =--
          --= Size below 10001 bytes =--

          Comment

          • carramba

            #6
            Re: php links &quot;breaks&qu ot; each other

            Pedro Graca <hexkid@hotpop. com> wrote in message news:<c201bd$1o 7ar1$1@ID-203069.news.uni-berlin.de>...
            [color=blue]
            > something like http://www.example.com/banner.php in the URL?[/color]

            no, like http://swd.localhost/pj.php?page=banner
            Iam using GET here as well

            switch($_GET['page']){

            case 'banner':

            include('banner .html');
            break;

            [color=blue]
            > how?
            > by going to http://www.example.com/index.php?style=master
            >[color=green]
            > > I ll get chucked to index page with default style...[/color]
            >
            > Well ... that's the script specified in the URL!
            > simply make that URL be http://www.example.com/banner.php?style=master
            > and do the style change for all pages.
            >[color=green]
            > > how can I prevent this?[/color]
            >
            > Hint:
            > make the style changing script a file apart and include (I prefer
            > require_once) it on all pages.[/color]
            it still works same way as before... when I have changet style I can
            surf with it in all othet pages, but if I cnage style again I ll get
            into index page..

            Comment

            • Pedro Graca

              #7
              Re: php links &quot;breaks&qu ot; each other

              carramba wrote:[color=blue]
              > Pedro Graca <hexkid@hotpop. com> wrote in message news:<c201bd$1o 7ar1$1@ID-203069.news.uni-berlin.de>...
              >[color=green]
              >> something like http://www.example.com/banner.php in the URL?[/color]
              >
              > no, like http://swd.localhost/pj.php?page=banner
              > Iam using GET here as well[/color]
              [color=blue][color=green]
              >> how?
              >> by going to http://www.example.com/index.php?style=master[/color][/color]
              [color=blue]
              > it still works same way as before... when I have changet style I can
              > surf with it in all othet pages, but if I cnage style again I ll get
              > into index page..[/color]

              It seems you are *always* going to

              and use parameters to specify the page and style

              So http://swd.localhost/pj.php?page=banner shows the banner page in
              the previously selected style

              http://swd.localhost/pj.php?style=gold changes style to "gold" and
              shows what page? ???

              http://swd.localhost/pj.php?page=banner&style=silver would (I
              guess) show the banner page in the "silver" style
              --
              --= my mail box only accepts =--
              --= Content-Type: text/plain =--
              --= Size below 10001 bytes =--

              Comment

              • carramba

                #8
                Re: php links &quot;breaks&qu ot; each other

                Pedro Graca <hexkid@hotpop. com> wrote in message news:<c21ntv$1n 8bgj$2@ID-203069.news.uni-berlin.de>...[color=blue]
                > carramba wrote:[color=green]
                > > Pedro Graca <hexkid@hotpop. com> wrote in message news:<c201bd$1o 7ar1$1@ID-203069.news.uni-berlin.de>...
                > >[color=darkred]
                > >> something like http://www.example.com/banner.php in the URL?[/color]
                > >
                > > no, like http://swd.localhost/pj.php?page=banner
                > > Iam using GET here as well[/color]
                >[color=green][color=darkred]
                > >> how?
                > >> by going to http://www.example.com/index.php?style=master[/color][/color]
                >[color=green]
                > > it still works same way as before... when I have changet style I can
                > > surf with it in all othet pages, but if I cnage style again I ll get
                > > into index page..[/color]
                >
                > It seems you are *always* going to
                > http://swd.localhost/pj.php
                > and use parameters to specify the page and style
                >
                > So http://swd.localhost/pj.php?page=banner shows the banner page in
                > the previously selected style
                >
                > http://swd.localhost/pj.php?style=gold changes style to "gold" and
                > shows what page? ???
                >
                > http://swd.localhost/pj.php?page=banner&style=silver would (I
                > guess) show the banner page in the "silver" style[/color]

                you are absolutly right... but Iam to stupid to manage to work it...
                so how do I do it?

                Comment

                • Pedro Graca

                  #9
                  Re: php links &quot;breaks&qu ot; each other

                  carramba wrote:[color=blue]
                  > Pedro Graca <hexkid@hotpop. com> wrote in message news:<c21ntv$1n 8bgj$2@ID-203069.news.uni-berlin.de>...[color=green]
                  >> It seems you are *always* going to
                  >> http://swd.localhost/pj.php
                  >> and use parameters to specify the page and style
                  >>
                  >> So http://swd.localhost/pj.php?page=banner shows the banner page in
                  >> the previously selected style
                  >>
                  >> http://swd.localhost/pj.php?style=gold changes style to "gold" and
                  >> shows what page? ???
                  >>
                  >> http://swd.localhost/pj.php?page=banner&style=silver would (I
                  >> guess) show the banner page in the "silver" style[/color]
                  >
                  > you are absolutly right... but Iam to stupid to manage to work it...
                  > so how do I do it?[/color]

                  The same way you keep the style when changing pages, is what you have to
                  do for pages when changing the style.
                  --
                  --= my mail box only accepts =--
                  --= Content-Type: text/plain =--
                  --= Size below 10001 bytes =--

                  Comment

                  Working...