Theme PageType

anandamd

Joined: 2008-06-26
Posts: 11
Posted: Fri, 2008-07-04 14:05

Hi,
I am wanting to add a custom template to the classic theme, i have figured out that it uses the following code in the theme.tpl to show the relevant template.

{if $theme.pageType == 'album'}
{g->theme include="album.tpl"}
{elseif $theme.pageType == 'photo'}
{g->theme include="photo.tpl"}
{elseif $theme.pageType == 'admin'}
{g->theme include="admin.tpl"}
{elseif $theme.pageType == 'module'}
{g->theme include="module.tpl"}
{/if}

also in the GalleryTheme.class it uses the following code fragment to decide which view is being requested.

switch ($view->getViewType()) {
case VIEW_TYPE_ADMIN:
$theme['pageType'] = 'admin';

I have also figured out that VIEW_TYPE_ADMIN and the rest is getting defined in GalleryConstants.class

So if i want to do something like VIEW_TYPE_FOO and set it in the GalleryTheme.class, and then add the code given below to the theme.tpl to say

{elseif $theme.pageType == 'foo'}
{g->theme include="foo.tpl"}

how exactly do i go about doing this, where exactly in the code do I set VIEW_TYPE_FOO.
All help is appreciated.

Thanks
@nand

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 11234
Posted: Fri, 2008-07-04 15:51

Perhaps a better explanation of what you want to do is in order.
Depending on what you want to archive it might be better to develop a module or a simple if statement in a template file to load the content. Far easier than editing core files where I will not be able to help out.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team.

Login or register to post comments
anandamd

Joined: 2008-06-26
Posts: 11
Posted: Fri, 2008-07-04 19:21

Hi Dave,
indeed i want to put a simple if statement in the theme.tpl to redirect to the custom.tpl that i have created. As mentioned earlier this done in the theme.tpl on the basis of $theme.pageType[i] , at the moment i am clueless about where $theme.pageType is getting populated in the code. Writing a new module to achieve this a very big penalty.

All you time and efforts are highly appreciated.

Thanks
@nand

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 11234
Posted: Fri, 2008-07-04 19:56

How is your custom pageType set then?
Is it a album setting, theme setting, title setting, url parameter.
Please give a user story.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments
anandamd

Joined: 2008-06-26
Posts: 11
Posted: Mon, 2008-07-07 06:41

Hi Dave,
my problem is same as in this one
http://gallery.menalto.com/node/42609
I am not trying to convert it to CMS though, I want it to be Gallery, all i want is that the theme.tpl redirect it to my new.tpl

Your time and efforts are always appreciated.

Best Regards
@nand

Login or register to post comments
samxsam

Joined: 2008-07-24
Posts: 4
Posted: Wed, 2008-07-30 06:27

Ya, Im facing the some problems too... if I add a new define in GalleryConstants.class. (ex. define('VIEW_TYPE_NEW', 6);) and adding a new case in GalleryTheme.class:
switch ($view->getViewType()) {
case VIEW_TYPE_NEW:
$theme['pageType'] = 'New';
...

and it will affect my frame setting. Could somebody help us for this?

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 11234
Posted: Sun, 2008-08-03 04:28
Quote:
my problem is same as in this one

So much for a good user story......
If you want to just pass in a url parameter do something like:

  {if ($smarty.get.my_perameter == "ON")}
ON
{else}
Off
{/if}

and the urls would be like:
gallery2/main.php?my_perameter=ON

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments