using the content of a field in another of the same article

More
12 years 4 months ago #32887 by rottenberg
Hello

I am using 2 fields in a type of article to display quite the same thing :
- Address (postal address)
- Google map of the the address given before

the Google map field is something like :
{mosmap zoom='15'|text='<div><div>title of the address</div></div>'|address='the same information as given in the other field'|dir='2'|}

I don't want to customize the type template used.

Is there an availibility to get the content of the first field inside the second.

If possible I would be able to ask only one time the address to the user.

thank you for help
best regards

Michel

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

More
12 years 4 months ago #32889 by brandonking
Hello Michel,

Please read flexicontent.org/forum/index.php?f=20&t=5294&rb_v=viewtopic

I am wating for this feature as well. :D
Maybe in a few days...

Brandon

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

More
12 years 4 months ago #32891 by rottenberg
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

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

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

More
12 years 4 months ago #32902 by brandonking
Hi rottenberg,

Thanks for sharing and didn't know that there is other way around.
I want to try it now. :D
Did you use free version of Rereplacer to do this or do I have to purchase it?
Did you write php code in Search & Replace text area?

Regards,
Brandon

P.S I think you used soucerer as well, right?

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

More
12 years 4 months ago #32906 by rottenberg
Hello Brandon

I'm using quite only free nonumber.nl components and plugins.

My advice for installation :
download only the nonumber extension manager on your Joomla.
This will create a component containing all available Nonumber extensions.

Choose the extensions you need to install in this component, they will be uploaded directly.
Then when there is an upgrade in one of the extension : you will get the information in this component or in the page of the extension.


For Rereplacer you can import/expoert existing record from another Rereplacer. So I join the 2 records I have presented in my previous post. Unzip the uploaded file.
You just need to import the file [ReReplacer Items (6).rrbak] in rereplacer (top right import button) and you will get the records in your Rereplacer.

Go and read the documentation in nonumber there are a lot of important advices (order of nonumber plugin, differents ways to use an extension...) and as for GGPPDK for Flexiconent Peter from Nonumber answers your questions and problems very quickly in the forum.

For me Flexicontent + Nonumber are the best couple to do complex things in Joomla.

Just a desapointment from Nonumber. There is a very usefull extension in Nonumber : articles anywhere. But it's no very compatible with Flexicontent. This plugin uses only Standard Joomla variables. We cannot use it with Flexicontent's fields.

Best regards

Michel

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

More
12 years 4 months ago #32907 by brandonking
Hello Michel,

Really great to know and appreciates for sharing your knowledge.
I have been trying using it and took 5hours and finally I did it. :) There were couple of reason that I couldn't make it work.
1) I have found that opening and closing text in date field are not working properly.(I have to report it as bug)
2) Cache problem - solved by installing cache cleaner from NoNumber.

Now I understand that FC with NoNumbers extensions, nothing can be hard. Just great solution! :D

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.347 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save