Instant markers changes on a Map

Phoca Maps - displaying maps in Joomla! CMS
eds2000
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 05 Nov 2018, 06:14

Instant markers changes on a Map

Post by eds2000 » 07 Nov 2019, 06:51

Good day, thanks a lot, all u do is SUPER
my question: is there a way to show (hide) new markers on a map instantly dont refresh site (maybe a plugin or ajax+jqeury??)

Thanks

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 42542
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Instant markers changes on a Map

Post by Jan » 12 Nov 2019, 16:33

Hi, not sure if I understand your question correctly?

Do you mean, that when you add new marker in administration, such will be displayed in frontend automatically? Mostly when you add new marker, all users will load the page after that, so not sure, if there should be such option?

Jan
If you find Phoca extensions useful, please support the project

eds2000
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 05 Nov 2018, 06:14

Re: Instant markers changes on a Map

Post by eds2000 » 13 Nov 2019, 14:45

Yes, u understand absolutly right. but i need that a user during watching the map could see apeareance of new markers (or disapear)
without reloading the website. (just like when u use whatsapp for example)
maybe such kind of a code will do this, but i dont understand where to past it in joomla (i think somehow in article) but ists eror
becouse plugin uses {....} element (perhapse)

Code: Select all

<body>  
      
    <div id="content"></div>  
      
    <script>  
        function show()  
        {  
            $.ajax({  
               [color=#FFBF00] url: "time.php",  [/color]
                cache: false,  
                success: function(html){  
                    $("#content").html(html);  
                }  
            });  
        }  
      
        $(document).ready(function(){  
            show();  
            setInterval('show()',1000);  
        });  
    </script>  
      
</body>

this is code to publish time (for example)

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 42542
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Instant markers changes on a Map

Post by Jan » 15 Nov 2019, 14:08

Hi, unfortunately, I have no experiences with such feature, so hard to say. In general, you need to use some AJAX function. The problem is how to recreate Javascript code, as the map is rendered by Javascript. So for this you need to see maps API to add dynamically the markers. The AJAX function just asks for the markers and you need to do some comparing function - between new and old markers, so only new are added to the map :idea:

Jan
If you find Phoca extensions useful, please support the project

eds2000
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 05 Nov 2018, 06:14

Re: Instant markers changes on a Map

Post by eds2000 » 05 May 2020, 10:21

Good day!
Maybe there is another way?
as I understand plugin shows the map in joomla artical.
what if to update only this plugin.
i had some tries but i failed. perhaps i wrote wrong path. (my sript dont understand what to do)

Code: Select all

<!DOCTYPE html>
<html lang="en">
    <?php
    include 'includes/head.php'; ?>
	    <body>
<!-- 		<script>
        function show()  
        {  
            jQuery.ajax({
				type: "GET",
                [color=#FFFF00]JURI::base().'plugins/content/phocamaps/phocamaps.php',[/color]
                cache: false,  
                success: function(html){  
                    jQuery("#phocaMapPlgPM1").html(html);  
                }  
            });  
        }  
      
        jQuery(document).ready(function(){  
            show();  
            setInterval('show()',1000);  
        }); </script>-->

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 42542
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Instant markers changes on a Map

Post by Jan » 05 May 2020, 13:19

Hi, it does not matter where the map is displayed, the data are all stored in database. So when rendering the map, the Javascript which renders the map, get all the information from the Joomla! database (Phoca Maps tables) prepered by PHP functions. :idea:

Jan
If you find Phoca extensions useful, please support the project

Post Reply