Jump to content

Recommended Posts

Posted

Since i'm still fairly new to all of this, i thought i'd ask the question in the getting started. Can't say that i feel like i have graduated to the grown up forums yet ;)

I'm wondering (and have been searching) if it is possible to reference specific fields (actually specific values of fields) in the other fields, such as the textarea field (body).

I have a lot of data, some of it i would like to reference directly from the body. For instance:

This entity is the parent company of <<PAGE FIELD VALUE>> and was sold by <<PAGE FIELD VALUE>> to <<PAGE FIELD VALUE>>.

The end result would be : This entity is the parent company of "Google Inc" and was sold by "John Doe" to "James Surname".

Is there a way to achieve this? Can't see anything in the documentation, or maybe i am not looking in the right place.

Any help is appreciated!

Posted (edited)

You can use Hanna code for this http://modules.processwire.com/modules/process-hanna-code/

You would create a new Hanna code called, let's say "value", and put something like this in the code:

echo $page->get($field);

Then you would simply do this inside the body text:

[[value, field=parent_company]]

Read the Hanna code instructions to have a feeling of what you can do with it.

Edited by diogo
corrected typo
  • Like 6
Posted

Another option would be to create a textformatter module (it's really simple) and have it replace your tags with the field values. Would be quite the same as Hanna code... Hanna code would maybe be more the click click way of it :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...