Mixing 3 xml-files together showing maps

Discussion in 'XML' started by Tine Müller, Dec 30, 2007.

  1. Tine Müller

    Tine Müller Guest

    Tine Müller, Dec 30, 2007
    #1
    1. Advertising

  2. Tine Müller wrote:
    > How can I mix this to one file showing all the markers on Sjælland
    >
    > var xmlfile = [];
    > //Sjælland
    > xmlfile[1] = "map_data_xml.php?category=sh";
    > xmlfile[2] = "map_data_xml.php?category=sf";
    > xmlfile[3] = "map_data_xml.php?category=sb";
    >
    >
    > http://www.tinemuller.dk/alle_folkebiblioteker/dropdownmenu/PVII/


    Well it looks like the easiest approach is to change that
    map_data_xml.php code to allow you to fetch marker data for different
    categories e.g. to allow
    map_data_xml.php?category=sh&category=sf&category=sb
    then you can simply pass that URL to your readMap function and it should
    parse out the markers and display them.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Dec 30, 2007
    #2
    1. Advertising

  3. Tine Müller

    Tine Müller Guest

    "Martin Honnen" wrote
    > Well it looks like the easiest approach is to change that map_data_xml.php
    > code to allow you to fetch marker data for different categories e.g. to
    > allow
    > map_data_xml.php?category=sh&category=sf&category=sb
    > then you can simply pass that URL to your readMap function and it should
    > parse out the markers and display them.


    Hej Martin

    Thanks for trying to help but I'm not sure what to change in
    map_data_xml.php? This it how it looks now:

    //Get the variable from the link
    $category=$_GET["category"];

    // Select all the rows in the markers table
    $query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
    ='$category' ORDER BY branchname ASC ";

    And I have made this in index.php

    theText[13] = "Sjælland - Alle";
    xmlfile[13] = "map_data_xml.php?category=sh&category=sf&category=sb";

    <a href="javascript:;"
    onclick="handleSelected(13);changeText(13)">Evt. ALLE</a>

    But when you click on the menu "Sjælland - Evt. ALLE" you see the markers
    from "Bogbusser".

    What code shall I change for it to work?

    /Tine
     
    Tine Müller, Dec 30, 2007
    #3
  4. Tine Müller wrote:
    > "Martin Honnen" wrote
    >> Well it looks like the easiest approach is to change that map_data_xml.php
    >> code to allow you to fetch marker data for different categories e.g. to
    >> allow
    >> map_data_xml.php?category=sh&category=sf&category=sb
    >> then you can simply pass that URL to your readMap function and it should
    >> parse out the markers and display them.


    > Thanks for trying to help but I'm not sure what to change in
    > map_data_xml.php? This it how it looks now:
    >
    > //Get the variable from the link
    > $category=$_GET["category"];


    My PHP is rusty and I have never been very good at it. I forgot that for
    PHP you need to suffix your parameters with [] if you want to provide
    several with the same name and want PHP to provide you an array. So you
    need links alike
    map_data_xml.php?category[]=sh&category[]=sf&category[]=sb
    then you can process the data as follows I hope:

    > // Select all the rows in the markers table
    > $query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
    > ='$category' ORDER BY branchname ASC ";


    $inarg = "'" . implode("','", $_GET['category']) . "'";


    // Select all the rows in the markers table
    $query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
    IN ($inarg) ORDER BY branchname ASC ";


    Your original code and the change above are open to SQL injection
    attackes, ask in a PHP group how to fix that.



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Dec 30, 2007
    #4
  5. Tine Müller

    Tine Müller Guest

    "Martin Honnen" wrote
    > My PHP is rusty and I have never been very good at it. I forgot that for
    > PHP you need to suffix your parameters with [] if you want to provide
    > several with the same name and want PHP to provide you an array. So you
    > need links alike
    > map_data_xml.php?category[]=sh&category[]=sf&category[]=sb
    > then you can process the data as follows I hope:
    >
    >> // Select all the rows in the markers table
    >> $query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
    >> ='$category' ORDER BY branchname ASC ";

    >
    > $inarg = "'" . implode("','", $_GET['category']) . "'";
    >
    >
    > // Select all the rows in the markers table
    > $query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
    > IN ($inarg) ORDER BY branchname ASC ";
    >
    >
    > Your original code and the change above are open to SQL injection
    > attackes, ask in a PHP group how to fix that.




    I have made your changes but it doesn't work. Do you have other suggestions?

    <!-- xmlfile[13] =
    "map_data_xml.php?category=sh&category=sf&category=sb"; -->
    xmlfile[13] =
    "map_data_xml.php?category[]=sh&category[]=sf&category[]=sb";

    //Get the variable from the link
    /*$category=$_GET["category"];*/
    $inarg = "'" . implode("','", $_GET['category']) . "'";

    // Select all the rows in the markers table
    /*$query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category
    ='$category' ORDER BY branchname ASC ";*/
    $query="SELECT * FROM manyboxes_alle_folkebiblioteker WHERE category IN
    ($inarg) ORDER BY branchname ASC ";

    /Tine
     
    Tine Müller, Dec 30, 2007
    #5
  6. Tine Müller wrote:

    > I have made your changes but it doesn't work. Do you have other suggestions?


    As I haven't seen much of your server-side code I am more or less
    guessing what your server-side code might do and how it can be changed
    to produce marker data for several categories.
    When you say "it doesn't work" what does that mean exactly? Do you get
    errors, if so which exactly?



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Dec 31, 2007
    #6
  7. Tine Müller

    Tine Müller Guest

    "Martin Honnen" wrote
    > As I haven't seen much of your server-side code I am more or less guessing
    > what your server-side code might do and how it can be changed to produce
    > marker data for several categories.
    > When you say "it doesn't work" what does that mean exactly? Do you get
    > errors, if so which exactly?


    I'm not sure what happend the first time but after deleting the new code and
    afterwards today after your message pasted it again it looks like it's
    functioning.:)

    Now I will make it also for the other parts of the country.

    Thanks so much for your help.

    /Tine
     
    Tine Müller, Dec 31, 2007
    #7
  8. Tine Müller

    Tine Müller Guest

    I was too quick to say it's functioning. Now it's only ALLE there is
    functioning and not all the others.

    I get this message when loading this
    http://www.tinemuller.dk/alle_folkebiblioteker/dropdownmenu/PVII/map_data_xml.php?category=sh

    Warning: implode() [function.implode]: Invalid arguments passed in
    /home/www/tinemuller.dk/alle_folkebiblioteker/dropdownmenu/PVII/map_data_xml.php
    on line 11

    Warning: Cannot modify header information - headers already sent by (output
    started at
    /home/www/tinemuller.dk/alle_folkebiblioteker/dropdownmenu/PVII/map_data_xml.php:11)
    in
    /home/www/tinemuller.dk/alle_folkebiblioteker/dropdownmenu/PVII/map_data_xml.php
    on line 25

    Hope it's ok that I send you my map_data_xml.php to your private
    mailaddress?

    /Tine

    "Tine Müller" <> skrev i en meddelelse
    news:Tf6ej.36$2net.dk...
    > "Martin Honnen" wrote
    >> As I haven't seen much of your server-side code I am more or less
    >> guessing what your server-side code might do and how it can be changed to
    >> produce marker data for several categories.
    >> When you say "it doesn't work" what does that mean exactly? Do you get
    >> errors, if so which exactly?

    >
    > I'm not sure what happend the first time but after deleting the new code
    > and afterwards today after your message pasted it again it looks like it's
    > functioning.:)
    >
    > Now I will make it also for the other parts of the country.
    >
    > Thanks so much for your help.
    >
    > /Tine
    >
    >
     
    Tine Müller, Dec 31, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ray Booysen
    Replies:
    2
    Views:
    657
    Ray Booysen
    Mar 28, 2006
  2. Simon Elliott
    Replies:
    4
    Views:
    1,173
    Simon Elliott
    Mar 10, 2005
  3. Marcus
    Replies:
    2
    Views:
    598
    Marcus
    Dec 9, 2005
  4. =?Utf-8?B?TWlrZQ==?=

    Mixing Non-ASP.NET & ASP.NET Files in One Domain

    =?Utf-8?B?TWlrZQ==?=, Aug 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    298
    Cowboy \(Gregory A. Beamer\)
    Aug 10, 2007
Loading...

Share This Page