How Gallery works

d.k.

Joined: 2006-03-29
Posts: 1
Posted: Wed, 2006-03-29 15:02

Hello,

I'm trying to understand the source code of Gallery and the way how Gallery works.
So, I have two questions about things I don't understand.
In which file / class / method are files 'module.inc' included into Gallery? Take it place every time Gallery is invoked or are they somewhere cached?
The other question is how some module templates are included into templates of other modules? For example, how template for captcha is inserted into template register, or the link 'register' (top-right corner of the page in default installation) is inserted next to 'login' link?

thanks in advance

 
draco2002

Joined: 2003-04-28
Posts: 70
Posted: Wed, 2006-03-29 22:36

FYI, here is the Code that puts "Register" in the system links from /modules/register/module.inc:

    /**
     * @see GalleryModule::getSystemLinks
     */
    function getSystemLinks() {
	global $gallery;
	$links = array();

	list ($ret, $anonymousUserId) =
	    GalleryCoreApi::getPluginParameter('module', 'core', 'id.anonymousUser');
	if ($ret) {
	    return array($ret->wrap(__FILE__, __LINE__), null);
	}

	/* Only anonymous users will see the register link */
	if ($gallery->getActiveUserId() == $anonymousUserId) {
	    $links['Register'] = array(
		'text' => $this->translate('Register'),
		'params' => array('view' => 'core.UserAdmin',
				  'subView' => 'register.UserSelfRegistration',
				  'return' => 1));
	}

	return array(null, $links);
    }

|| Custom Theming | Donate to Gallery ||

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2006-04-02 04:14

the answer to most of your questions is: APIs
see modules/core/classes/GalleryModule.class.. this is the module API and shows you how modules get many things added to gallery. captcha is its own api, called "GalleryValidationPlugin". module.inc files are loaded from the GalleryCoreApi::loadPlugin api.