Member
Member
gschultz   2011-04-16, 03:44
#1
I know there are ways to integrate Zenphoto with Wordpress but are there ways to do the opposite? I'm looking for a way to show the first ten albums in the sidebar of my blog, either with a plug or coding that the loads the database and displays the albums with php shortcodes.

Thanks,
Greg
Administrator
Administrator
acrylian   2011-04-16, 08:37
#2
There are tools for similar things this on the extensions section. Since they are 3rd party I can't tell you if they still work.
Member
Member
gschultz   2011-04-19, 04:24
#3
The plugins didn't work but I was able to find a solution to my problem with this:

<?php
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'gallery');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
header ('Content-Type: text/html; charset=' . getOption('charset'));
?>
<div id="photocontent" class="photopost">
<div id="zenphoto">

<div id="albums">
<?php while (next_album()): ?>
<div class="album">
<a>" title="View album: <?php echo getAlbumTitle();?>">
<?php printAlbumThumbImage(getAlbumTitle()); ?>
</a>
<div class="albumdesc">
<h3><a>" title="View album: <?php echo getAlbumTitle();?>"><?php printAlbumTitle(); ?></a></h3>
<p><?php printAlbumDesc(); ?></p>
</div>
</div>
<?php endwhile; ?>
</div>
<?php printPageListWithNav('<', '>'); ?>

</div>
</div>

Only problem is that it displays all the albums. How do I fix it to display the first ten?

Thanks,
Greg
Member
Member
gschultz   2011-04-19, 04:40
#4
I found a solution and now I have another problem. The code I'm using displays all the albums. Is there a way to show a certain number of albums instead of all?

Thanks,
Greg
Administrator
Administrator
acrylian   2011-04-19, 08:15
#5
Stop the loop after the number you wish. Sorry this is basic php...
Member
Member
gschultz   2011-04-19, 19:16
#6
How do I stop the loop?
Member
Member
sbillard   2011-04-19, 19:34
#7
This is pretty much basic programming, not even basic PHP. If you do not know at least this much, then you really need to do some learning.

Besides, since you did not show the solution you found there is no way anyone here can provide you with an answer. These things really depend on what has gone on before.
Member
Member
gschultz   2011-04-19, 21:05
#8
OK, I'll try again. I'm trying to make a page outside of Zenphoto that shows the last ten albums and then use php include to add that page to my WordPress sidebar.

I've tried using plugins and many didn't work.

Here's what I have so far: http://gregschultz.net/gallery.php

With this code:
'<?php
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'gallery');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
header ('Content-Type: text/html; charset=' . getOption('charset'));
?>
<div id="albums">
<?php while (next_album()): ?>
<div class="album">
<a>" title="View album: <?php echo getAlbumTitle();?>">
<?php printAlbumThumbImage(getAlbumTitle()); ?>
</a>
<div class="albumdesc">
<h3><a>" title="View album: <?php echo getAlbumTitle();?>"><?php printAlbumTitle(); ?></a></h3>
<p><?php printAlbumDesc(); ?></p>
</div>
</div>
<?php endwhile; ?>
</div>'
It displays all of my albums.

With this code:
'<?php
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'gallery');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
header ('Content-Type: text/html; charset=' . getOption('charset'));
?>
<div id="albums">
<?php while (next_album()): ?>
<a>" title="View album: <?php echo getAlbumTitle();?>">
<?php printAlbumThumbImage(getAlbumTitle()); ?>
<?php printAlbumTitle(); ?>
<?php printAlbumDescAlt(); ?>
</a>
<?php endwhile; ?>
</div>'
It displays the first album only.

I'm not familiar with PHP programming so this is why I'm asking for help.

Thanks,
Greg
Member
Member
sbillard   2011-04-20, 00:03
#9
First, for this forum, it is best to use the code deliminating "peck marks" or "back tick" (on the US PC keyboard it is the left most key on the numberic row.)

This takes care of insuring that your HTML markup in the code shows up.

Unless some of your code has been swallowed because of the HTML interpretation, the two loops you show would process exactly the same number of albums. The only significant difference between the two is the HTML `<div>` brackets in the first loop. This would lead one to beleive there might be a mis-balanced set of `<div>` tags.
Member
Member
gschultz   2011-04-20, 01:19
#10
Found the fix.

`
<?php while (next_album()): ?>
">
<?php printAlbumThumbImage(getAlbumTitle()); ?>
<?php printAlbumTitle(); ?>

<?php break; ?>
<?php endwhile; ?>
`
x10
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.