sNews Forum

sNews 1.6 (previous version) => 3rd Party Integration and bridges => Bridge development and discussion => Topic started by: centered on August 23, 2007, 10:53:18 pm

Title: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 23, 2007, 10:53:18 pm
This MOD is too add ZenPhoto functions in sNews

This is for sNews 1.6 with fixes from this thread: http://snewscms.com/forum/index.php?topic=2854.0

0. Backup or start fresh (recommended!!! I will do this on a fresh install)

1. Install sNews normally
2. Add a gallery folder and install ZenPhoto normally (http://www.zenphoto.org/files/zenphoto-1.0.8.2.zip)
3. In sNews index replace the first line:
Code: [Select]
<?php session_start(); include('snews.php'); ?>
With
Code: [Select]
<?php session_start(); include('snews.php'); define('WEBPATH''gallery'); require_once("gallery/zen/template-functions.php"); ?>
4.  In snews.php:
(Thank Patric for this)
Find these occurances inside the snews.php:
Quote
1. .strip($title).
2. .strip($text).
3. function strip($text)
And change them into eg:
Quote
1. .snews_strip($title).
2. .snews_strip($text).
3. function snews_strip($text)
5. In the themes folder of ZenPhoto, make a duplicate copy of the default theme and name it snews
6.  In themes/snews, Change index.php to this: (referencing the default sNews 1.6 template)
Code: [Select]
<? session_start();
include ('../snews.php'); ?>
<?php if (!defined('WEBPATH')) die(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<?php title(); ?>

<meta name="Robots" content="index,follow" />

<meta name="Generator" content="sNews 1.6" />

<style type='text/css' title='currentStyle' media='screen'>
@import 'style.css';
</style>
<link rel="stylesheet" href="<?php echo  $_zp_themeroot ?>/zen.css" type="text/css" />
<?php zenJavascript(); ?>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-articles/" />

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-pages/" />

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-comments/" />

</head>

<body>

<div class="wrap">

<div id="logo">

<h1><?php echo s('website_title'); ?></h1>

</div>



<ul id="menu">

<?php pages(); ?>

</ul>



<div id="subheader">

<div id="breadcrumbs">

<?php breadcrumbs(); ?>

</div>



<div id="search">

<?php searchform(); ?>

</div>

</div>



<div id="left">

<h3>Categories:</h3>

<ul>

<?php categories(); ?>

</ul>



<h3>New Articles:</h3>

<ul>

<?php menu_articles(0,3); ?>

</ul>



<h3>New comments:</h3>

<ul>

<?php new_comments(530); ?>

</ul>

<h3>New images:</h3>
<ul>
<?php show_latest_images(4); ?>

<ul>

<h3>Random image:</h3>
<?php $randomImage getRandomImages(); $randomImageURL getURL($randomImage); print "<a href='".getURL($randomImage)."' title='Random Picture...'><img src='".$randomImage->getCustomImage(85620180620180300300)."' alt='".$randomImage->getTitle()."' /></a>"?>


<?php extra(); ?>

</div>



<div id="right">

<div id="gallerytitle">

<h2><?php echo getGalleryTitle(); ?></h2>

</div>



<div id="albums">

<?php while (next_album()): ?>

<div class="album">

<a href="<?php echo getAlbumLinkURL();?>" title="View album: <?php echo getAlbumTitle();?>">

<?php printAlbumThumbImage(getAlbumTitle()); ?>

</a>

<div class="albumdesc">

        <small><?php printAlbumDate("Date Taken: "); ?></small>

<h3><a href="<?php echo getAlbumLinkURL();?>" title="View album: <?php echo getAlbumTitle();?>">
<?php printAlbumTitle(); ?></a>
</h3>

<p><?php printAlbumDesc(); ?></p>

</div>

<p style="clear: both; "></p>

</div>

<?php endwhile; ?>

</div>



<?php printPageListWithNav("&laquo; prev""next &raquo;"); ?>



<div id="enableSorting">

  <?php printSortableGalleryLink('Click to sort gallery''Manual sorting'NULL'credit'); ?>

  </div>

</div>



<div id="footer">

<ul id="rss">

<?php rss_links(); ?>

</ul>

<p>Barbecued by <a href="http://snews.solucija.com/" title="Single file CMS">sNews</a>
&middot; <?php login_link(); ?></p>

</div>

</div>

</body>

</html>
7. In themes/snews, Change album.php to this: (again, referencing the default sNews 1.6 template)
Code: [Select]
<? session_start();
include ('../snews.php'); ?>
<?php if (!defined('WEBPATH')) die(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<?php title(); ?>

<meta name="Robots" content="index,follow" />

<meta name="Generator" content="sNews 1.6" />

<style type='text/css' title='currentStyle' media='screen'>
@import 'style.css';
</style>
<link rel="stylesheet" href="<?php echo  $_zp_themeroot ?>/zen.css" type="text/css" />
<?php zenJavascript(); ?>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-articles/" />

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-pages/" />

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-comments/" />

</head>

<body>

<div class="wrap">

<div id="logo">

<h1><?php echo s('website_title'); ?></h1>

</div>



<ul id="menu">

<?php pages(); ?>

</ul>



<div id="subheader">

<div id="breadcrumbs">

<?php breadcrumbs(); ?>

</div>



<div id="search">

<?php searchform(); ?>

</div>

</div>



<div id="left">

<h3>Categories:</h3>

<ul>

<?php categories(); ?>

</ul>



<h3>New Articles:</h3>

<ul>

<?php menu_articles(0,3); ?>

</ul>



<h3>New comments:</h3>

<ul>

<?php new_comments(530); ?>

</ul>

<h3>New images:</h3>
<ul>
<?php show_latest_images(4); ?>

<ul>

<h3>Random image:</h3>
<?php $randomImage getRandomImages(); $randomImageURL getURL($randomImage); print "<a href='".getURL($randomImage)."' title='Random Picture...'><img src='".$randomImage->getCustomImage(85620180620180300300)."' alt='".$randomImage->getTitle()."' /></a>"?>



<?php extra(); ?>

</div>



<div id="right">

<div id="gallerytitle">

<h2><span><a href="<?php echo getGalleryIndexURL();?>" title="Gallery Index">
<?php echo getGalleryTitle();?></a> | </span> <?php printAlbumTitle(true);?></h2>

</div>

<?php printAlbumDesc(true); ?>

<div id="images">

<?php while (next_image()): ?>

<div class="image">

<div class="imagethumb">
<a href="<?php echo getImageLinkURL();?>" title="<?php echo getImageTitle();?>">
<?php printImageThumb(getImageTitle()); ?></a>
</div>

</div>

<?php endwhile; ?>

</div>

<?php printPageListWithNav("&laquo; prev""next &raquo;"); ?>

<div id="enableSorting">

  <?php printSortableAlbumLink('Click to sort album''Manual sorting'NULL'sort'); ?>

  </div>
</div>
<div id="footer">

<ul id="rss">

<?php rss_links(); ?>

</ul>

<p>Barbecued by <a href="http://snews.solucija.com/" title="Single file CMS">sNews</a>
&middot; <?php login_link(); ?></p>

</div>

</div>

</body>

</html>

8.  In themes/snews, Change image.php to this: (Again, referencing the default sNews 1.6 template)
Code: [Select]
<? session_start();
include ('../snews.php'); ?>
<?php if (!defined('WEBPATH')) die(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<?php title(); ?>

<meta name="Robots" content="index,follow" />

<meta name="Generator" content="sNews 1.6" />

<style type='text/css' title='currentStyle' media='screen'>
@import 'style.css';
</style>
<link rel="stylesheet" href="<?php echo  $_zp_themeroot ?>/zen.css" type="text/css" />
<script type="text/javascript">

function toggleComments() {

      var commentDiv = document.getElementById("comments");

      if (commentDiv.style.display == "block") {

        commentDiv.style.display = "none";

      } else {

        commentDiv.style.display = "block";

      }

}

</script>

<?php zenJavascript(); ?>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-articles/" />

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-pages/" />

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-comments/" />

</head>

<body>

<div class="wrap">

<div id="logo">

<h1><?php echo s('website_title'); ?></h1>

</div>



<ul id="menu">

<?php pages(); ?>

</ul>



<div id="subheader">

<div id="breadcrumbs">

<?php breadcrumbs(); ?>

</div>



<div id="search">

<?php searchform(); ?>

</div>

</div>



<div id="left">

<h3>Categories:</h3>

<ul>

<?php categories(); ?>

</ul>



<h3>New Articles:</h3>

<ul>

<?php menu_articles(0,3); ?>

</ul>



<h3>New comments:</h3>

<ul>

<?php new_comments(530); ?>

</ul>

<h3>New images:</h3>
<ul>
<?php show_latest_images(4); ?>

<ul>

<h3>Random image:</h3>
<?php $randomImage getRandomImages(); $randomImageURL getURL($randomImage); print "<a href='".getURL($randomImage)."' title='Random Picture...'><img src='".$randomImage->getCustomImage(85620180620180300300)."' alt='".$randomImage->getTitle()."' /></a>"?>



<?php extra(); ?>

</div>



<div id="right">

<div class="imgnav">

<?php if (hasPrevImage()) { ?>

<div class="imgprevious">
<a href="<?php echo getPrevImageURL();?>" title="Previous Image">
&laquo; prev</a>
</div>

<?php } if (hasNextImage()) { ?>

<div class="imgnext">
<a href="<?php echo getNextImageURL();?>" title="Next Image">
next &raquo;</a>
</div>

<?php ?>

</div>



<div id="gallerytitle">

<h2><span><a href="<?php echo getGalleryIndexURL();?>" title="Gallery Index">
<?php echo getGalleryTitle();?></a>
| <a href="<?php echo getAlbumLinkURL();?>" title="Gallery Index">
<?php echo getAlbumTitle();?></a>
| </span> <?php printImageTitle(true); ?></h2>

</div>



<div id="image">

<a href="<?php echo getFullImageURL();?>" title="<?php echo getImageTitle();?>">
<?php printDefaultSizedImage(getImageTitle()); ?></a>

</div>



<div id="narrow">

<?php printImageDesc(true); ?>

<div id="comments">

<?php $num getCommentCount(); echo ($num == 0) ? "" : ("<h3>Comments ($num)</h3>"); ?>

<?php while (next_comment()):  ?>

<div class="comment">

<div class="commentmeta">

<span class="commentauthor"><?php printCommentAuthorLink(); ?></span> says:

</div>

<div class="commentbody">

<?php echo getCommentBody();?>

</div>

<div class="commentdate">

<?php echo getCommentDate();?>

,

<?php echo getCommentTime();?>

          <?php printEditCommentLink('Edit'' | '''); ?>

</div>

</div>

<?php endwhile; ?>

<div class="imgcommentform">

<!-- If comments are on for this image AND album... -->

<h3>Add a comment:</h3>

<form id="commentform" action="#" method="post">

<div><input type="hidden" name="comment" value="1" />

          <input type="hidden" name="remember" value="1" />

          <?php if (isset($error)) { 
?>
<tr><td><div class="error">
There was an error submitting your comment. Name, a valid e-mail address, and a comment are required.
</div></td></tr>
<?php ?>

<table border="0">

<tr>

<td><label for="name">Name:</label></td>

<td><input type="text" id="name" name="name" size="20" value="<?php echo $stored[0];?>" class="inputbox" />

</td>

</tr>

<tr>

<td><label for="email">E-Mail:</label></td>

<td><input type="text" id="email" name="email" size="20" value="<?php echo $stored[1];?>" class="inputbox" />

</td>

</tr>

<tr>

<td><label for="website">Site:</label></td>

<td><input type="text" id="website" name="website" size="40" value="<?php echo $stored[2];?>" class="inputbox" /></td>

</tr>

</table>

<textarea name="comment" rows="6" cols="40"></textarea>

<br />

<input type="submit" value="Add Comment" class="pushbutton" /></div>

</form>

</div>

</div>

</div>

</div>

<div id="footer">

<ul id="rss">

<?php rss_links(); ?>

</ul>

<p>Barbecued by <a href="http://snews.solucija.com/" title="Single file CMS">sNews</a>
&middot; <?php login_link(); ?></p>

</div>

</div>

</body>

</html>

9. If you want Recent Images and Random Images, then go to functions.php found in the zen folder and add this:
Code: [Select]
/////////**********MODS**********/////////////////
/* Show Latest Images */
/* http://anton.gektoras.lt/zenphoto/zenphoto-latest-images */
function show_latest_images($number) {
$images = query_full_array("SELECT images.albumid, images.filename AS filename, images.title AS title, albums.folder AS folder FROM ".prefix('images')." AS images, ".prefix('albums')." AS albums WHERE images.albumid = albums.id AND images.show = 1 ORDER BY images.id DESC LIMIT $number");
        $size = '_'.zp_conf('thumb_size').'_cw'.zp_conf('thumb_crop_width').'_ch'.zp_conf('thumb_crop_height');
        foreach ($images as $image) {
        $filename = $image['filename'];
        $album = $image['folder'];
              $desc = $image['title'];
              echo '<li>';
                if (zp_conf('mod_rewrite') == false) {
                echo '<a href="'.WEBPATH.'/index.php?album='.$album.'&image='.$filename.'" title="'.$desc.'">';
                } else {
                      echo '<a href="'.WEBPATH.'/'.$album.'/'.$filename.'" title="'.$desc.'">';
                }
// echo '<img src="'.WEBPATH.'/cache/'.$album.'/'.$filename.$size.'.jpg"></a>';
              echo '<img src="'.WEBPATH.'/zen/i.php?a='.$album.'&i='.$filename.'&s=thumb"></a>';
              echo '</li>';
}
}

// Get Random Images
function getRandomImages() {
$result = query_single_row('SELECT '.prefix("images").'.filename,'.prefix("images").'.title, '.prefix("albums").'.folder FROM '.prefix("images").' INNER JOIN '.prefix("albums").' ON '.prefix("images").'.albumid = '.prefix("albums").'.id ORDER BY RAND() LIMIT 1');
$image = new Image(new Album(new Gallery(), $result['folder']), $result['filename']);
return $image;
}

function getURL($image) {
if (zp_conf('mod_rewrite')) {
return WEBPATH . "/" . pathurlencode($image->getAlbumName()) . "/" . urlencode($image->name);
} else {
return WEBPATH . "/index.php?album=" . pathurlencode($image->getAlbumName()) . "&image=" . urlencode($image->name);
}
}
10.  Back to sNews index.php add these in the sidebar for Recent Images and Random image:
Code: [Select]
<h3>New images:</h3>
<ul>
<?php show_latest_images(4); ?>

<ul>

<h3>Random image:</h3>
<?php $randomImage getRandomImages(); $randomImageURL getURL($randomImage); print "<a href='".getURL($randomImage)."' title='Random Picture...'><img src='".$randomImage->getCustomImage(85620180620180300300)."' alt='".$randomImage->getTitle()."' /></a>"?>
10a. The numbers under getCustomImage are defined in zen/i.php:
Code: [Select]
*   s  - size (logical): Based on config, makes an image of "size s."
 *   h  - height (explicit): Image is always h pixels high, w is calculated.
 *   w  - width (explicit): Image is always w pixels wide, h is calculated.
 *   cw - crop width: crops the image to cw pixels wide.
 *   ch - crop height: crops the image to ch pixels high.
 *   cx - crop x position: the x (horizontal) position of the crop area.
 *   cy - crop y position: the y (vertical) position of the crop area.
 *   q  - JPEG quality (1-100): sets the quality of the resulting image.
11.  Referencing sNews default, add in the css:
Code: [Select]
img { border: none; }
12.  Hard link your gallery in Display Pages in snews.php:
Code: [Select]
echo '<li><a href="'.db('website').'gallery/" title="Gallery">Gallery</a></li>';13.  Add a link to the ZenPhoto admin in function administration() (in snews.php of course)
Change
Code: [Select]
echo '<p><a href="files/" title="'.l('files').'">'.l('files').'</a></p></fieldset>';To
Code: [Select]
echo '<p><a href="files/" title="'.l('files').'">'.l('files').'</a></p>';
echo '<p><a href="gallery/zen/admin.php" title="ZenPhoto Admin">Gallery Admin</a></p></fieldset>';

Your done. You should have something similar to the picture below.

I packaged this all for you to use here:
http://www.apadmedia.com/publicfolder/index.php?action=downloadfile&filename=sNews16-zenphoto.zip&directory=sNews%20Mods&

There are fixes that were not applied yet so add these below to the package:
*BUG FIX* - snews index.php should be:
<?php session_start(); include('snews.php'); define('WEBPATH', 'gallery'); require_once("gallery/zen/template-functions.php"); ?>

gallery WEBPATH should not have the '/'. URLs will work otherwise on my machine but for clarity and proper urls, then get rid of the slash

FIX - Add to function administration()
change
Code: [Select]
echo '<p><a href="files/" title="'.l('files').'">'.l('files').'</a></p></fieldset>';to
Code: [Select]
echo '<p><a href="files/" title="'.l('files').'">'.l('files').'</a></p>';
echo '<p><a href="gallery/zen/admin.php" title="ZenPhoto Admin">Gallery Admin</a></p></fieldset>';

Known issue - Gallery does not have current state in Display Pages, tried to follow the previous lines but it wouldn't work...

Let me know if everything else works!!


EDIT***************************
Someone asked about this:
(http://snewscms.com/forum/index.php?action=dlattach;topic=5634.0;attach=253;image)

All I did was download this package http://cow.neondragon.net/stuff/reflection/reflection.zip
and add the reflection.js (5kb not bad...)  to where I will be applying the recent images call
I put mine in sNews index.php for now..
Code: [Select]
<script type="text/javascript" src="reflection.js"></script>
Now in the gallery/zen/functions.php replace this line in recent images BEFORE THE CLOSING LI
Code: [Select]
echo '<img src="'.WEBPATH.'/zen/i.php?a='.$album.'&i='.$filename.'&s=thumb" class="reflect rheight33"></a>';All we are adding is the class.  Other uses a reflections are in the zip, so you can add accordingly

Now all your recent images will have a reflection!
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 23, 2007, 11:17:44 pm
If you need more functionality, check the ZenPhoto Trac: http://www.zenphoto.org/trac/wiki/ZenphotoHacks

These are untested by me, just to note.

Additionally, one may want:
Passowrd Protected Albums: http://www.zenphoto.org/trac/wiki/ZenphotoHacks#PasswordProtectedAlbums (for ZP only I assume)
Captcha for Comments: http://gregoryb.dyndns.org/public/scripts/zenphoto_comment_protection.zip (ZP only)
Watermarks: http://www.zenphoto.org/trac/wiki/ZenphotoHacks#WatermarkingHack (ZP only)
Recent Comments: http://www.zenphoto.org/trac/wiki/ZenphotoHacks#RecentCommentsCustomFunction
       Add to sNews theme in ZP themes and in sNews index.php <?php show_latest_comments(3); ?>



Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: piXelatedEmpire on August 24, 2007, 04:32:02 am
It looks like the ZenPhoto development is up in the air at the moment - the main developer has been very quiet in the forums etc and not many updates.  I hope the project continues in its devlopment as it has a lot of potential.  I noticed Plogger has been updated to 3.0beta as well.

Thanks for these instructions centered, worth considering as an option for a gallery.
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 24, 2007, 04:40:27 am
Hey no problem Pixelated.  Even if the main developer stops, I am sure someone else will pick up where he left off.  ZenPhoto is a great software for displaying a gallery and I hope my instructions will help include this gallery in thier site with the new functions (well old really but new to another step towards full sNews intregation).
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Patric Ahlqvist on August 24, 2007, 09:14:10 am
...I noticed Plogger has been updated to 3.0beta as well...

Only hope thath they've manage to solve the issue of "no validation what so freaking ever" in that gallery, then ;)
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 24, 2007, 12:15:02 pm
I can't seem to access the Plogger site at the moment, and the demo at opensourcecms doesn't let me upload pictures.... I think I would stick with ZenPhoto myself for the time being.  Plus they are working on bugs and fixes at ZenPhoto anyway, just very slowly atm.

http://www.zenphoto.org/support/topic.php?id=1612
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Patric Ahlqvist on August 24, 2007, 12:20:28 pm
You're doing the right thing, CE. I tried out Plogger sometime ago, and phuiii, there was validation issues I can tell you that. I didn't even start trying to adjust them, but swapped for ZP instead. Never failed me once ;)
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 24, 2007, 12:32:30 pm
Thanks! Hey Patric, did you get a chance to test the mod, I remember someone wanted this mod as well.... :)
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Patric Ahlqvist on August 24, 2007, 01:00:30 pm
No, mate not yet... but I sure will... I like where this is headed, for sure, and I'm most certainly gonna try it out, and most certainly use it on my next site...  One Q, though... is this random only ? If I wanted it just to display newest pics... Is that possible ? Or even better (sorry if I'm troublesome here ;)) some sort of enable/disable randomness, like having it default set to newest pics, and then by either checking a checkbox or by a minor change in snews.php enableing the randomness feature... Just thoughts ;)
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 24, 2007, 01:03:22 pm
Bot functions are there, check out the screenshot.  The mod also works in 1.6, 1.5, and 1.4 (shown below)

Responded too quiclkly,

You can add or take away these functions in the Snews index.php if you want
Code: [Select]
<h3>New images:</h3>
<ul>
<?php show_latest_images(4); ?>

<ul>

<h3>Random image:</h3>
<?php $randomImage getRandomImages(); $randomImageURL getURL($randomImage); print "<a href='".getURL($randomImage)."' title='Random Picture...'><img src='".$randomImage->getCustomImage(85620180620180300300)."' alt='".$randomImage->getTitle()."' /></a>"?>
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Patric Ahlqvist on August 24, 2007, 01:09:47 pm
Goodie, good, good... ;) Will most def. try it out, but at a later date, I'm afraid. Have too much on my "private" hands just now. Thanks for this awsome contribution, CE. Most valuable.
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 24, 2007, 01:21:22 pm
Well if it wasn't for you with starting this out, I probably wouldn't get too far!  So thank you Patric. 
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Zucye on August 24, 2007, 05:21:00 pm
Is there a demo??
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 24, 2007, 06:34:19 pm
No demo, sorry.  You could download the package and install the databases and run it from there (put it in a folder called 16 or whatever I have it called.  I placed images in the package to show a working version
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Zucye on August 24, 2007, 08:15:40 pm
Since there is not Demo and I am really tired (reason why I probably don’t get it :( )… Do you care to explain me what is this suppose to do??
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 24, 2007, 09:38:52 pm
It is supposed to add you ZenPhoto gallery recent pictures and random images (didn't you say you were having trouble?!?) in your sNews template (not only in the zen themes).


I was looking to do something similar sometime ago.  I found the following treat in the zenphoto forum, but the members there are not as friendly and nice as you guys… so I didn't accomplish anything :(.  Hope you guys can!

http://www.zenphoto.org/support/topic.php?id=7&page=2

This will help you accomplish what you wanted to achieve with Random Images showing on you snews site
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Zucye on August 25, 2007, 02:44:05 pm
Yes I did.  I just wanted to be sure :D. 

I will give it a try on Monday. 

Happy weekend!!!!
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 25, 2007, 05:39:46 pm
Probably Monday or so I will try and incorperate the snews login with Zenphoto, so you can just log into snews and when you click on gallery admin, you are logged into zenphoto.

Based on this code:
http://www.zenphoto.org/support/topic.php?id=755#post-4165
and
http://www.zenphoto.org/support/topic.php?id=40

Unless Baker beats me to it!

EDIT... harder than I expected it to be....

I will also try out the RSS mod for zenphoto as well: http://www.zenphoto.org/support/topic.php?id=764
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 26, 2007, 06:24:26 pm
Ok I have RSS working for the full gallery and albums.  I have to test for multiple gallerys.  The login seems to be beyond my scope of copy and pasting,  some more logic is involved to make this work.
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Zucye on August 27, 2007, 06:58:24 pm
It works nicely! Thanks a lot!

But now some of the pages show the following message :( : Zenphoto error: Album does not exist.

I will check to see if I did something wrong later

** I just realized is not only the pages, but the articles as well.  Shame it looked so nice  :(
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 27, 2007, 07:23:01 pm
Are you using the downloaded package?
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Zucye on August 27, 2007, 10:17:30 pm
No! I didn't use the download package.  Because my snews file is modded.

==========================
(A while Later)

Ok, I tried again, same result the random image appears, the lastes pictures as well, but if I click a page or an article I get the message: Zenphoto error: Album does not exist.

I follow you instruction from Step 3 to 10  very carefully, with the following exceptions:
When ever you have snews.php'); ?>, I used snews-split.php'); ?> (I use the subpages MOD)

Therefore my Step #3 was like this:
Code: [Select]
<?php session_start(); include('snews-split.php'); define('WEBPATH''zenphoto'); require_once("zenphoto/zen/template-functions.php"); ?>I assumed I had to change "gallery" with the name of my folder.


Also I added the Step #9 right after:
Code: [Select]
  // Send the mail
UTF8::send_mail("Admin <" . zp_conf('admin_email') . ">", $subject, $message, $headers);
  }
}
since you didn't specied exactly where to add it.

What did I do wrong??

==========================
(Another while Later)

I think I might have gotten this issue confused.  Because If I think about it, it should work correctly if it is used in the zenphoto template pages, but I am trying to use it in the main index.php.  That didn’t sound very clear.  This is what I'm trying to say I wan to see the images in http://www.zucye.net/, which does work, but does not let me see the articles, categories or pages when clicked.  But If I put it in another page it work correctly for example http://www.zucye.net/indexgalery.php.

Should I be able to see it in my main index.php or not? Or is this Mod only for the zenphoto template page??
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 28, 2007, 12:41:58 am
hmm pretty odd since it should work...

Step 3 is correct, changing the folder name to reflect your own folder.

Step 9 I added it at the end before the closing ?>

This mod is for the zenphoto and snews indexes so all pages will reflect the recent galleries and other functions you may want to be shown on all pages. 

To note, I do not have htacess enabled for zenphoto on my localhost, I do not know if that may be an issue...

The idea I may have is the php functions may not be processing correctly somehow.  Evidence shows this:
==== Testing begings =====
New images:

Random image:
".$randomImage->getTitle().""; ?>
==== Testing ends =====
on your page: http://www.zucye.net/portada/galeria/

My sNews index looks like this:
Code: [Select]
<?php session_start(); include('snews.php'); define('WEBPATH''gallery'); require_once("gallery/zen/template-functions.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php title(); ?>
<meta name="Robots" content="index,follow" />
<meta name="Generator" content="sNews 1.6" />
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-articles/" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-pages/" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss-comments/" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="gallery/rss.php" />
</head>
<body>
<div class="wrap">
<div id="logo">
<h1><?php echo s('website_title'); ?></h1>
</div>
<ul id="menu">
<?php pages(); ?>
</ul>
<div id="subheader">
<div id="breadcrumbs">
<?php breadcrumbs(); ?>
</div>
<div id="search">
<?php searchform(); ?>
</div>
</div>
<div id="left">
<h3>Categories:</h3>
<ul>
<?php categories(); ?>
</ul>
<h3>New Articles:</h3>
<ul>
<?php menu_articles(0,3); ?>
</ul>
<h3>New comments:</h3>
<ul>
<?php new_comments(530); ?>
</ul>
<h3>New images:</h3>
<ul>
<?php show_latest_images(4); ?>
<ul>
<h3>Random image:</h3>
<?php $randomImage getRandomImages(); $randomImageURL getURL($randomImage); print "<a href='".getURL($randomImage)."' title='Random Picture...'><img src='".$randomImage->getCustomImage(85620180620180300300)."' alt='".$randomImage->getTitle()."' /></a>"?>
<?php extra(); ?>
</div>
<div id="right">
<?php center(); ?>
</div>
<div id="footer">
<ul id="rss">
<?php rss_links(); ?>
<li><a href="gallery/rss.php">RSS Gallery</a></li>
</ul>
<p>Barbecued by <a href="http://snews.solucija.com/" title="Single file CMS">sNews</a> &middot; <?php login_link(); ?></p>
</div>
</div>
</body>
</html>



EDIT*  Can anyone else let me know if this is working for them??
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on August 29, 2007, 11:48:38 pm
Added reflections to the recent images function in the first post
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Zucye on September 04, 2007, 05:34:16 pm
It works! :D   I am sorry for all the confusion… Actually I don’t know what went wrong, but after reinstalling zenphoto (perhaps it was not compatible with the older version), it worked perfectly.

I and not using it with my index page (but I tested it), because I have to make some adjustments first, but is in use in my gallery and I just love the way it looks.  Thanks Centered!

Btw:  I have notice for sometime now that when I share the same date base (snews and zenphoto) I get the following error message in my admin panel:
Quote
MySQL Query ( SELECT c.id, i.title, i.filename, a.folder, a.title AS albumtitle, c.name, c.website, c.date, c.comment FROM `comments` AS c, `images` AS i, `albums` AS a WHERE c.imageid = i.id AND i.albumid = a.id ORDER BY c.id DESC LIMIT 10 ) Failed. Error: Unknown column 'c.website' in 'field list'
How did you overcome that??

Not that it is a big deal, but I am curious :)
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on September 05, 2007, 01:45:42 pm
Awesome Zucye!  I don't get that error at all in my test version and my database has the snews database with zen using a prefix.  Might be something to do with the comments table.  Is the comments working at all? 
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Keyrocks on September 05, 2007, 05:39:19 pm
It's been a while since I used ZenPhoto with sNews and I will be doing it soon in a new project. If it is any help... I do remember, tho, that the last time I used it I prefixed all of the ZenPhoto database tables with zp_ to eliminate possible conflicts, and the prefixed tables worked OK located in the same database as the sNews tables.
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on September 05, 2007, 06:19:39 pm
Right Keys.

Zucye it seems maybe Zen comments needs the prefix to function correctly.  View my defualt 1.6 install with Zen
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on September 05, 2007, 06:56:01 pm
If anyone wants to try the RSS for Zen then here it is:
http://www.bosnervos.de/rss-for-gallery-and-albums.zip

Doesn't work exactly as I hoped but it does work for the most part
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Boogada on September 08, 2007, 11:59:40 am
Hi,

first off I'm a newbie to both snews and zenphoto, but I thought I give it a try. I probably forgot something or whatever but I got into these problems. when I go to the site I do not get the images displayed properly. the sidebar is not really working for the recent images etc..

now if I go to the gallery it works! I see the random image etc.. but the design is broken.

how to fix this?

link to my site (http://test.hohle-phrasen.de/)
link to gallery (http://test.hohle-phrasen.de/zenphoto/)
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on September 08, 2007, 03:46:54 pm
Problem #1: In sNews index.php change the first line to reflect your ZenPhoto folder which you have called "zenphoto":
Code: [Select]
<?php session_start(); include('snews.php'); define('WEBPATH''zenphoto'); require_once("zenphoto/zen/template-functions.php"); ?>

Problem #2: 
In your snews theme folder under zenphoto, find the zen.css  (zenphoto/themes/snews/zen.css)

Comment out body, text style section and links section
/* Or */
Use this css in your snews zen theme folder -
BACKUP FIRST THEN PASTE THIS:

(admin edited, to reduce empty space)
Code: [Select]
/*
Zen Photo Default 1.0
*/

/* Basics
------------------------------ */

html {
/* IE */
overflow-y: scroll;
/* Moz */
height: 100%;
margin-bottom: 0.1em;
}


/* Main Layout
------------------------------ */

/*
body {
background: #F5F5F3;
margin: 0px;
padding: 0px 0px 50px;
text-align: center;
}
*/

#main {
text-align: left;
margin: 20px auto;
width: 600px;
background: #fff;
padding: 20px 30px 70px;
border-top: 1px solid #E6E6DF;
border-right: 1px solid #E6E6DF;
border-bottom: 5px solid #E6E6DF;
border-left: 1px solid #E6E6DF;
}

#credit, #sort {
margin: 0 auto;
width: 640px;
font-size: 85%;
color: #96967E;
text-align: right;
clear: both;
}

#credit a, #sort a {
text-decoration: none;
color: #96967E;
border-bottom: 1px dotted #96967E;
}

#credit a:hover, #sort a:hover {
color: #BDBDAE;
border-bottom: 1px solid #BDBDAE;
text-decoration: none;
}

#gallerytitle {
border-bottom: 1px solid #E6E6DF;
padding-bottom: 14px;
margin-bottom: 12px;
_margin-top: 40px; /* IE Only */
}


/* Text Styles
------------------------------ */
/*
body {
font: normal 82%/200% "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #5A5A4B;
}

h2 {
font: 120% "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #002E5B;
margin-top: 25px;
}

h2 a:link, h2 a:visited, h2 span {
color: #8DB8CF;
}

h3 {
font: 120% "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #002E5B;
margin-top: 30px;
}
*/

/* Link Styles
------------------------------ *//*

a:link, a:active { text-decoration: underline; color: #17A; }

a:visited { text-decoration: underline; color: #035; }

a:hover, a:focus { text-decoration: underline; color: #6BD; }

*/


/* Miscellaneous
------------------------------ */

hr {
clear: both;
height: 0;
border: 0;
border-top: 1px solid #E6E6DF;
margin: 0 0 12px 0;
padding: 0;
}

img { border: 0; }

blockquote {
border-left: 1px dotted #96967E;
margin-left: 20px;
padding-left: 20px;
color: #363630;
}

/* Page Navigation
------------------------------ */

ul.pagelist {
clear: both;
padding: 0;
margin: 20px 0 0 0;
list-style-type: none;
}

ul.pagelist li {  display: inline;  }

ul.pagelist li a, ul.pagelist span.disabledlink { padding: 4px;  }

ul.pagelist li.current a {
font-weight: bold;
text-decoration: none;
cursor: default;
color: #5A5A4B;
}

ul.pagelist li.prev {  margin-right: 10px;  }

ul.pagelist li.next {  margin-left: 10px;  }

.disabledlink {
color: #ddd;
cursor: default;
}

.pagenav {  clear: both;  }

/* AJAX
------------------------------ */

#albumDescEditable {  margin-bottom: 12px;  }

#imageDescEditable {  margin-top: 24px;  }

/* Image Thumbnails
------------------------------ */

.imagethumb a {
display: block;
padding: 10px;
margin: 6px;
border: 1px solid #92BED3;
background: #DDEAF0;
line-height: 0px;
}

.imagethumb a:visited {
border: 1px solid #D3E4ED;
background: #F2F7F9;
}

.imagethumb a:hover {
border: 1px solid #62A0BF;
background: #F4F9FB;
}

.imagethumb {  float: left;  }

/* Album Thumbnails
------------------------------ */

.album {
padding: 10px;
margin-bottom: 12px;
clear: both;
border: 1px solid #E7F0F5;
background: #FBFCFD;
}

.album img {  float: left;  }

.album h3 {  padding: 0;  margin: 0;  }

.album h3 a {
display: block;
width: 340px;
padding: 3px 0 6px 0;
}

.album p {  margin: 0 0 4px 0;  }

.albumdesc {  float: right;  width: 480px;  }

.albumdesc small {
margin-top: 8px;
line-height: 130%;
width: 120px;
float: right;
color: #8DB8CF;
}

/* Individual Image
------------------------------ */

.image {  margin: 0;  padding: 0;  border: 0;  }

#image {  text-align: center;  line-height: 0;  }

.imgnav {
float: right;
width: 140px;
text-align: center;
border: 1px solid #D5E6EE;
background: #EEF5F9;
margin-top: 13px;
_margin-top: 8px; /* IE Only */
}

.imgnav .imgprevious a, .imgnav .imgnext a {
display: block;
width: 50%;
height: 100%;
float: left;
padding: 4px 0;
font-size: 120%;
text-decoration: none;
line-height: 200%;
color: #237898;
}

.imgnav .imgprevious a:hover, .imgnav .imgnext a:hover {
background-color: #fff;
text-decoration: none;
color: #002E5B;
}

.imgnav .imgprevious a {  float: left;  }

.imgnav .imgnext a {  float: right;  }

#narrow {  margin: 0 auto;  width: 440px;  }

/* Comments
------------------------------ */

#comments {  clear: both;  }

.error {  color: #C33;  font-weight: bold;  }

.comment {
padding: 10px;
border: 1px solid #E7F0F5;
background: #FBFCFD;
margin-bottom: 12px;
}

.commentmeta {  margin-bottom: 12px;  }

.commentauthor {  font-weight: bold;  }

.commentdate {  margin-top: 12px;  color: #8DB8CF;  font-size: 85%;  }

/* Forms
------------------------------ */

.inputbox {  width: 250px;  padding: 2px;  }

textarea {
padding: 4px;
width: 100%;
color: #5A5A4B;
font: 100%/200% "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.checkbox {  cursor: pointer;  }

.pushbutton {  cursor: pointer;  padding: 5px 10px;  }

label {  cursor: pointer;  }

label:hover {  color: #000;  }


Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Boogada on September 08, 2007, 04:14:58 pm
Problem #1:

D'OH - I'm sure I had done this. But probably I overwrote the file more than once...

Problem #2:

Worked fine!

Thanks a lot!

this might be exactly what I am looking for!
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Zucye on September 16, 2007, 05:17:43 pm
Zucye it seems maybe Zen comments needs the prefix to function correctly. 
That did it! :D
So that is what a Prefix is good for (nice to know) 
By the way it took me a long while to apply the Prefix to the existing tables :( .  I am sure I took the longer path possible, one day I will ask if there is a simpler way.
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: belfagor on October 14, 2007, 06:09:04 pm
Hello,

I did install sNews and ZenPhoto, and separately they work very fine.
I did follow all the instructions in the equilni mod to integrate them together, but wathever I try I get this error:

MySQL Query ( SELECT folder, sort_order FROM `zp_albums` ORDER BY sort_order ) Failed. Error: Table 'snews.zp_albums' doesn't exist

I'm not a programmer, but it looks like the ZenPhoto query is searching for snews table and zp_albums mixed together. Please how can I solve this?

Thanks so much!
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: jlhaslip on October 15, 2007, 02:49:43 am
Can you use phpMyadmin to confirm that there is a correct table with an appropriate prefix  in the database?
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: belfagor on October 15, 2007, 03:33:55 am
yes, I do have two separate db, one for sNews and one for ZenPhoto. I have also added a prefix in ZenPhoto tables as you can see 'zp_'
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on October 19, 2007, 12:12:39 pm
Time to finish a project...

Full integration almost complete....


Couldn't sleep really..

Anyway, snews login is sort of linked with zen.  The admin is wrapped in the default template and the admin section is in the center.  The functions are wrapped in a sNews token.  Some paths had to me made FULLWEBPATH in admin functions, and some gotchas I found which is killing me...

So full Zen functionality will not be there (admin inline editing really....), but the whole admin backend works perfectly.. some other gotchas I came across.....

Oh and I need to find where their function comments are.. gotta use the match captcha...

Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Ghassem Tofighi on November 11, 2007, 11:31:42 pm
New Version of ZenPhoto is released! please update your Mod, for this release :-)
I saw in Zenphoto trac that it will support i18n in next release, It is a very good news.
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on December 03, 2007, 02:51:50 am
Thanks Ghassem for letting me know.... I used the svn at the time that had most of the new features of zenphoto... when I have time I will try and update this mod.  For now, I think Rui's sNews gallery may be in favor of this mod. 

If some want the latest version of Zen functions to be implemented within sNews, then I will work on this mod.
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Keyrocks on December 03, 2007, 04:54:18 pm
If some want the latest version of Zen functions to be implemented within sNews, then I will work on this mod.
I'm looking forward to seeing where Rui's snewsgallery project will lead to... and whether or not it will be addable to existing packages... like my MESU, MEMU and our current Sub-Cats + Pages in Cats projects. If it doesn't turn out to be practical... then I will certainly be interested in a ZenPhoto integration with sNews.
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on December 03, 2007, 05:18:21 pm
Yes Keys, that why I mentioned Rui's gallery will be in favor of this mod, I think Rui can implement alot of the zen functionality, and the users can mod the gallery engine to include what they need...
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Ghassem Tofighi on March 23, 2008, 11:17:08 am
Hi, Did You write the mod for zenphoto 1.1 ?
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: centered on March 26, 2008, 10:43:37 pm
No but you are more than welcome to do so
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Armen on March 27, 2008, 07:41:09 am
Hi, Did You write the mod for zenphoto 1.1 ?

There's almost no difference, I checked. Just replace "zen" with "zp-core" and carefully compare zenphoto's theme php files and php function calls when replacing them with yours.
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: steerpike on September 02, 2008, 05:25:23 am
Will this MOD work in MU?
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: Keyrocks on September 02, 2008, 02:11:38 pm
Will this MOD work in MU?

I have not tried this mod approach but, after looking the steps over, I am sure it will work equally well with 1.6MU. There doesn't appear to be any mods that would affect MU-specific mods.
Title: Re: [Mod]Integrating ZenPhoto in sNews 1.6 WIP
Post by: steerpike on September 03, 2008, 02:26:46 am
I have not tried this mod approach but, after looking the steps over, I am sure it will work equally well with 1.6MU. There doesn't appear to be any mods that would affect MU-specific mods.

Great I'm gonna give it a shot when I get some time  :P