htmlblock - Default FrontPage.tpl for anonymous\guest users only?

ntrantham

Joined: 2008-10-14
Posts: 15
Posted: Mon, 2009-08-31 23:37

Get system details; useful for copy/paste into G2 support forum.
Last Run Details:

Gallery URL = http://mygallery.localhub.com/main.php
Gallery version = 2.3 core 1.3.0
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.9 cgi-fcgi
Webserver = Apache/2.2.11 (Unix) FrontPage/5.0.2.2635 mod_vhost_ldap/1.0.0 mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5
Database = mysqli 5.0.74sp1-enterprise-gpl-log, lock.system=flock
Toolkits = ArchiveUpload, Exif, Ffmpeg, Getid3, ImageMagick, LinkItemToolkit, NetPBM, Thumbnail, Gd, Dcraw, SquareThumb
Acceleration = none, none
Operating system = Linux cl21.cust.omnis.com 2.6.18-128.4.1.el5 #1 SMP Tue Aug 4 20:23:34 EDT 2009 i686
Default theme = ebony
gettext = enabled
Locale = en_US
Browser = Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0)
Rows in GalleryAccessMap table = 30
Rows in GalleryAccessSubscriberMap table = 272
Rows in GalleryUser table = 6
Rows in GalleryItem table = 270
Rows in GalleryAlbumItem table = 7
Rows in GalleryCacheMap table = 0

Module: HTML Blocks ver. 0.0.2

I have followed the guide outlined in the wiki for creating a default homepage. It works. What I would like to be able to do though is have this default page only show up for guests\users not logged in.

When a new person comes to the site, I would like the splash page to open, but once they are logged in it would take them to the default album view that shows the theme's normal default album view. I have tried modifying the main.php with this:

/* Serban: if not embedded and empty view, nor a path, nor an item specified
go to htmlblock.RenderFile, with no args, so it will take the default, FrontPage.tpl */
$rewritePath = (isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'path']) ?
$_GET[GALLERY_FORM_VARIABLE_PREFIX . 'path'] : null);
$itemId = (int)(isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'itemId']) ?
$_GET[GALLERY_FORM_VARIABLE_PREFIX . 'itemId'] : null);
$page = (int)(isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'page']) ?
$_GET[GALLERY_FORM_VARIABLE_PREFIX . 'page'] : null);

list ($ret, $isAnonymousUser) = GalleryCoreApi::isAnonymousUser();

if ($ret && $viewName<>'core.UserAdmin' && !$gallery->isEmbedded() && empty($itemId) && empty($rewritePath) && empty($page)) {
$viewName='htmlblock.RenderFile';
GalleryUtilities::putRequestVariable('view', $viewName);
}
/* Serban: end of changes for frontpage */

Instead of what was in the wiki, but it does not work, it displays the htmlblock no matter what. I have tried taking out all of the conditions for the if statement, if making the condition something like if (1=2) but it would still display the htmlblock. It is almost like it is ignoring the if statement conditions and will execute the next line no matter what.

Can someone please point me in the right direction? I am by no means a coder, and have just been working on this for a few hours.

Thanks.

 
ntrantham

Joined: 2008-10-14
Posts: 15
Posted: Tue, 2009-09-01 19:36

Nevermind I figured it out...

For those that are interested...

I copied the album.tpl from the theme folder to local and added this at the top:

{if $user.userName == 'guest'}
<div>
{g->block type="htmlblock.HTMLBlock" file="index.html"}
</div>
{else}

and then at the very bottom added {/if}

This way, if the user is not logged in it will redirect them to the index.html file. Once logged in, everything is normal.

Right now my index.html file is just a "Hello World" but I did copy the album.tpl file to it as well so that the look is the same. My Splash page will now look the same as every other page in my Gallery.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2009-09-03 01:33

please update the docs for this module if they are not clear:
http://codex.gallery2.org/Gallery2:Modules:htmlblock
Docs are for users by users.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
ntrantham

Joined: 2008-10-14
Posts: 15
Posted: Tue, 2009-09-08 17:51

I gave up on the html block module. I could not figure out how to even get img tags to work properly in it. So, I modified my entry in the album.tpl file, instead of referencing the html block I just created the html right there.

I am at work right now and can not ftp into my site to copy\paste the code, but you can see it in action by going to mygallery.localhub.com

Thanks.

 
smilem

Joined: 2009-02-25
Posts: 118
Posted: Sat, 2010-01-23 20:13

I'm looking for the same thing, except I use miniCMS and pointing to html files is pointless.