Hi,
On my website fishing lakes can be registered / entered (via a registration (Chrono)form).
I display the list of fishing lakes using ChronoConnectivity, when the link of one lake is clicked I take the user to the details page, which is again a form realised using ChronoForms and the Profile Plugin to display a single record of my database table.
I want to do some Php programming to display a google map if the GPS coordinates were supplied during the registration and to set dynamically the meta data of the page (description and key words).
My problem is that I don't know how to use in Php the variables that describe my record.
For instance, suppose I have: {name_of_lake}, {GPS_latitude}, {GPS_longitude} (the last 2 are not displayed on my page, so they are not used in the Form HTML.
In the Form HTML I tried to use different code to get the values of these fields, but most often without success. For example:
In the above example the line
works without problems in order to find out the user id of the lake in order to display the images uploaded by the lake's admin.
But the same approach does not work in the first section:
So that part of the code is commented out as of now.
I also tried other formats, like:
$_POST['name_of_lake'] or
$var = JRequest::getVar('name_of_lake');
I admit I am new to Joomla and Php, but maybe some of you can help, I could not find an exact solution on this forum despite searching for hours.
Thanks in advance.
On my website fishing lakes can be registered / entered (via a registration (Chrono)form).
I display the list of fishing lakes using ChronoConnectivity, when the link of one lake is clicked I take the user to the details page, which is again a form realised using ChronoForms and the Profile Plugin to display a single record of my database table.
I want to do some Php programming to display a google map if the GPS coordinates were supplied during the registration and to set dynamically the meta data of the page (description and key words).
My problem is that I don't know how to use in Php the variables that describe my record.
For instance, suppose I have: {name_of_lake}, {GPS_latitude}, {GPS_longitude} (the last 2 are not displayed on my page, so they are not used in the Form HTML.
In the Form HTML I tried to use different code to get the values of these fields, but most often without success. For example:
<?php
JHTML::_('behavior.modal');
/* Set the page title, description and key words*/
$doc =& JFactory::getDocument();
$lake = {name_of_lake}; /* does not work!!*/
$page_description = 'Horgásztavak - '.$lake;
$page_title = 'Horgásztavak - '.$lake;
$doc->setDescription ($page_description, $page_title);
$page_keywords = 'some text here..'.$lake;
$doc->setMetaData('keywords', $page_keywords);
/*Get user category from gallery to display images*/
$db =& JFactory::getDBO();
$cf_user_id = {cf_user_id}; /* This works!!*/
$query = "
SELECT `cid`
FROM `#__joomgallery_catg` WHERE `owner` = $cf_user_id;
";
$db->setQuery($query);
$joomgallery_cat = $db->loadResult();
/*Get path to user category... */
/*Get pictures from joomgallery category... */
/* and display pictures */
}
?>
In the above example the line
$cf_user_id = {cf_user_id};
works without problems in order to find out the user id of the lake in order to display the images uploaded by the lake's admin.
But the same approach does not work in the first section:
$lake = {name_of_lake}; /* does not work!!*/
So that part of the code is commented out as of now.
I also tried other formats, like:
$_POST['name_of_lake'] or
$var = JRequest::getVar('name_of_lake');
I admit I am new to Joomla and Php, but maybe some of you can help, I could not find an exact solution on this forum despite searching for hours.
Thanks in advance.
Hi szutyanka,
The {input_name} syntax will work (or should work) if 'input_name' is a column in the table that you linked to in the Profile Page setup.
You don't say where the lake info is stored? Is it in the same table or a different one?
Bob
The {input_name} syntax will work (or should work) if 'input_name' is a column in the table that you linked to in the Profile Page setup.
You don't say where the lake info is stored? Is it in the same table or a different one?
Bob
Hi Bob,
Thanks for your reply.
I realised it works indeed as you have said. I was only missing the quotes around the placeholder tag. Probaly a newbie mistake 😀
I figure it was working for cf_user_id without the quotes as it was a sequence number.
Thanks anyway. Love ChronoForms and ChronoConnectivity! Great support as well!
Cheers,
szutyanka.
Thanks for your reply.
I realised it works indeed as you have said. I was only missing the quotes around the placeholder tag. Probaly a newbie mistake 😀
$variable = '{input_name}';
I figure it was working for cf_user_id without the quotes as it was a sequence number.
Thanks anyway. Love ChronoForms and ChronoConnectivity! Great support as well!
Cheers,
szutyanka.
Hi,
I have been racking my brains on this problem for sometime and finally need to ask for help. This is the closest post I could find.
I am using the profile plugin to fill a form which works well.
What I am trying to achieve is to display the date in an inputbox in the form of dd-mm-yyyy. The table (mySQL) is yyyy-mm-dd.
My clients are middle-elderly and used to dd-mm-yyyy format, so they need to enter this date and this will be stored correctly in the database. When extracting this field, it will be displayed in the same manner.
I have the code to reformat the view of the code...
This displays...
When I use the same code on the database field...
This displays...
I even tried to use 'substr' to extract the YYYY, MM, DD but got '{tex', '_0', ' ' in return.
Seems the data can be displayed correctly as 'echo $date' but not when something is done to that variable.
Please help or point me in the right direction. Thanks Jamie.
I have been racking my brains on this problem for sometime and finally need to ask for help. This is the closest post I could find.
I am using the profile plugin to fill a form which works well.
What I am trying to achieve is to display the date in an inputbox in the form of dd-mm-yyyy. The table (mySQL) is yyyy-mm-dd.
My clients are middle-elderly and used to dd-mm-yyyy format, so they need to enter this date and this will be stored correctly in the database. When extracting this field, it will be displayed in the same manner.
I have the code to reformat the view of the code...
Test of functions<br />
<?
$date = '2009-10-25';
// Convert date string into UNIX timestamp
echo 'Before = ' . $date . '<br />';
$timestamp = strtotime($date);
// Convert timestamp into formatted date
$date = date('d-m-Y', $timestamp);
// Show result
echo 'after = ' . $date;
?>
<br />
WORKS!This displays...
Test of functions
Before = 2009-10-25
after = 25-10-2009
WORKS!
When I use the same code on the database field...
Test from database<br />
<?php
$date = "{text_0}";
// Convert date string into UNIX timestamp
echo 'Before = ' . $date . '<br />';
$timestamp = strtotime($date);
// Convert timestamp into formatted date
$date = date('d-m-Y', $timestamp);
// Show result
echo 'after = ' . $date;
?>
<br />
DOESN'T!This displays...
Test from database
Before = 2011-06-17
after = 01-01-1970
DOESN'T!
I even tried to use 'substr' to extract the YYYY, MM, DD but got '{tex', '_0', ' ' in return.
Seems the data can be displayed correctly as 'echo $date' but not when something is done to that variable.
Please help or point me in the right direction. Thanks Jamie.
This topic is locked and no more replies can be posted.
