| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 $Id: README.txt,v 1.7.2.4 2009/07/15 19:59:14 fago Exp $ 2 3 Automatic Nodetitle Module 4 ------------------------ 5 by Wolfgang Ziegler, nuppla@zites.net 6 7 8 Description 9 ----------- 10 This is a small and efficent module that allows hiding of the content title field in the form. 11 To prevent empty content title fields it sets the title to the content type name or to an 12 configurable string. If the token module is installled it's possible to use various content 13 data for the autogenerated title - e.g. use the text of a CCK field. 14 15 Advanced users can also provide some PHP code, that is used for automatically generating an 16 appropriate title. 17 18 Installation 19 ------------ 20 * (optional) Download and install the token module. 21 * Copy the module's directory to your modules directory and activate the module. 22 * For each content type you want to have an automatic title, click on the 23 "edit" link for it on 'admin/content/types' 24 * At the top of the content type edit form, there is a "Automatic title 25 generation" box allowing you to configure the details for the current content 26 type. 27 28 29 30 31 Advanced Use: PHP Code 32 ------------------------ 33 You can access $node from your php code. Look at this simple example, which just adds the node's 34 author as title: 35 36 <?php return "Author: $node->name"; ?> 37 38 39 40 Advanced Use: Combining tokens and PHP 41 --------------------------------------- 42 43 You can combine php evalution with the token module, because tokens are replaced first. 44 However be aware to don't use this with any textual values provided by users as this would 45 open a security hole. If you are in doubt, don't combine tokens with php evaluation. 46 47 Here is an example: 48 49 <?php 50 $token = '[field_testnumber]'; 51 if (empty($token)) { 52 return '[type]'; 53 } 54 else { 55 return $token; 56 } 57 ?> 58 59 So if the text of the CCK number [field_testnumber] isn't empty it will be used as title. 60 Otherwise the node type will be used. 61 62 63 64 65 Updating nodetitles from existing nodes 66 --------------------------------------- 67 If you set the nodetitle to be auto generated for some content type, existing nodes 68 are not affected. You can update existing nodes by going to 'admin/content/node', 69 then filter for your content type, mark some nodes and choose the "Update option" 70 "Update automatic nodetitles". 71 72
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |