Can i use variables in Content

accordia
accordia used Ask the Experts™
on
Hi everyone,

Could i add some variables into the content?

I want to make some CCK content, with fields title, body, images, and languages.

I have several pages with same text into the body filed, but only one word is different. And in one case I have to change and title of content, too.

Example

Title: Example work

Body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce et tristique mauris. Files Nulla dapibus malesuada sem, quis interdum dui tempus id. Proin turpis dui, commodo eget tempus sit amet,


Title: Example hard

Body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce et tristique mauris. Folders Nulla dapibus malesuada sem, quis interdum dui tempus id. Proin turpis dui, commodo eget tempus sit amet,

Can you tell me what i should do, and on which way?¿

I wanted to use variables like a table.

                              content1                        content2                       content3                      content4
variables1                 files                             folders                             doc                         programs  
variables2             .......

So in this case example looks:

Title: Example variables2

Body: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce et tristique mauris. variables1 Nulla dapibus malesuada sem, quis interdum dui tempus id. Proin turpis dui, commodo eget tempus sit amet,
 




Any help would be appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You have to make sure php is enabled on the module page, and then you would have to add the php tags around the variable name. Some people consider it bad form to use php on Drupal pages, but I am not sure I buy that.
Commented:
Thanks for quick reply!

I tried with tokens to resolve the problem and I managed to solve in the Body field.

The only thing I have left is how to use the token in Title filed.

If you can tell me how to solve this problem using tokens I will finish my job!

I have used this function:

function modulename_token_values($type, $object = NULL, $options = array()) {
    $values = array();
    if ($type == 'user') {
            $values["token-name1"] = "files";
            $values["token-name2"] = "folders";
            $values["token-name3"] = "doc";
            $values["token-name4"] = "programs";
    return $values;
  }
}

function modulename_token_list($type = 'all') {
  if ($type == 'user' || $type =='all') {
    $tokens['user']['token-name1']            = t('A description of token name 1');
    $tokens['user']['token-name2']          = t('Token name 2\'s description');
    $tokens['user']['token-name3']          = t('Token name 3\'s description');  
    $tokens['user']['token-name4']          = t('Token name 4\'s description');  
    return $tokens;
  }
}

And in body field instead of [token user token-name1] appears files.

But how to use token in title field?

Author

Commented:
i still haven't found what i'm looking for, how to use tokens in title field.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial