Submitted by mikeuk2000 on Thu, 11/08/2007 - 3:33am
Posted in
I'm using the Classified module as a simplified job advertisement system. See it here:
http://www.evacmod.net/?q=ed-classified
What I want to do is change the title text on this page from "Classifieds Ads" to "Position Ads".
I have already tried altering the following lines within the .module file:
<?php
drupal_set_title('Job Ads');
?>
But this does not affect the main page of the Classifieds Ads module :(.
Any ideas?
Use Drupal's localization module
Rather than alter the module source code, you should consider using the Drupal localization features, as described here:
http://drupal.org/node/24593
In the case you describe, I believe that the title is controlled by the hook_node_info callback:
<?php
function ed_classified_node_info() {
// beware: these must match nodeapi value; name must be same as $node->type for spam module to add spam reporting links
return array(EDI_CLASSIFIED_MODULE_NAME =>
array('name' => t('Classified Ads'), // cannot call node_get_types() since it ends up calling this code.
'module' => EDI_CLASSIFIED_MODULE_NAME,
'description' => t('Contains a title, a body, and an administrator-defined expiration date')));
}
?>
It's best to use the localization module to alter the text, rather than modify the module sources, because you will need to migrate your customizations to any new release.
I think the localizer module
I think the localizer module is used for developing multilingual content. But considering I only want to change a title on one page, I think it might be a little overkill. Essentially I'm looking for where this page reads/stores the page title "Classified Ads" and change it.
Does anyone know?
tweak ed_classified_node_info
The localization module is also used to alter text if you want to change some string without modifying a module.
See my previous reply for info about ed_classified_node_info which defines the text by Drupal.
Same Problem, but...
Hello,
I've got the same Problem. I tried to use the localization to change the title on the ads classifieds index page. Localization cannot find the String. I don't know what i can do to solve the problem. I changed the title in the .module-file, but it doesn't work, too.
Is their another way?
Thanks,
Sebastian
clear the cache
If you change the title in the module file, you need to clear out the cache tables for the change to appear:
http://drupal.org/node/17620