How do I add something only to the main page?

judyn

Joined: 2007-10-25
Posts: 17
Posted: Fri, 2007-10-26 19:44

I have added a flickr slideshow to my gallery page by modifying album.tpl. However, I would like it to show only on the main page and not on each gallery page. I did a search and didn't come up with anything. There must be some if statement that I can put around it to implement this?

Thanks so much!
Judy

Gallery version: 2.2.2
PHP version:
PHPInfo Link:
Webserver: 1.3.37 (Unix)
Database: MySQL version 5.0.27
Activated toolkits: ImageMagick, NetPbm, GD
Operating system (e.g. Linux): Linux
Browser (e.g. Firefox 2.0): Firefox 2.0.0.8
Theme: carbon
http://www.nichollsfamily.us/gallery/

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2007-10-26 19:54
{if empty($theme.parents)}
stuff on root album only
{/if}

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
judyn

Joined: 2007-10-25
Posts: 17
Posted: Fri, 2007-10-26 20:17

Thanks so much, floridave!

Just after I posted I found a solution in another thread, but yours is better because it's specific to the root album.

Others reading this thread might find the other solution useful though because it can target a particular page:

{if $theme.item.id == 7}
whatever I want here
{/if}

I had some trouble finding the theme ID. I finally found it by looking at the debug tree. Surely there is another way?

Judy

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2007-10-26 20:33
Quote:
I finally found it by looking at the debug tree. Surely there is another way?

The smarty debug popup, when you have debug turned on will give you a bunch more info.
turning off the rewrite module will give you the itemId as well:
Example.com/gallery2/main.php?g2_itemId=31

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
cimbus

Joined: 2007-07-02
Posts: 11
Posted: Wed, 2007-10-31 11:41

Till now I was using this:

{php}
$queryString = $_SERVER['QUERY_STRING'];
if ($queryString == '') {
echo '
<div id="">ONLY MAIN PAGE EXTRA CONTENT</div>
';}
{/php}

But floridave´s is really SMARTY.

 
cimbus

Joined: 2007-07-02
Posts: 11
Posted: Fri, 2007-11-02 22:23

If the {if empty($theme.parents)}stuff on root album only{/if} method is used the extra stuff is visible in the whole admin section, as my extra stuff is absolute positioned this is not good. Is there a smarty method how to do it? Untill solved I changed it back to my {php} QUERY_STRING method.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2007-11-03 00:01
Quote:
Is there a smarty method how to do it?
Quote:
A smarty method to see if you have positioned elements? I don't understand.

 
cimbus

Joined: 2007-07-02
Posts: 11
Posted: Sat, 2007-11-03 19:01

The original Question: How do I add something only to the main page?
You suggested the code {if empty($theme.parents)}stuff on root album only{/if}.
But I got the problem that using this code the stuff on root album only (in my case a positioned element) is also visible in the entire admin section which is not wanted as the stuff could be placed just to the main page i.e. the very first page (main.php without any string).

The PHP script I posted is fine for me, just was looking for a smarty equivalent. Or does the switching between PHP and smarty (if I put a small PHP in my template) slow the performance down?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2007-11-03 22:24

{if $theme.pageType == 'admin'}on admin page only{/if} will show on the admin page.
so I guess you would want:

{if empty($theme.parents)}
{if $theme.pageType != 'admin'}
stuff on root album only and not a admin page
{/if}
{/if}

I hope I am understanding :-)

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
cimbus

Joined: 2007-07-02
Posts: 11
Posted: Sun, 2007-11-04 19:54

Thanks Dave, exactly what I needed.

 
charmedworks

Joined: 2007-07-03
Posts: 3
Posted: Thu, 2007-12-20 18:40

Just a note to give props to this helpful post.
Thanks floridave! This is exactly what I needed to complete a client request: works great on the highly modified Carbon theme we're using.

 
fotonut

Joined: 2009-02-21
Posts: 74
Posted: Tue, 2009-02-24 05:21

I am trying to modify the area in the lower left mid section of the main gallery page of the Carbon theme. I want to change the "This is the main page of your Gallery" to contain a small paragraph of text and an image that gives a hyperlink to another website. I can't find any of these suggested variable strings in any of the 2.3 code. All I can find is this exact string of text in the file CoreModuleExtras.inc but changing the text string in this file does not make it change on the prime page of the gallery.

File: Gallery2\modules\core\CoreModuleExtras.inc
$description = $module->translate('This is the main page of your Gallery');

changing above string doesn't change main gallery page.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2009-02-24 14:39
Quote:
I want to change the "This is the main page of your Gallery" to contain a small paragraph of text

no need to edit code just change the description of the root album:
http://codex.gallery2.org/Gallery2:Quick_Start_Guide#Configure_the_Root_Album

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
fotonut

Joined: 2009-02-21
Posts: 74
Posted: Tue, 2009-02-24 15:20

The concept that the initial page was an "album" somehow escaped me when I read right past that page. It is also nice to know that the full set of BBCode works on this page, as illustrated here:
http://www.phpbb.com/community/faq.php?mode=bbcode

I was even able to create a clickable link as in this example:

[noparse]
[img]http://www.google.com/intl/en_ALL/images/logo.gif[/img]
[/noparse]

 
labrat779

Joined: 2010-06-01
Posts: 4
Posted: Wed, 2010-06-02 00:40

I know very little about web design - just some very basic html, etc. Can someone explain how to add a bio and other info on the side of the page, as in this example?
http://www.lucnix.be/main.php