Hi,
I'm using Gallery 2.3 with the Carbon theme.
Is there anyway to show a set of random thumbnails, say 3 from each album, on the main.php page instead of the album thumbnails, which is the default?
If that's not possible, then maybe the first three images in each album. When someone clicks on the thumb, they should get taken to the relevant album page with all thumbs showing for that album.
The three thumbs don't need to be next to each other, I just need to make sure enough images show up to make a good mosaic of small thumbnails on the main.php, which will take people to the appropriate albums.
I'm assuming it's in the theme.tpl...but after having a look I'm completely at a loss of what, where, or how!
I'm new to Gallery, so be gentle!
This is the set up so far...
I need to make sure I can do this before I go any further (hence I haven't added all the albums or pics yet) as my client definitely wants a mosaic wall of small thumbs on the Gallery entrance page, and as she only has 6 albums, the only way around it is to have a set of random thumbs taken from each album.
Cheers,
Tracy
Posts: 22892
try the random highlight module: http://codex.gallery2.org/Gallery2:Modules:randomhighlight
or you can edit the root album and place the imageblock in your customized theme or some other similar plugin from:
http://www.flashyourweb.com/staticpages/index.php?page=mediaBlock or similar.
See this: http://codex.gallery2.org/Gallery2:Themes:How_to_Copy_an_Existing_Theme about customizing/creating your own theme. and placing things on the root album:
http://codex.gallery2.org/Gallery2:How_to_add_custom_stuff_on_main_root_page
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 36
Hi,
I visited the mediaBlock website and downloaded it last night, but I thought it was only for putting things in the sidebar or side columns. I want the random photo pics in the 'main area' of the main.php (if that makes sense). I'll take a look at the plugin more closely.
I also downloaded the imageBlock, but that also appears to be for the sidebar rather than the main area of the theme.
I have to say I was hoping it would be more of an if/else php statement I could just stick somewhere in the theme.tpl or wherever.
I've got a feeling this could take me some time as I familiarise myself with the code. I'm used to working with Wordpress and Xoops, but Gallery2 is all new to me.
Thanks for the links.
Cheers,
Tracy
Posts: 16503
You're going to need to get into editing themes then. main.php is just some code to help gallery run, it has absolutely nothing to do with the page layout, look, feel, etc of Gallery. I see you mention theme.tpl so I see you're already looking at that.
Take a longer look at theme.tpl, it's laid out like your standard HTML page, only it has a lot of Smarty markup code (the template engine used in G2). You could pretty easily take the code for mediablock or imageblock and put then in the part of the page you want there.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 36
Yes, nivekiam, I think it's the Smarty code that's befuddling me...
It sounds as though mediaBlock is in front at the moment for what I need, so I will delve into that this evening.
I'll be back... no doubt in a panic when I do something drastically wrong ;)
Cheers,
Tracy
Posts: 16503
Just make backups and ask when you have questions. Read this too
http://codex.gallery2.org/Gallery2:Editing_Templates
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 36
Hi,
Okay...I'm stuck!
I have no idea where to put the code in the album.tpl for mediaBlock to replace the list of album thumbs on the root album, ie I want it to show the 40 micro-thumbs instead of the 6 album thumbs when people first enter the gallery2 site.
I've edited the mediablock.php and uploaded to gallery2/ directory.
I've edited the theme.inc file with the $isitroot stuff.
I've tried the following in album.tpl
...and everything seems to be there, but no thumbs are showing.
Looking at the source code in the browser, it's showing the gsContentAlbum div but with nothing in it.
I also wonder if mediaBlock is going to do what I originally wanted. ie, to take a few random photos from each album.
Looking at the parameters for mediaBlock, it only seems to have the choice of using g2_itemID being that of a single item or an album. I've set this to 7, as that appears to be my rootalbum id. Is this correct?
Help appreciated.
Cheers,
Tracy
EDIT: It's also using the media block on all album pages, but I only want it on the root album (ie the gallery2 entry page). I'm assuming this is because I've deleted something I shouldn't have done on the album.tpl.
Posts: 16503
Try adding {php}
http://www.smarty.net/manual/en/language.function.php.php
Not sure if this is going to work exactly like this, but try:
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 36
No, that didn't work. It got rid of everything under the header, ie no album title, description, sidebar, etc.
I've just tried putting some plain text with the {if $isItRoot} {/if} and that didn't show either, although everything else is there again.
Which points to that being the problem. Any ideas? Could it be where I've placed it? Do I need to delete anything else off the album.tpl or something? Or maybe I've added it to the wrong place on the theme.inc file (I've pasted the code above).
Cheers,
Tracy
Posts: 16503
Instead of your "isItRoot" stuff, try something like this:
{if $theme.item.parentId == 0}
I'm pretty sure that will work as only the root album will have a parent that has an id of 0.
___________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 22892
Freelancealot,
see if you can back out all your changes.
then edit album.tpl like this:
http://gallery.menalto.com/node/70763#comment-255788
see if you can get text to work first.
If you get that then we can go to the next step.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 36
Hi Floridave,
I've reverted back to the default carbon album.tpl already. I'll just do the theme.inc file in a second.
But where do I put the
in the template file???
I'm taking it that I don't need to delete anything from the album.tpl file just add the above somewhere...
Thanks for the help. Really appreciated.
Cheers,
Tracy
Posts: 22892
Yes edit album.tpl
place it close to where you want the images to show up.
I would suggest:
</div> {else} here {assign var="childrenInColumnCount" value=0}Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 36
Okay...now we're getting somewhere
The text appeared on root album and not in other albums. However, the album thumbs are still showing on the root album page. So now I need to get the mediaBlock stuff in there to replace the usual album thumbs:
So I've now got:
But nothing is showing but the usual album thumbs.
When you look at the source code you can see that it's actually showing the <?php @readfile....?> line.
I've tried nivekiam smart {/php} thing, but again everything just disappeared below the horizontal menu.
Any ideas? I feel like I must be very close...!!
Cheers,
Tracy
Edit: Just in case, the permissions on mediablock.php are 744. Do I need to change that?
Posts: 22892
Does this work take:
<?php @readfile('http://www.mysite.com/gallery2/mediaBlock.php?g2_itemId=33&mode=dynamic&g2_view=dynamicalbum.RandomAlbum&limit=40&useThumb=1&column=4&useMicro=40');?>and change to
{php} @readfile('http://www.mysite.com/gallery2/mediaBlock.php?g2_itemId=33&mode=dynamic&g2_view=dynamicalbum.RandomAlbum&limit=40&useThumb=1&column=4&useMicro=40');{/php}Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 22892
Also verify that
http://www.mysite.com/gallery2/mediaBlock.php?g2_itemId=33&mode=dynamic&g2_view=dynamicalbum.RandomAlbum&limit=40&useThumb=1&column=4&useMicro=40
does work
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 36
It's doing something, but I'm not sure what.
It's now showing the word 'array' above the usual album thumbnails, but no mediaBlock stuff.
It's not showing the <php line when you view the source code in the browser any more BTW.
Cheers,
Tracy
Posts: 36
Good tip...
I went to http://www.mysite.com/gallery2/mediaBlock.php?g2_itemId=33&mode=dynamic&g2_view=dynamicalbum.RandomAlbum&limit=40&useThumb=1&column=4&useMicro=40 and it's just got a blank page with the word 'array' on it. (I am replacing 'www.mysite.com' with the proper site, just in case you were wondering... ;)
Aha, does that mean it's a problem with the actual mediaBlock.php or with the url and parameters?
I didn't change anything on the mediaBlock.php file because
all seemed to be okay for my set up.
Gee I'm glad you're there, but where are you at this time...it's 5:50am here in the UK and I've been up all night trying to get this to work...so I'm very grateful for your help.
T.
Edit: By that I mean, it must be getting late where you are floridave. I'm going to see if I can get any answers from the mediaBlock site. But if you think of anything, please let me know.
Posts: 22892
I guess you need to sort that out first.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 16503
Do you have the Dynamic Albums plugin installed? I'm not sure, but it looks like that needs to be installed to use the dynamic stuff for mediaBlock.
Yep, looking at the mediaBlock code, it needs that plugin installed to do the random and dynamic stuff.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 36
Doh! I'm installing it now.... how embarrassing is that...
I'll let you know if that does it. Back in a mo.
Cheers,
T.
Posts: 22892
Also
......mediaBlock.php?g2_itemId=33&mode=dynamic.....do you have a album with a ID of 33?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 36
ooohhhh....it works.... I feel really stupid now. However, I had no idea where to put the code on the album.tpl so you've all been a big help.
One last thing though... it's still showing the main album thumbs - how do I get rid of these on the root album page only?
Cheers,
T.
Posts: 36
I changed that as well to the root album id, which was 7.
Posts: 36
Just checking....
When you click one of the mediablock thumbs the url is http://www.mysite.com/gallery2/main.php?g2_itemId=54&g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT is there anyway to clean this up. I have the url rewrite mod loaded.
Cheers,
Tracy
Posts: 36
Hi,
I'm almost there...just need to get rid of the album thumbs on the root album page (gallery2 entry page)
Below in bold is the bit I've added to the album.tpl, but this isn't get rid of the default album thumb display.
I've tried moving the last {/if} to various places, but have only succeeded in removing the image thumbs from the individual album pages!!! Which was the opposite of what I needed...
Suggestions gratefully received.
Cheers,
Tracy
Posts: 22892
Tracy,
We have not abandoned you and you did not need to start a new thread. You said you did not know this stuff well so we are going in baby steps and are not going to design this custom theme for you but hold your hand in the process so you can learn.
We also have to sleep as well as go to work. I will continue to assist you when I get time; after my real job.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 36
Hi Floridave,
Sorry, I'm never sure about Forum etiquette so started a new one as it seemed a more general Gallery2 question. Should I delete the other topic? Don't want to irritate you helpful peeps out there.
I'll be working on the site again this evening...I anticipate another sleepless night as I rush to get it finished.
And...yes I really do need my hand held on this. I can cope with hacking Wordpress and Xoops, but this has got me all discombobulated!
Cheers,
Tracy
Posts: 36
Success!
For anyone else out there looking for the solution, you need to edit your album.tpl as follows. The additions are in bold. The 'theme.item.id is the id of your root album:
Posts: 22892
Glad you got it sorted.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 36
Thanks.
See you over at the other thread!
Cheers,
Tracy