The map cannot be displayed, you haven't specified a location yet.
I have solved my problem (which is not to copy a field to another with the content but to use the content of a field in another field).
My problem was the following : an address is to be displayed in the front end twice :
- 1 - as a postal address
- 2 - as a Google Map centered on the address
At the beginning I asked of course to user to enter the address twice which is a little bit annoying.
Now I have found a solution to let the user entering only one time the address.
My solution needs the using of Re-replacer the Nonumber.nl component-plugin which replace a content by another when displaying a page (the replacement doesn't manage javascript function, but all html text is taken in charge).
My solution :
the 2 fields are called :
1-address (the postal address)
2-map (the correspindign google map)
in the description of the address field I use Opening text for Field and closing text field.
In the opening text field I have put a personnal tag [address]
In the closing text field I have put a personnal tab [/address]
Now when I display the address I get on the public page :
[address]xxxxx (the address writen by the user in the article)[/address]
In Re-replacer I have created a rule where the search item is a regular expression :
\[address\](.*?)\[/address\]
this mean that rereplacer will change all text beginning by [address] and finishing by [/address]
I enter some php lines in the to be replaced by :
Code:
{source 0}
<?php
$parm = stripslashes('[[escape]]\1[[/escape]]');
$_REQUEST['address'] = $parm;
echo $parm;
?>
{/source}
$parm is the text writen between [address][/address] tag.
I copy the content of $parm in a PHP variable.
I echoe the content of $parm.
So now on the page only the address is writen. Both tags have have been erased.
Now how printing the google map :
I use a plugin {mosmap....} to show the google map
The second field (map) is an hidden one (to not disturb the user with technical Google code).
I use only the opening and closing text field.
In the opening text field I have put a personnal tag
The google map can't be displayed, ask your administrator for more details
If nothing more is done we get on the public page :
where the Google map is tho be displayed.
In Rereplacer I have created a 2nd rule :
search content : \[map\](.*?)\[/map\]
to be replaced by something like that :
Code:
{source 0}
<?php
echo "{mosmap zoom='15'|text='<div><div>".$address."</div></div>' |address='".$_REQUEST['address']."|dir='2'|}";
unset($_REQUEST['address']);
?>
{/source}
in the replacement I echoe the Google plugin and I delete the variable created previously.
Very important in Rereplacer :
- 1 both rules are to be declared as 'regular expression' rules
- 2 the [address] rule is to be ordered before the [map]rule.
I'm using the Rereplacer in other cases with Flexicontent. It allows to customize a lot of things without updating the original Flexicontent template.
Flexicontent and Nonumber components are the main components used in my sites.
best regards
Michel