Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: mod for an XML file

  1. #1
    Join Date
    Oct 2004
    Posts
    139

    Default mod for an XML file

    Hello

    I am looking for some help on how to output an xml file. I am not sure where to start but I need something like;

    Code:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <markers>
    
    	<marker lat=" $lat " long=" $lng " title=" $title ">
    	<description><![CDATA[ $detail_page_url ]]></description>
    	</marker>
    
    	<marker lat=" $lat " long=" $lng " title=" $title ">
    	<description><![CDATA[ $detail_page_url ]]></description>
    	</marker>
    
    	<marker lat=" $lat " long=" $lng " title=" $title ">
    	<description><![CDATA[ $detail_page_url ]]></description>
    	</marker>
    
    </markers>
    Would this require much coding? Any ideas on how I could achieve this would be greatly appreciated.

    Many thanks

  2. #2
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    echo the text and data to a page from a php file... however im not really sure of your aim? what are you trying to display? is it going to be the top 10 sites or something but with the latitude and longitude included in the xml?

    maybe your after something similar to what i did here?
    Campsites Radius Search
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  3. #3
    Join Date
    Oct 2004
    Posts
    139

    Default

    Hi inspireme

    Many thanks for your help (again).

    The plan was to display all/sites which wish to be listed, on a single G map. I have a rough layout here at jewelry-directory dot org (click on ‘jewelry finder’). Currently it has markers for various sites pulled from the data.xml file, but I was hoping to make the data.xml file dynamic as it is just like a flat file at the moment. The markers each display a flag with the title and a link to the appropriate details page.

    I was wondering if I could duplicate and modify sitemap.php but I am guessing it would not be that easy.

    Sorry I am really, really bad at the explanations and even worse at hacking php/javascript.

    Many thanks for your help as always.

  4. #4
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    Before you echo-ing the above xml template, you must do the following step:

    - connect to database
    - send query to database
    - fetch the query result

    Here is a direction taken from php manual, I hope you can understand the logic here:

    PHP Code:
    <?

    // connect db

    mysql_connect('localhost''mysql_user''mysql_password');
    mysql_select_db('indexu_database_name');

    // send query

    $query "select * from idx_link";
    $result mysql_query($query);

    // fetch

    while ($row mysql_fetch_assoc($result)) {
        echo 
    $row["link_id"];
        echo 
    $row["title"];
        echo 
    $row["url"];
    }

    ?>

  5. #5
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    I understand - at first i also used a data.xml - I also created htis automatically *i could possibly send you the exact file to look at if i still have it* however, i soon learned this is a bad way of doing it, you are much better storing the coordinates in the database as a custom field, if you try and display every signle marker on a map (as you are) it will crash out with about 500 markers... so you need away to limit them to an area.

    Campsites Radius Search

    this is how im doing it, basically it uses a special sql query that finds all local sites. I would recommend you didnt bother with data.xml file, you need ot connect to the database, then echo the "lat" and "lon" values onto the page so it looks like the google examples... if you dont know much about php then it maybe a little tricky for you, i would think i could do this for you in about 3-4 hours work, so it works like on my site, i do webdesign for a livign so unfortunatly i would have to charge a little to do it for you. let me know if you want me to have a look, if not i can post some hints and you can work it out...
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  6. #6
    Join Date
    Oct 2004
    Posts
    139

    Default

    ok - That is great advice - many thanks

    I guess the first question would have to be - Does Indexu plan on anything like this with Google maps?

    Inspireme, your Campsite Radius Search is great - could this be (easily) made as a 'add on' rather than a 'mod'/code change to the core Indexu files? So there wouldn’t be any Indexu updating problems.

    Many thanks for all your help and understanding.

  7. #7
    Join Date
    May 2004
    Location
    New Zealand
    Posts
    600

    Default

    that would be a awesome addon.....

  8. #8
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    i think peoples main problem is simply getting hte latitude and longitude. its also only relevant for listings with physical locations, not general directories which i think is the core use of indexU. what i have done is really modular because its seperate from indexU - i can make any upgrades to indexU and it will all work without me changing anything, in fact, its worked since 3.2 upgrading to 5.3 with only the search engine friendly detail pages needing to be changed.

    $150 if anybody wants me to do it for them, and i would need you to already have 2 custom fields with "lat" and "lon" these are coordinate systems, you can get them in the US for free, you can get them in the UK from places like postcodeanywhere if you ahve a worldwide directory you will probably need to rig up a google maps on the add page, the user can put the pointer where they are located and this will echo the lat and lon values to the add form. I can do that as well for an additional $50 - i usually post mods for free, but this all took me about 4 months to work out how to do, and its gone through hundreds of changes to get to where it is - so i dont really want to just post it.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  9. #9
    Join Date
    Apr 2006
    Posts
    447

    Default

    If you have address information, Yahoo maps is extremely easy -- no need at all for the lat/long conversion. Why Google hasn't bothered to incorporate escapes me.
    Last edited by CEC; 11-21-2006 at 11:49 AM.

  10. #10
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    Google includes a geocoder for USA - yahoo is rubbish for maps outside of USA. The fact is nobody could offer geocoding from address in the UK because the post office here is holding the data to randsom to a tune of £600 a server, per year. Unless someone compiles their own list or search engines pays big $$ your will have trouble. Lat and Lon is extremly useful, you can use it to search by radius, and for me in my admin panel i can get listings automatically put into the correct categories.

    Quote Originally Posted by CEC View Post
    If you have address information, Yahoo maps is extremely easy -- no need at all for the lat/long conversion. Why Google hasn't bothered to incorporate escapes me.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  11. #11
    Join Date
    Oct 2004
    Posts
    139

    Default

    i think peoples main problem is simply getting hte latitude and longitude.
    I have a 'drag and drop' long/lat finder here, if anyone finds it of use - jewelry-directory dot org/add.php?cat=1


    $150 if anybody wants me to do it for them..
    ... i usually post mods for free, but this all took me about 4 months to work out how to do, and its gone through hundreds of changes to get to where it is
    Great. Just to get an idea - Would instillation involve uploading a folder of files, adding a <php include> in the appropriate template file and then changing the API/minor adjustments. Could it be as simple as that or would instillation be slightly more complicated?

    Thanks

  12. #12
    Join Date
    Apr 2006
    Posts
    447

    Default

    Quote Originally Posted by inspireme View Post
    Google includes a geocoder for USA - yahoo is rubbish for maps outside of USA. The fact is nobody could offer geocoding from address in the UK because the post office here is holding the data to randsom to a tune of £600 a server, per year. Unless someone compiles their own list or search engines pays big $$ your will have trouble. Lat and Lon is extremly useful, you can use it to search by radius, and for me in my admin panel i can get listings automatically put into the correct categories.
    Thanks, inspireme. You're right, I see geocoding has finally been added by Google -- certainly were slow out of the blocks! You're also right about Yahoo being rubbish outide of the USA!

  13. #13
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    well, what i have at the moment is jsut a folder that i upload, it doesnt use any files from indexU - i have hard coded the API and the database settings, but for others i will move these to a seperate file... so basically you will :

    1) uplaod folder
    2) edit config (4-5 settings)
    3) link to the map page however you would like.

    i think this would be about 2-3 hours work to get ready to give to other people as i have hard coded a lot of bits only relevant to me. I cant htink of anyway upgrades of indexU will effect it. BUT its possible an upgrade to google maps could cause a problem (although, i will have the problem on my sites as well so i will fix that if ever its a problem)

    Is anybody here actually interested enough for this to warrent me doing it... i said $150 i think thats really a fair price considering the work that i put into it, and i doubt im going to sell it to more than 1-2 people, if you cant afford it then I can do a deal - you add 400 sites to a directory i run and i will give it to you for free

  14. #14
    Join Date
    Oct 2004
    Posts
    139

    Default

    I'll take one if PayPal is ok

  15. #15
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    paypals fine, let me work through the files and i will make it into a mod that people can easily use by just uploading and changing a few settings - definitely be done by next week.

Similar Threads

  1. How to include a [php] or [html] file in a [.tpl] file
    By althahabi in forum Website development, hosting and promotion
    Replies: 3
    Last Post: 07-04-2006, 11:21 PM
  2. [5.0.1/MOD] File hosting
    By dody in forum Blocks and Modification
    Replies: 7
    Last Post: 04-03-2006, 07:47 AM
  3. 5.0.1 htaccess file
    By persut in forum v5.x
    Replies: 1
    Last Post: 01-10-2006, 07:24 AM
  4. Replies: 1
    Last Post: 12-09-2005, 10:49 PM
  5. sql tables as txt file
    By Hetti in forum Indexu Lite
    Replies: 0
    Last Post: 06-03-2005, 02:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •