Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I need to generate numeric string and append it at the end of node url. Tried using some token random number options but the result is 10 digit number which is not neccessary for my purpose. Is there any other option? Node NID is not possible to use. Thank you

share|improve this question
 
could you use the day of the month? –  Jimajamma Apr 4 at 1:12
 
no it needs to be different in every node I create - max 20 nodes. I construct automatic url+title like this - referenced node + number string. –  loparr Apr 4 at 2:51

1 Answer

$length = 3; // character length
$token = substr(drupal_hmac_base64($node->nid, drupal_get_private_key() . drupal_get_hash_salt()), 0, $length);
share|improve this answer
 
Hi, where to put this code? I can only use tokens available using UI. –  loparr Apr 4 at 2:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.