creating form on marker

More
10 years 5 months ago - 10 years 5 months ago #4002 by racetech
Replied by racetech on topic creating form on marker
Hi Dima,

The code for my php file was as below (only for test), but when I call this file from the iframe in the Marker of ZhGoogleMaps, returns the following error:

Fatal error: Using $this when not in object context in /home/presalt/public_html/pocos_data_show.php on line 5


Code in the file:

<?php

date_default_timezone_set('America/Sao_Paulo');

$id = $this->getState('map.id');

$db = JFactory::getDBO();

$query = $db->getQuery(true);

$query->select('h.*, c.title as category ')
->from('#__zhgooglemaps_paths as h')
->leftJoin('#__categories as c ON h.catid=c.id')
->where('h.published=1 and h.mapid='.(int)$id);
$db->setQuery($query);

// Paths
if (!$this->paths = $db->loadObjectList())
{
$this->setError($db->getError());
}

$row = $db->loadRow();
$var=$row("title");
$query2="SELECT * FROM presalt_pocos WHERE poco = $var";
$result2=mysql_query($query2);

$num2=mysql_numrows($result2);

mysql_close();

$operator=mysql_result($result2,$i,"operadora");
$poco_operador=mysql_result($result2,$i,"poco_operador");
$id=mysql_result($result,$i,"id");

echo '<div>'.$operator.'</div>';
echo '<div>'.$poco_operador.'</div>';
echo '<div>'.$id.'</div>';

?>
Last edit: 10 years 5 months ago by racetech. Reason: change

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #4007 by racetech
Replied by racetech on topic creating form on marker

racetech wrote:
returns the following error:
Fatal error: Using $this when not in object context in /home/presalt/public_html/pocos_data_show.php on line 5


Hi Dima,

I solved the problems of non-functioning of $this and JFactory within iFrames. I found the following code on the web to solve this problem:

<?php
define('_JEXEC', 1 );
define('JPATH_BASE', $_SERVER );
define( 'DS','/' );

require_once ( JPATH_BASE.DS. 'includes'.DS.'defines.php' );
require_once ( JPATH_BASE.DS.'includes'.DS.'framework.php' );
require(JPATH_BASE.DS.'libraries/joomla/factory.php');

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
?>

But now InfoWin appears empty, no data

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #4008 by Dima
Replied by Dima on topic creating form on marker
You can enable debugging in joomla options, and check what query is done. I think you enter incorrect query clause

Don't forget support my developments: post review in JED , donate , help with translation ;)

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #4009 by racetech
Replied by racetech on topic creating form on marker
Hi Dima,

Now the query is already working within the iframe.

But, I wanted to use the text that I insert in the title of the form of Marker as a variable in the php code that is accessed within the iframe.

The text that I insert in the title of the Marker is what is going to select a specific record from the database, with the Where condition.

I would have to find a way that my code (inside of iFrame) could take the title of Marker and put into a variable within the iFrame.

Best regards,

Fernando

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #4021 by Dima
Replied by Dima on topic creating form on marker
In iframe tag you enter URL, and you can add into this URL some yours parameters, and get it in your php file

Don't forget support my developments: post review in JED , donate , help with translation ;)

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #4045 by racetech
Replied by racetech on topic creating form on marker
Hi Dima,

I tried several ways to put the value of the title field in the iframe src URL, but I have no success.

Could you give me an example of how to include the string, inserted into the title field of the Marker, in the URL?

With that I would create, in my php, the variable I need to call the record in the database.

Thanks and best regards,

Fernando

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds

Donate


Go to top