(SOLVED) Modifying Modules - Local directory required?

girlyReads

Joined: 2007-08-15
Posts: 14
Posted: Wed, 2007-08-15 14:34

Gallery version = 2.2.2 core 1.2.0.4
PHP version = 4.4.6 cgi-fcgi
Webserver = Apache/1.3.37 (Unix) mod_fastcgi/2.4.2 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.1b
Database = mysqlt 4.1.22-standard-log, lock.system=flock
Toolkits = ArchiveUpload, Dcraw, Exif, Getid3, LinkItemToolkit, Thumbnail, Gd, ImageMagick, NetPBM
Acceleration = none, none
Operating system = Linux box118.bluehost.com 2.6.21-3_1.BHsmp #1 SMP Fri Jun 1 09:45:19 MDT 2007 x86_64
Default theme = floatrix
gettext = enabled
Locale = en_GB
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.2; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Rows in GalleryAccessMap table = 27
Rows in GalleryAccessSubscriberMap table = 10
Rows in GalleryUser table = 2
Rows in GalleryItem table = 6
Rows in GalleryAlbumItem table = 3
Rows in GalleryCacheMap table = 0

Hi,

As a best practice going forward, if I amend a module, should I place the amended file in a directory named "local" as is the case for themes?

Below, I have amended CustomFields to alter the description from "CustomFields" to "More Options..." - this might have been overkill, but I couldnt find a way to do it in the module itself.

Quote:
{*
* $Revision: 15342 $
* If you want to customize this file, do not edit it directly since future upgrades
* may overwrite it. Instead, copy it into a new directory called "local" and edit that
* version. Gallery will look for that file first and use it if it exists.
*}
{g->callback type="customfield.LoadCustomFields" itemId=$item.id|default:$theme.item.id}

{if !empty($block.customfield.LoadCustomFields.fields)}
<div class="{$class}">
<h3> {g->text text="More Options..."} </h3>
<p class="giDescription">
{foreach from=$block.customfield.LoadCustomFields.fields key=field item=value}
{$field}: {$value|markup}<br/>
{/foreach}
</p>
</div>
{/if}

 
ckdake
ckdake's picture

Joined: 2004-02-18
Posts: 2258
Posted: Mon, 2007-08-20 02:07

Nope, local won't work for module code. I recommend you copy the module to MyModule, edit its files so that it works from there, and keep your changes separate (using MyModule instead of the original one)

____
http://ckdake.com/ - If you found my help useful, please consider donating to Gallery.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2007-08-20 02:52

If it is a template file and not a *.inc or *.class file you can create a local directory and place CustomFields.tpl in there.

So you would copy
gallery2/modules/customfield/templates/blocks/CustomFields.tpl
to
gallery2/modules/customfield/templates/blocks/local/CustomFields.tpl

Or if your going to modify the other file then the best way is ckdake's way, create a custom module.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
girlyReads

Joined: 2007-08-15
Posts: 14
Posted: Mon, 2007-08-20 15:54

Hi guys,

It was a CustomFields.tpl and I've created a local directory which worked like a charm.

Much obliged