Jump to content


[Snippet] etogal_multigals.3.1


  • You cannot reply to this topic
27 replies to this topic

#1 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 08 April 2007 - 11:38 AM

File Name: etogal_multigals.3.1
File Submitter: Cris D.
File Submitted: 8 Apr 2007
File Updated: 18 Jun 2007
File Category: Images & Galleries

This snippet is to call pictures from a range of etogal galleries into a single page. The default installation will call all pictures from the etomite gallery table and limit the return to the first 20 sorted by pict. id. More advanced users can also sort by table field (title, gal_id, id etc), add where clauses, change number of results returned and set the maximum number to be displayed on a page at a time.


1)This snippet assumes that EtoGal has already been installed and the table is populated.
2)Copy this text and add to snippet library in etomite.
3)Copy "etogal_tpl" and add to chunk library.
4)Create a page, save it and publish it, call this snippet by typing [!etogal_multigals3.1!] into the page & save.


It can be customised to suit your own template to format the output or use the included template as default (edit the etogal_tpl to change the table structure of the pics). For more control, add class .even{}; class .odd{}; to your css and define them or use in-line styling.

This is an easy way to change the visual representation of etogal (not the etogal manager) as the html that controls the way etogal is rendered is in a separate file from the code (template attached in the top of the snippet).

Note the latest version is now 3.1


See the new features in action...here.

Updated 18/6/07 **Another new feature** Added hyperlinked numbers as part of the Prev Next navigation. Also changed the ceil() to floor() to round down (Page 1 of "n") resulting in a more accurate number.

Updated 31/5/07 ***NEW FEATURE*** Now with Previous | Page x of y | Next navigation. YOU set how many pictures to show per page from the snippet call.


31/5/07 Version 3 Prev| page x of y |Next navigation added and the ability to set the number of results from a result set to show on a page.

3/5/07 Version 2.1 with all parameters that can be added to the snippet call instead of inside the snippet. Upgrading to this version will not affect previous version, the defaults are still the same.

Snippet parameters that can be called are:
include= any table field, where_clause= MANY SQL "where" queries, sort_by= any table field retrieved, return_limit= number or records to show, sort_direction= DESCending (default ASCending), template= any saved chunk. See in snippet for examples of use and syntax to use.
This can be called in the same page as etogal and etogal_multigals and multiple etogal_multigals snippets on a page.

8/5/07 V2.2added stripslashes to output so " " will look like " " instead of \" \".
22/5/07 default etogal_tpl now includes a link to the original etogal picture (zoomed in) in the gallery where it originated, and in a new window. (simple html <a href><img src> addition ad ZOOM in.. (opens in new window) addition).

Click here to download this file

Attached Files


Edited by Cris D., 18 June 2007 - 12:48 PM.


#2 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 08 April 2007 - 05:26 PM

Cris, Remember to update the File in the download manager too - it keeps track of old versions too.. I noticed it's still on Version 1.1

#3 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 08 April 2007 - 10:52 PM

View PostDean, on Apr 9 2007, 03:26 AM, said:

Cris, Remember to update the File in the download manager too -

I tried to delete everything that was not 1.2 (unfortunately 1.2 is still called 1.1 at the top of the snippet when it is opened). No big deal, just some extra comments. I guess that I have learnt to test, test, test before posting a snippet! I was just so keen, my first baby... : )

#4 luislacerda

    Etomite Forum Fan

  • Member
  • Pip
  • 87 posts

Posted 09 April 2007 - 07:43 PM

Tkx Chris D. I was looking for something like this.
I have a pretty standard Etomite installation but I could only make your snippet to work after I changed the name of the etogal table to read as follows


//Table where etogal is, usually default is "etomite_etogal".

// Although my table is named etomite_etogal I needed to change this as shown below
$etogal_table="etogal";



#5 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 11 April 2007 - 11:09 AM

Thanks Luis,

Ralph has noted HERE that the getIntTableRows() has an additional function where "$addPrefix=FALSE" which can be included at the end on the API to make sure that the "etomite_" is turned off (or on if TRUE).

I'll update the snippet for future (done ver 1.3).

Edited by Cris D., 24 April 2007 - 01:10 PM.


#6 luislacerda

    Etomite Forum Fan

  • Member
  • Pip
  • 87 posts

Posted 11 April 2007 - 07:14 PM

View PostCris D., on Apr 11 2007, 12:09 PM, said:

I'm working on the next generation that includes the ability to enter data into an appended table here.
Keep on with the good work Cris!
I'll be following it closely as the additional data is something I would like to have.
Take care

#7 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 20 April 2007 - 03:40 AM

Well, so far 21 download later and no requests for support. Either the snippet is broken beyond repair and no-one has bothered to try to use it, or it installs so well and is so easy to use that no support is needed. Hmmm. Hopefully the latter :)

#8 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 20 April 2007 - 10:06 AM

Thats normal. Don't expect any response at all from the majority of downloaders.

#9 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 22 April 2007 - 12:11 PM

The new etogal_multigals 2.1 allows all the configurable snippet parameters to be called from the snippet call instead of creating new snippets. One parameter includes template=, this allows you to set the template to parse for that instance of etogal_multigals. This gives a great flexibiltiy of how your images and info is rendered.

If you want to go crazy, you can even have a snippet call of
etogal_multigals?where=id=1&template=template1 for each of 100 picture on a single page!

Don't forget that the templates are saved as a "new chunk" and use simple html. You can also create your own templates that call the info as required instead of "inside" a existing etomite template.

Edited by Cris D., 03 May 2007 - 01:48 AM.


#10 luislacerda

    Etomite Forum Fan

  • Member
  • Pip
  • 87 posts

Posted 22 April 2007 - 08:42 PM

View PostCris D., on Apr 20 2007, 04:40 AM, said:

Well, so far 21 download later and no requests for support. Either the snippet is broken beyond repair and no-one has bothered to try to use it, or it installs so well and is so easy to use that no support is needed. Hmmm. Hopefully the latter :)
Cris
It worked flawlessly for me. Thank you very much for sharing your most useful work
Luis

Edited by luislacerda, 24 April 2007 - 08:33 PM.


#11 Oppdragnemo

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 13 May 2007 - 02:51 PM

Very nice snippet!

I belive the snippet call example should be:
[!etogal_multigals?where=id=1,3,4,7,9&include=id,title,gal_id&return_limit=10&sort_by=title&sort_direction=DESC!]
Instead of:
[!etogal_multigals?where=id=1,3,4,7,9&include=id,title,gal_id&limit=10&sort_by=title&sort_direction=DESC!]

Is it possible to get information of page title in this snippet?

Oppdragnemo

#12 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 14 May 2007 - 01:57 AM

Thanks Oppdragnemo.

I'm still pretty new at this but at the moment the snippet is calling info from one database table only, to include pageinfo, you would need to add another data call to
$page=$etomite->getPageInfo($id=$pagerequired, $active=1, $fields='id, pagetitle, description, alias');
and call the $page['pagetitle'] and either merge it with the $rs to parse with mergecodevars or call it separately and add the data field to template. Can you do this? or do you need help?

Also, I'm not sure what you need the page title for, but if you use the etogal_search snippet, this can return the page title of images found if that's a help.

Edited by Cris D., 14 May 2007 - 02:00 AM.


#13 Oppdragnemo

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 14 May 2007 - 07:29 PM

Hi Cris

I am attempting to show first image, with page title, from all my galleries on one page (just like a gallery index).
I guess it would be something like EtogalThumb?

Maybee I'm far out? :blink:

I'm having no PHP knowledge at all.

Edited by Oppdragnemo, 14 May 2007 - 07:31 PM.


#14 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 14 May 2007 - 08:17 PM

I don't think doing this with either etogal_multigals or etogalThumb will be easy without any knowledge of PHP. Neither is configured to do exactly what you want, but etogalThumb does handle getting the page title (and description) for you.

There's an example of using etogalThumb to create an index of galleries (one call for each gallery, though) at Etogal test site - EtoGalThumb page

Something similar is done on the Rogue Gene Collective Portfolio page, though in this case the EtogalThumb call is embedded in another snippet which handles some extra information, and orders the galleries. I can extract the the etgoThumb style and snippet call for this if its near enough to what you want.

#15 Oppdragnemo

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 15 May 2007 - 07:20 AM

Rogue Gene Collective page artists design, is what I'm looking for.
I believe this is near enough.
Very clean and nice design.

:rolleyes:

#16 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 16 May 2007 - 12:06 PM

This is going to take longer than I thought ... although the original version used EtoGalThumb, I forgot that when I switched from just a gallery per artist to biography, gallery and news pages I had to rewrite the portfolio page to pick up stuff from the relevant page (now no longer all on the gallery page). At the same time, I substantially changed ho each gallery was presented, so the old style doesn't match the current presentation.

I'm pretty sure it can still be done with EtoGalThumb, if the gallery page holds all the data needed. but will have to find time to set up a test gallery and write and test the style. sorry!

#17 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 16 May 2007 - 01:00 PM

First try worked so try this for the style (add in to the block of styles near the haed of the EtoGalThumb snippet)
// style=link
// test to emulate the rgc portfolio link styling
$styleStrings['link']['header']="<div class='gallery_link'>";
$styleStrings['link']['image']=<<<IMG
<div style='float:left; width:150px;'>
<a href='[~%%gal%%~]'  title='%%title%%' style='display:block; padding: 1em 0 1em 1em; text-align:center;'>
<img src='%%file%%' class='gallery_link' title='%%title%%' alt='%%sdesc%%' %%size%% />
</a>
</div>
IMG;
$styleStrings['link']['tail']=<<<LNK
<h2>%%ptitle%%</h2>%%pdesc%%<br />
<div style='clear:left'> </div>
</div>
LNK;
and use this for the snippet call
[[EtoGalThumb?gal=136&link=136&style=link]]
Changing both '136' to the gallery number you want

This takes the gallery page's long title and puts it the header line, and the page's description below. As it stands, only the image (which is picked at random from that gallery's images) gives a link to the gallery. (Since I don't know what snippet you are using to display the gallery, it just goes to the gallery page, and doesn't attempt to select a particular image.)

Hope it helps.

If you need to discuss it further, please post in the etogal section, rather than continuing here in CrisD's thread!

#18 luislacerda

    Etomite Forum Fan

  • Member
  • Pip
  • 87 posts

Posted 18 May 2007 - 07:00 PM

Thanks Cris for this very nice and useful snippet.
I would want to be able to generate a new page and the corresponding navigation links on each generated page once the images would get to a predefined number of images per page.
I tried to adapt the DisplayContent snippet but -shame on me - I arrived nowhere. :blush:
Can somebody point me in the right direction on this?
Ideally one would define the number of images per page in the snippet call.
Thanks

#19 Oppdragnemo

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 18 May 2007 - 09:06 PM

Hello, mikef

Work like a charm on my website.
Now I'm really happy :-)

Thank you and keep up the good work!

#20 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 19 May 2007 - 03:45 AM

View Postluislacerda, on May 19 2007, 05:00 AM, said:

Ideally one would define the number of images per page in the snippet call.
Thanks
The ability to add snippet parameters from the snippet call was added in ver. 2.1 addslashes $ stripslashes added in ver2.2.

There was a minor typo in the example, ?limit=20 should read ?return_limit=20. If you use this snippet, you can define the max images per page, galleries to show, individual pics etc (in fact I made EVERY parameter passable from the snippet call) across multiple pages using the one snippet.

Latest Multigal download

As for the"<<<PREVIOUS || NEXT>>" you will have to manually do this at the moment (I would like to do something automatic in the future, but my hands are a bit full right now).

Set the maximum images or choose images to show for the page in the snippet call [ !etogal_multigals?where_clause=id=1,2,3,4,5,6,7,8,9,10! ]

then hard code the NEXT>>> as a hyperlink

<a href="www.mysite.com/index.php?id=nn>NEXT>>></a>

to the next page where you can call the next group
eg. [ !etogal_multigals?where_clause=id=11,12,13,14,15,16,17,18,19,20! ]


Have fun :)

Edited by Cris D., 19 May 2007 - 04:05 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users