Page 1 of 1

Photoblog, how to implement certain features?

Posted: Thu Aug 25, 2005 1:40 pm
by dmgerman
Hi there,

I am new to Serendipity. I just moved my photoblog from WordPress to Serendipity and I am fairly happy with the results. I have been spending a good amount of time configuring templates and modifying the photoblog plugins (event and plugin, which are very simple in functionality).

the current result is here: http://turingmachine.org

I have some questions regarding its configuration (I am able to write PHP if needed).

* I want to show in the main page (index.php) only one posting, the most recent, but in any othe r page (search results, category listings, etc) to show a larger number of entries, for example 10. Can anybody point me in the right direction?

* In any page that lists more than one entry I would like to show an thumbnail of the photograph, instead of the entire photo. And then if the user clicks in the photo, then the page for that entry is displayed. What would be a good place to start to implement/configure this feature?

Re: Photoblog, how to implement certain features?

Posted: Thu Aug 25, 2005 7:21 pm
by garvinhicking
Hm, I can't see a photoblog on that site?

Anyways, did you also have a look at the "imageselectorplus" plugin? ("Extended options for media manager") - That one requires Serendipity 0.9, but then allows to create a "quickblog" entry when you upload an image. I am personally not using a photoblog or the photoblog plugins, though. Maybe they're alread good suited for your use.
* I want to show in the main page (index.php) only one posting, the most recent, but in any othe r page (search results, category listings, etc) to show a larger number of entries, for example 10. Can anybody point me in the right direction?
That's actually easy to do if you use Serendipity 0.9 and the plugin "Properties/Templates of Categories". You can then set the global "Entries to display" amount from 15 to 1. Then use the category plugin to edit each category and then there set the "entries to display" to 10, or so.

That would be the "GUI-version". If you want to hack it in yourself, it's also not that hard:

1. Open your include/genpage.inc.php file
2. Locate this code:

Code: Select all

// For advanced usage, we allow template authors to create a file 'config.inc.php' where they can
// setup custom smarty variables, modifiers etc. to use in their templates.
@include_once $serendipity['smarty']->template_dir . '/config.inc.php';
Before that code you add this:

Code: Select all

if (!empty($serendipity['GET']['category'])) {
  $serendipity['fetchLimit'] = 10;
} else {
  $serendipity['fetchLimit'] = 1;
}
This will effectively change the fetchLimit.
* In any page that lists more than one entry I would like to show an thumbnail of the photograph, instead of the entire photo. And then if the user clicks in the photo, then the page for that entry is displayed. What would be a good place to start to implement/configure this feature?
Hhhm. This is a bit harder to achieve. How are you placing the thumbnails of the photo? Via one of the photoblog plugins? Does the HTML for the photo get added to the entry body, or is it stored seperately? As I'm not using the plugin, I don't know this on my own...

I'd suggest to put the thumbnail version in the usual body, and put the large image into the "extended" part of an entry.

Then in your entries.tpl Smarty Template you could check if the $serendipity['fetchLimit'] is set to 1 or 10, and depending on that either display only the extended part of the entry, or only the body part of the entry.

To actually make a Smarty check on the fetchLimit variable you need to assign the variable to your template. The easiest way is to create a "config.inc.php" file in your template directory with this content:

Code: Select all

<?php
$serendipity['smarty']->assign('fetchLimit', $serendipity['fetchLimit']);
?>
Now you can use this HTML in your entries.tpl:

Code: Select all

{if $fetchLimit == 1}
Single: {$entry.body}
{else}
Full: {$entry.extended}
{/if}
HTH,
garvin

Re: Photoblog, how to implement certain features?

Posted: Thu Aug 25, 2005 10:06 pm
by Guest
garvinhicking wrote:Hm, I can't see a photoblog on that site
Oh, sorry, it is http://silvernegative.com

Re: Photoblog, how to implement certain features?

Posted: Fri Aug 26, 2005 3:06 pm
by garvinhicking
Wow. Awesome fotos!

Regards,
Garvin