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! Gallery version: 2.2.2 |
|
Posts: 27300
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 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
Posts: 27300
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
Posts: 11
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.
Posts: 11
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.
Posts: 27300
Posts: 11
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?
Posts: 27300
{if $theme.pageType == 'admin'}on admin page only{/if}
will show on the admin page.so I guess you would want:
I hope I am understanding
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 11
Thanks Dave, exactly what I needed.
Posts: 3
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.
Posts: 74
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.
Posts: 27300
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
Posts: 74
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]
Posts: 4
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