singapore: the smallest big galery
home » forum » Mods » Random thumbnail & descr outside Singapore

You are not logged in.

  • Index
  •  » Mods
  •  » Random thumbnail & descr outside Singapore

#1 2007-11-14 18:33:21

banan
Member

Random thumbnail & descr outside Singapore

Hello!

Is this possible to show random thumbnail, description and link to gallery - outside Singapore eg.on the same site but on other site section..?

Greetings

Offline

 

#2 2007-11-14 21:09:52

DC
Administrator

Re: Random thumbnail & descr outside Singapore

You would need to write your own code to do so as I do not think a mod for what you ask is avail ...

But I did an auto dropdown that reads and auto links to the galeries from a sep page for a client so im sure it can be done but not by default ...

DC


To code or not to code that is the question?

Did my response help you out? Consider donating by buying me a slice, Whats this? Read More!
http://www.clickcraft.net/slice.php

Offline

 

#3 2007-11-19 20:41:46

banan
Member

Re: Random thumbnail & descr outside Singapore

DC wrote:

But I did an auto dropdown that reads and auto links to the galeries from a sep page for a client

DC, is this possible to show us your code? Or some leads how to do this?

Last edited by banan (2007-11-19 20:42:07)

Offline

 

#4 2007-11-21 05:13:15

DC
Administrator

Re: Random thumbnail & descr outside Singapore

Could try this, now remem I wrote this for a client so use at your own risk it creates a droplist with links to each dir ...
So if your dirs have names like gal1 gal2 these will show up in the list any updates will be shown in the list.

This is made to work with a completely sep page on your site.


//DC Dir List Dropdown 1.00
//Set the page name of your
//homepage examp mypage.php ...

$max_limit = '';
$page_name = "mypage.php";
$directory = "galleries/";

if (!preg_match("/\//", $page_name)){$slash = "/";}
$url_addr = ($_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']));   
echo '<form method="post" action="http://'.$url_addr.''.$slash.''.$page_name.'" class="droplist">';

echo '<div align="center">
<span class="droplist">
<select name="gallery" class="drop" onChange="this.form.submit()">
<option value="0" class="sel">Select Gallery ...</option>'."\n";

if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
    if ($file != "." && $file != "..") {
    if (is_dir($directory.$file)) {
    $files[] = $file;
  }
}
}
sort($files);
closedir($handle);
}
foreach ($files as $countit => $file){
    $c = ($countit+1);
    //Show all files in dir ...
    if ($max_limit == ""){
    $file_count = $c;
    }else{
    $file_count = $max_limit;
    }
    //Show only the set amount!
    if($c < $file_count+1){
    $file_list = str_replace("_","", $file);
    echo "<option value=\"$file\">$file_list</option>\n";
  }
}
?>
</select>
</div>
</span>
</div>
</form>

DC

Last edited by DC (2007-11-21 05:14:32)


To code or not to code that is the question?

Did my response help you out? Consider donating by buying me a slice, Whats this? Read More!
http://www.clickcraft.net/slice.php

Offline

 

#5 2007-11-22 19:22:40

banan
Member

Re: Random thumbnail & descr outside Singapore

Thank You DC very much!

Offline

 

#6 2008-05-16 00:25:18

PrimaFoto
Moderator

Re: Random thumbnail & descr outside Singapore

DC, this is a great piece of code!
Thank you for sharing it.

PP


A Junior Scientist of the SGAL - Lab
http://sgal-lab.primaveraphoto.com

Offline

 

#7 2008-05-16 06:04:59

DC
Administrator

Re: Random thumbnail & descr outside Singapore

Welcome :-)

DC


To code or not to code that is the question?

Did my response help you out? Consider donating by buying me a slice, Whats this? Read More!
http://www.clickcraft.net/slice.php

Offline

 

#8 2009-07-26 09:58:20

Shu
Banned

Re: Random thumbnail & descr outside Singapore

I don't want to post another topic, because my question corresponds this one.

Another idea of a dropdown list.
Of course, a piece of code from DC is great, but it looks not so great in the gallery.
So is there any way to get galleries list from inside the album?

As I understood, code in the gallery.tpl.php shows the galleries list.

Code:

...
<?php for($index = $sg->gallery->startat; $index < $sg->gallery->galleryCountSelected()+$sg->gallery->startat; $index++): ?>
...<?php echo $sg->gallery->galleries[$index]->nameLink(); ?>...
<?php endfor; ?> 
...

But I can't make it work inside the album. I don't pretty understand all that classes, so some help would be great...

Thank you!

Offline

 

#9 2009-07-28 20:16:20

DC
Administrator

Re: Random thumbnail & descr outside Singapore

Im not sure I understand what you are asking?

My code allows you to have the ode called from any page are you saying you dont want it called from a totally sep page?

You say galleries list from inside album ...
I have a special mod we did just for our client protect demo do you mean somthing like this ...
a list on the page.

http://sgal-lab.primaveraphoto.com/view … otect_demo

DC


To code or not to code that is the question?

Did my response help you out? Consider donating by buying me a slice, Whats this? Read More!
http://www.clickcraft.net/slice.php

Offline

 

#10 2009-07-29 12:53:29

Shu
Banned

Re: Random thumbnail & descr outside Singapore

DC,
yes, something like this.
But I would like to include such a list on a page with photos from some gallery. You know, to make such a navigation list, just as you provided several posts earlier, but the one, which will take galerries' names from the CSV of sgal.

Offline

 

#11 2009-07-29 18:20:10

DC
Administrator

Re: Random thumbnail & descr outside Singapore

Not so simple in my opin not without coding somthing from scratch for that purpose, maybe somone has a mod that they can give you but I dont know of one.

Maybe pavian has some ideas and will answer this post.
What I provided reads the dir data not the CSV file directly if thats what you want my code mod will not work for you then.

The list I showed you itself you should be able to do pretty easy
I might be able to post some code to get you going in that direction but otherwise I think you will need to wait to see if pavian has some ideas on that.

DC


To code or not to code that is the question?

Did my response help you out? Consider donating by buying me a slice, Whats this? Read More!
http://www.clickcraft.net/slice.php

Offline

 

#12 2009-08-11 10:01:10

Shu
Banned

Re: Random thumbnail & descr outside Singapore

alright smile

I've just added a rigid piece of PHP code into the template.
It's useful only in case when the number of albums is not intended to changed often.
It is extremely turned to work on my own project, but maybe it will give an idea to anyone.


Code:

<?php $galname=$sg->gallery->name(); echo $galname; ?>
...
<?php
$galarr[0] = array ("title" => "MyTitle", "link" => "works.php?gallery=1-sites");
$galarr[1] = array ("title" => "MyTitle", "link" => "works.php?gallery=2-logos");
$galarr[2] = array ("title" => "MyTitle", "link" => "works.php?gallery=3-prints");
$i=0;
while ($i<3) {
    if ($galarr[$i]["title"] != $galname) {
    echo "<li><a href='".$galarr[$i]["link"]."'>".$galarr[$i]["title"]."</a></li>";
    } else {
    }
    $i++;
}
?>

This piece of code is to be inserted into album.tpl.php or image.tpl.php of your template or elsewhere in the gallery where you want to make a navigation bar.
On any page of your gallery there is usually an album/gallery title which is

Code:

<?php $galname=$sg->gallery->name(); echo $galname; ?>

Usually it is just

Code:

<?php echo $sg->gallery->name(); ?>

but we assign it to a variable $galname for convenience.

Then you have to make a dropdown menu you want (I grabbed a pure CSS one from Listamatic) and there is another PHP code piece:
we make a multi-level array for our galleries' names and relative links to it:

Code:

$galarr[0] = array ("title" => "MyTitle", "link" => "works.php?gallery=1-sites");

IF statement removes the current album name and after the while loop finishes we get several nice <li>'s with hrefs to our galleries.

The shortcoming of such menu is that it lacks dynamics - so if you add another album, you will have to make editions to several template files. It can be a lot of work.

In a time I will show a working example.

Last edited by Shu (2009-08-11 20:55:39)

Offline

 

#13 2009-08-11 16:29:16

DC
Administrator

Re: Random thumbnail & descr outside Singapore

Please explain to or users where they must place the code if they want to try it ... and exactly what the mod does, also I have edited your titles in the post as it was jibberish ...

Thanks for sharing it.

DC


To code or not to code that is the question?

Did my response help you out? Consider donating by buying me a slice, Whats this? Read More!
http://www.clickcraft.net/slice.php

Offline

 

#14 2009-08-11 21:04:40

Shu
Banned

Re: Random thumbnail & descr outside Singapore

I have updated the previous post.

I'm not sure it can be useful to anyone else, but still it's free to use.

Offline

 

#15 2010-01-21 15:48:06

phyllis01
Member

Re: Random thumbnail & descr outside Singapore

DC wrote:

Could try this, now remem I wrote this for a client so use at your own risk it creates a droplist with links to each dir ...
So if your dirs have names like gal1 gal2 these will show up in the list any updates will be shown in the list.

This is made to work with a completely sep page on your site.


//DC Dir List Dropdown 1.00
//Set the page name of your
//homepage examp mypage.php ...

$max_limit = '';
$page_name = "mypage.php";
$directory = "galleries/";

if (!preg_match("/\//", $page_name)){$slash = "/";}
$url_addr = ($_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']));   
echo '<form method="post" action="http://'.$url_addr.''.$slash.''.$page_name.'" class="droplist">';

echo '<div align="center">
<span class="droplist">
<select name="gallery" class="drop" onChange="this.form.submit()">
<option value="0" class="sel">Select Gallery ...</option>'."\n";

if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
    if ($file != "." && $file != "..") {
    if (is_dir($directory.$file)) {
    $files[] = $file;
  }
}
}
sort($files);
closedir($handle);
}
foreach ($files as $countit => $file){
    $c = ($countit+1);
    //Show all files in dir ...
    if ($max_limit == ""){
    $file_count = $c;
    }else{
    $file_count = $max_limit;
    }
    //Show only the set amount!
    if($c < $file_count+1){
    $file_list = str_replace("_","", $file);
    echo "<option value=\"$file\">$file_list</option>\n";
  }
}
?>
</select>
</div>
</span>
</div>
</form>

DC

Can I try some of this? Thanks admin for the post.

Offline

 
  • Index
  •  » Mods
  •  » Random thumbnail & descr outside Singapore