PDA

View Full Version : "Featured listings" slideshow - Simple and jQuery powered



zarathustra
03-14-2009, 12:46 PM
I've seen various threads asking for it, and not many answering, and I just had to implement one myself, so I thought I could share the code. This makes a nice fading slideshow, with a semi-translucent panel popping up from the bottom (or the top as you prefer) with the title of the listing and anything else you require. It requires no core changes and no addons.

The code is very much "made for my own project", but should be easy to adapt to your requirements.

I used the s3Slider jQuery plugin,, I only modified the CSS a little, not the script, so feel free to get the compressed version (1.6k!) from here:
http://www.serie3.info/s3slider/index.php

Instructions follow:

- Insert a link to jQuery in the head of your template, I use Google's:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

- Insert links to the script, css and initialization script for the slideshow:

<!--Featured listings slideshow -->
<link rel="stylesheet" type="text/css" href="{template_url}/css/home_slideshow.css" title="styles1" />
<script type="text/javascript" src="{template_url}/scripts/s3Slider.js"></script>

<script type="text/javascript">
$(document).ready(function() {
$('#slider').s3Slider({
timeOut: 3000
});
});
</script>


- Here's the CSS I used:



#slider {
width: 275px;
height: 206px;
position: relative;
overflow: hidden;
margin-bottom:28px;
}

#sliderContent {
width: 275px;
position: absolute;
top: 0;
margin-left: 0;
}

img.FeaturedListingSlide {
width: 275px;
height: 206px;
margin: 0px !important;
margin-bottom: 9px !important;
}

li.sliderImage {
list-style-type: none !important;
}

.sliderImage {
float: left;
position: relative;
display: none;
}

.sliderImage span {
position: absolute;
left: 0;
font: 12px Arial, Helvetica, sans-serif;
padding: 2px 10px 10px 10px;
width: 275px;
background-color: #111;
filter: alpha(opacity=80); -moz-opacity: 0.8; -khtml-opacity: 0.8; opacity: 0.8;
color: #fff;
display: none;
bottom: 0;
/*top: 0;*/
}

.sliderImage span strong {
font-size: 13px;
font-weight: bold;
display: block;
}

.clear {
clear: both;
}


You will notice I am resizing my "full image" with CSS here....I know...tut tut...but my thumbs were too small and I couldn't "upsize" them. I suppose ultimately I could get php to make 3 images upon upload, but this will do for now, and I only have four featured listings :) Now to "plumb it in"

I used the following code as my "featured_listing_horizontal.html":



{featured_listing_block}

{featured_img_block}

<li class="sliderImage">
<a href="{featured_url}"><img class="FeaturedListingSlide" src="{featured_large_src}" alt="Something SEO here" /> <span><strong>{listing_title}</strong>Featured {listing_field_property_type}</span></a>
</li>

{/featured_img_block}

{/featured_listing_block}


Then it was just a matter of inserting this into the template:



<div id="slider">

<ul id="sliderContent">
{featured_listings_horizontal}
</ul>

</div>


Of course you can style the gallery any way you like, in fact you could dump the jQuery altogether and go with something else. Ultimately the cool bit is getting the featured listings to simply display as a list. Once you have that you can style it however you like. Including of course the thing I have to do next which is to add some <noscript> content for it to fall back on. Just a single featured listing I guess :)

Well there you are. Enjoy. I'm flat out at the moment, but if you require assistance post below and I'll try to help.

Tom

awddesign
03-15-2009, 04:07 AM
Hi Tom

you missed a code that makes it all work

Also Add this code too under
- Insert links to the script and css for the slideshow:


<script type="text/javascript">
$(document).ready(function() {
$('#slider').s3Slider({
timeOut: 3000
});
});
</script>



Now to make this into an addon you would use Paul's pbflash Multiple Featured Listing Display Options
http://www.pbflash.com/listing-Multiple+Featured+Listing+Display+Options-6.html

this will help by not using the main Featured listing template but a selcted one for this code.





I've seen various threads asking for it, and not many answering, and I just had to implement one myself, so I thought I could share the code. This makes a nice fading slideshow, with a semi-translucent panel popping up from the bottom (or the top as you prefer) with the title of the listing and anything else you require. It requires no core changes and no addons.

The code is very much "made for my own project", but should be easy to adapt to your requirements.

I used the s3Slider jQuery plugin,, I only modified the CSS a little, not the script, so feel free to get the compressed version (1.6k!) from here:
http://www.serie3.info/s3slider/index.php

Instructions follow:

- Insert a link to jQuery in the head of your template, I use Google's:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

- Insert links to the script and css for the slideshow:

<!--Featured listings slideshow -->
<link rel="stylesheet" type="text/css" href="{template_url}/css/home_slideshow.css" title="styles1" />
<script type="text/javascript" src="{template_url}/scripts/s3Slider.js"></script>

- Here's the CSS I used:



#slider {
width: 275px;
height: 206px;
position: relative;
overflow: hidden;
margin-bottom:28px;
}

#sliderContent {
width: 275px;
position: absolute;
top: 0;
margin-left: 0;
}

img.FeaturedListingSlide {
width: 275px;
height: 206px;
margin: 0px !important;
margin-bottom: 9px !important;
}

li.sliderImage {
list-style-type: none !important;
}

.sliderImage {
float: left;
position: relative;
display: none;
}

.sliderImage span {
position: absolute;
left: 0;
font: 12px Arial, Helvetica, sans-serif;
padding: 2px 10px 10px 10px;
width: 275px;
background-color: #111;
filter: alpha(opacity=80); -moz-opacity: 0.8; -khtml-opacity: 0.8; opacity: 0.8;
color: #fff;
display: none;
bottom: 0;
/*top: 0;*/
}

.sliderImage span strong {
font-size: 13px;
font-weight: bold;
display: block;
}

.clear {
clear: both;
}


You will notice I am resizing my "full image" with CSS here....I know...tut tut...but my thumbs were too small and I couldn't "upsize" them. I suppose ultimately I could get php to make 3 images upon upload, but this will do for now, and I only have four featured listings :) Now to "plumb it in"

I used the following code as my "featured_listing_horizontal.html":



{featured_listing_block}

{featured_img_block}

<li class="sliderImage">
<a href="{featured_url}"><img class="FeaturedListingSlide" src="{featured_large_src}" alt="Something SEO here" /> <span><strong>{listing_title}</strong>Featured {listing_field_property_type}</span></a>
</li>

{/featured_img_block}

{/featured_listing_block}


Then it was just a matter of inserting this into the template:



<div id="slider">

<ul id="sliderContent">
{featured_listings_horizontal}
</ul>

</div>


Of course you can style the gallery any way you like, in fact you could dump the jQuery altogether and go with something else. Ultimately the cool bit is getting the featured listings to simply display as a list. Once you have that you can style it however you like. Including of course the thing I have to do next which is to add some <noscript> content for it to fall back on. Just a single featured listing I guess :)

Well there you are. Enjoy. I'm flat out at the moment, but if you require assistance post below and I'll try to help.

Tom

zarathustra
03-15-2009, 04:26 AM
How embarrassing! Thanks a million! I have edited my original post just in case anyone was following it through step by step. Naturally that bit was quite important! haha :) And the suggestion to make/amend an addon is most intriguing. I am scared of addons! But I'll look into it. Thanks again.

awddesign
03-15-2009, 04:34 AM
Hi Tom

you will be fine with pauls code, here

you just do the same thing as you did but the template will be called

featured_listing_horizontal-2.html

Ajust the addon code to reflect that by doing this


$listings = new listing_pages();
switch ($tag) {

case 'addon_multfeat_show1':
$data = $listings->renderFeaturedListings(25, 'horizontal');
break;
case 'addon_multfeat_show2':
$data = $listings->renderFeaturedListings(10, 'vertical');
break;
case 'addon_multfeat_show3':
$data = $listings->renderFeaturedListings(15, 'horizontal-2');
break;
default:
$data = '';
break;
}
return $data;
}


hope that helps :)

zarathustra
03-16-2009, 01:14 PM
Thanks for the pointers Albert, I have been wanting to get "into" addons for some time, but my php knowledge really isn't sufficient. I am graphic designer with pretensions really. I played with the code and came up with this (follows) which works (This based on Paul's original code of course).



<?php
function jslideshow_install_addon()
{
}
function jslideshow_show_admin_icons()
{
}
function jslideshow_load_template()
{
$template_array = array('addon_jslideshow_slideshow');
return $template_array;
}
function jslideshow_run_action_user_template()
{
}
function jslideshow_run_action_admin_template()
{
}
function jslideshow_run_template_user_fields($tag = '')
{
global $config;
require_once($config['basepath'].'/include/listing.inc.php');
$listings = new listing_pages();
switch ($tag) {

case 'addon_jslideshow_slideshow':
$data = $listings->renderFeaturedListings(10, 'jslideshow');
break;

default:
$data = '';
break;
}
return $data;
}


function jslideshow_display_addon_jslideshow_slideshow()
{
}
function jslideshow_display_addon_page()
{
}
function jslideshow_display_admin_page()
{
}
?>



With the above I use a template called featured_listing_jslideshow.html containing the html from my original post. The next step (I assume?) would be to plumb the javascript into it. So I tried:



function jslideshow_display_addon_link()
{
global $config, $jscript, $jscript_last;
$jscript = '<script type="text/javascript" src="' . $config['basepath'] . '/addons/jslideshow/jslideshow.js"></script>';
}


With no joy. I suspect the root of my problems lie in the fact that I have no idea what I am doing! Any jibes about buying a book on php will be ignored, since I am literally doing so, it's on order :)

Any more pointers please? Thanks a lot. Bear in mind of course I am just trying to learn/help. I have it working here fine, but there's nothing wrong with learning :)

ebmarques
03-16-2009, 01:23 PM
...So I tried:


function jslideshow_display_addon_link()
{
global $config, $jscript, $jscript_last;
$jscript = '<script type="text/javascript" src="' . $config['basepath'] . '/addons/jslideshow/jslideshow.js"></script>';
}

With no joy...

You missed a "dot":


function jslideshow_display_addon_link()
{
global $config, $jscript, $jscript_last;
$jscript .= '<script type="text/javascript" src="' . $config['baseurl'] . '/addons/jslideshow/jslideshow.js"></script>';
}


[EDITED] - You may also need to modify $config['basepath'] to $config['baseurl']

Eduardo

zarathustra
03-16-2009, 03:26 PM
Hi Eduardo.

One dot! haha. Well it's the details that help ;)

Haven't had time to test it, I am sure you are right, but thought I'd point out that I copy/pasted that line directly from the addon "demo" file (which I believe you wrote?) Here's exactly what is in it:



// Addon Specific Function
function addondemo_display_addon_link() {
global $config, $jscript, $jscript_last;
$jscript = '<script type="text/javascript" src="' . $config['basepath'] . '/addons/addondemo/javascript.js"></script>';
$jscript_last = '<script type="text/javascript" src="' . $config['basepath'] . '/addons/addondemo/javascript_last.js"></script>';
if (isset($_SESSION["users_lang"]) && $_SESSION["users_lang"] != $config['lang']) {
include($config['basepath'] . '/addons/addondemo/language/' . $_SESSION['users_lang'] . '/lang.inc.php');
} else {
unset($_SESSION["users_lang"]);
include($config['basepath'] . '/addons/addondemo/language/' . $config['lang'] . '/lang.inc.php');
}
$display = '';
$display .= $lang["langed_text"];
return $display;
}

?>



No dot? Is it a typo, or is it not needed in this example whereas I do need it? I know this isn't the place for a php lesson, but all help appreciated.

Tom

ebmarques
03-16-2009, 05:23 PM
No dot? Is it a typo, or is it not needed in this example whereas I do need it?

Tom,

As I wrote, there is a missing "dot".
You missed my post#2 at:
http://support.open-realty.org/showthread.php?t=11829

And now I realized there is a second bug at that add-on. Where you read:

$jscript .= '<script type="text/javascript" src="' . $config['basepath'] . '/addons/addondemo/javascript.js"></script>';
$jscript_last .= '<script type="text/javascript" src="' . $config['basepath'] . '/addons/addondemo/javascript_last.js"></script>';

Modify to:

$jscript .= '<script type="text/javascript" src="' . $config['baseurl'] . '/addons/addondemo/javascript.js"></script>';
$jscript_last .= '<script type="text/javascript" src="' . $config['baseurl'] . '/addons/addondemo/javascript_last.js"></script>';


Eduardo

zarathustra
03-17-2009, 04:20 AM
Ah I see. Thanks Eduardo. Please be aware that I downloaded the incorrect version directly from the support docs page. It really should get replaced :) Thanks again, I will try this today and post back with the results.

dafsport
03-17-2009, 09:20 AM
Ok. Nice feature. It would be cool to have the complete code. I followed the above details. However, nothing displays!

zarathustra
03-17-2009, 09:32 AM
I´m sure it´s just the way I´m reading your comment that makes it seem so ungrateful? The code is complete, it works for me. If you try to me in detail what the problem is I coult try to help. Start by examining your source code. Are the featured listings actually being displayed (in a list) and hidden by the css? That would mean the javascript isn´t working. Are they being displayed at all? Have you remembered to actually "feature" some listings?

Try disabling css. Can you see them now? etc.

ebmarques
03-17-2009, 11:02 AM
... Please be aware that I downloaded the incorrect version directly from the support docs page. It really should get replaced :) ...
Another mistake from you... :)
You didn't download the add-on you mentioned above at support docs page. At DOCs you can download the FRAMEWORK add-on. The add-on I wrote, named ADDONDEMO you can download from the Forum and my Website only.
So there is nothing to be replaced.

Eduardo

zarathustra
03-17-2009, 12:02 PM
:( Got me frameworks and demos all mixed up! haha.

dafsport
03-17-2009, 01:20 PM
zarathustra - it's just the way you're reading it! Kudos are in order. I like your slideshow feature a lot!!!!

I'm sure that I'm doing something wrong. So your guidance is much appreciated. I'm not scared to dive in this php thingy!

I'd post what I did here. But I prefer not to confuse the process any further. You could PM me the pertinent files and I'll figure it out from there.

Thanks :-)



I´m sure it´s just the way I´m reading your comment that makes it seem so ungrateful? The code is complete, it works for me. If you try to me in detail what the problem is I coult try to help. Start by examining your source code. Are the featured listings actually being displayed (in a list) and hidden by the css? That would mean the javascript isn´t working. Are they being displayed at all? Have you remembered to actually "feature" some listings?

Try disabling css. Can you see them now? etc.

Mchernoff
03-17-2009, 02:51 PM
Can anyone share the successful implementation of the aforementioned jquery feature with o-r?

It would be greatly appreciated.

zarathustra
03-17-2009, 03:10 PM
Thanks for the note dafsport. There aren't any files to pm really, I posted all the code related to it here. If it's not working then I guess it's always possible I forgot a chunk! Since I posted the thread after I had already successfully implemented it here.

There are a lot of things that could go wrong. Jquery could be clashing with another library on your site...anything...it's impossible for me to tell. But anyone having trouble should follow my earlier advice and look at their source code to see if the list of images is being rendered. Once that happens then the css hides all the pictures...then...the javascript reveals them one at a time. So it should be pretty easy to troubleshoot. Especially if you have FireBug installed, or if you disable/enable css/javascript. You should see the problem.

The way I described it should cover it, I can't imagine I missed anything...


Include a link to jQuery (obviously)
Include a link to the slider javascript file (I post the entire thing below)
Include a link to the css file.
Initialise the script with the script I originally left out (!)
Put the code I posted in your "featured_listing_horizontal.html" file (replacing entirely any current code)
Insert the code I posted into your template where you want the slideshow to appear.
Check you have some featured listings(!)


To troubleshoot:

Check your source code. Do you have a list of featured listings?
If you do then disable css and you should see them too.
You have a problem with the script



If you don't have a list of images then:
You have no featured listings?
...erm...!


Good luck! :)

Lastly here is the entire s3Slider.js file. Just in case I modified it and forgot! (I don't think so)



/* ------------------------------------------------------------------------
s3Slider

Developped By: Boban Karišik -> http://www.serie3.info/
CSS Help: Mészáros Róbert -> http://www.perspectived.com/
Version: 1.0

Copyright: Feel free to redistribute the script/modify it, as
long as you leave my infos at the top.
------------------------------------------------------------------------- */


(function($){

$.fn.s3Slider = function(vars) {

var element = this;
var timeOut = (vars.timeOut != undefined) ? vars.timeOut : 7500;
var current = null;
var timeOutFn = null;
var faderStat = true;
var mOver = false;
var items = $("#" + element[0].id + "Content ." + element[0].id + "Image");
var itemsSpan = $("#" + element[0].id + "Content ." + element[0].id + "Image span");

items.each(function(i) {

$(items[i]).mouseover(function() {
mOver = true;
});

$(items[i]).mouseout(function() {
mOver = false;
fadeElement(true);
});

});

var fadeElement = function(isMouseOut) {
var thisTimeOut = (isMouseOut) ? (timeOut/2) : timeOut;
thisTimeOut = (faderStat) ? 10 : thisTimeOut;
if(items.length > 0) {
timeOutFn = setTimeout(makeSlider, thisTimeOut);
} else {
console.log("Poof..");
}
}

var makeSlider = function() {
current = (current != null) ? current : items[(items.length-1)];
var currNo = jQuery.inArray(current, items) + 1
currNo = (currNo == items.length) ? 0 : (currNo - 1);
var newMargin = $(element).width() * currNo;
if(faderStat == true) {
if(!mOver) {
$(items[currNo]).fadeIn((timeOut/6), function() {
if($(itemsSpan[currNo]).css('bottom') == 0) {
$(itemsSpan[currNo]).slideUp((timeOut/6), function() {
faderStat = false;
current = items[currNo];
if(!mOver) {
fadeElement(false);
}
});
} else {
$(itemsSpan[currNo]).slideDown((timeOut/6), function() {
faderStat = false;
current = items[currNo];
if(!mOver) {
fadeElement(false);
}
});
}
});
}
} else {
if(!mOver) {
if($(itemsSpan[currNo]).css('bottom') == 0) {
$(itemsSpan[currNo]).slideDown((timeOut/6), function() {
$(items[currNo]).fadeOut((timeOut/6), function() {
faderStat = true;
current = items[(currNo+1)];
if(!mOver) {
fadeElement(false);
}
});
});
} else {
$(itemsSpan[currNo]).slideUp((timeOut/6), function() {
$(items[currNo]).fadeOut((timeOut/6), function() {
faderStat = true;
current = items[(currNo+1)];
if(!mOver) {
fadeElement(false);
}
});
});
}
}
}
}

makeSlider();

};

})(jQuery);

dafsport
03-17-2009, 03:14 PM
I'll give it one more try. Did you make this as a addon?

ebmarques
03-17-2009, 04:52 PM
Did you make this as a addon?

I did. I am sending a zip file to "zarathustra" once he deserves all credits - this way, he will be able (it will be up to him) to publish the add-on at the "Addon Releases (FREE)" Forum.

[EDITED] File sent.

Eduardo

dafsport
03-17-2009, 05:00 PM
Ok.. Thanks for the details - appreciate that. I'm now seeing the fruits of my labor - slideshow is showing the featured listings. Just need to make some adjustments in the css file.

Again - Thanks!

dafsport
03-17-2009, 05:02 PM
Very nice Eduardo! Thanks for your efforts!!!


I did. I am sending a zip file to "zarathustra" once he deserves all credits - this way, he will be able (it will be up to him) to publish the add-on at the "Addon Releases (FREE)" Forum.

Eduardo

zarathustra
03-17-2009, 05:52 PM
Hi all,

Many thanks to Eduardo for achieving what I could not, and converting this to an addon. I had been playing around earlier this evening, and I still couldn't get the addon to call the javascript, so I can't wait to see how he did it! I will, of course, post it in the addons in the morning (it's late here in Spain) but I am reluctant to take any of credit that Eduardo mentioned, since basically I used someone elses javascript, and matched it with Paul's addon code, which Eduardo then made work! haha. Well, I guess I was the "director" haha. :) Well, the end result is good, and that's all that counts.

I'll check it all out in the morning. Eduardo, actually it may be easiest if you post the addon yourself, you have a page already with addons, so that will be fine. Besides, you wrote the addon not me!

Thanks again, Tom.

zarathustra
03-18-2009, 03:59 AM
Have pm'ed you Eduardo with some very minor changes to your excellent code. Include them if you wish. I look forward to seeing it on your site for download :)

Tom

ebmarques
03-18-2009, 01:20 PM
Have pm'ed you Eduardo with some very minor changes to your excellent code. Include them if you wish. I look forward to seeing it on your site for download :) Tom

Ok, I saw your changes and they are fine!
I am waiting you to post the add-on at the forum so I will be posting at my Website.
If you wish to use the "new version" you can download from the link I am sending with a new PM.

Eduardo

Kaiser Nicolai
03-19-2009, 12:20 AM
Sorry to interrupt, but has this been released as an addon yet??? I am interested in using these on my sites :)

zarathustra
03-19-2009, 03:45 AM
No problem. Yes it has, yesterday, but is still awaiting moderation. I explain it in a little more detail in the addon release post as well. I assume it will appear shortly, in the free addon releases section. :)

awddesign
03-19-2009, 03:47 AM
Hi Tom

Look forward to seeing your 1st Addon :)

Hope you had fun making it.

Al



No problem. Yes it has, yesterday, but is still awaiting moderation. I explain it in a little more detail in the addon release post as well. I assume it will appear shortly, in the free addon releases section. :)

zarathustra
03-19-2009, 07:13 AM
Thanks Al, I wish it was "mine" but, as explained in the notes accompanying it, it was Eduardo who did all the heavy lifting! But don't worry, I have plenty of ideas and a php book on the way from Amazon haha.

zarathustra
03-20-2009, 07:22 AM
Hi all. It's been three days in moderation at the free addon release forum? Is that normal? Is it lost? Should I post it again? Eduardo...do you have forum admin privileges? :)

Kaiser Nicolai
03-20-2009, 10:14 AM
I doubt it is normal to wait three days to approve a addon, in any case I think you should PM pbflash or the moderators, I cant wait to use this addon

Kaiser Nicolai
03-22-2009, 02:41 AM
Downloaded the addon and tested it in a clean install of 2.5.6, it didnt work, It even seemed that the text wasnt added at all, what I did I used the editor, edited the main page (adding the addon tag and installing according instructions), and upon checking neither the script, nor the css, nor the display text were added at all

northernpenguin
03-23-2009, 04:52 PM
I testing this addon also and had the same results until I noticed that the zip file does NOT create the s3Slider directory in addons! If you manually create addons/s3Slider then move the files to the directory, everything works!

Kaiser Nicolai
03-23-2009, 09:14 PM
I testing this addon also and had the same results until I noticed that the zip file does NOT create the s3Slider directory in addons! If you manually create addons/s3Slider then move the files to the directory, everything works!Indeed, renamed the directory and now everything works, I am currently checking the widths and everything of the slideshow, this is something I've been looking for quite some time, have to modify the css code and everything

zarathustra
03-24-2009, 06:04 AM
Sorry for the confusion with the folder missing, as pb mentions on the addon release page here: http://support.open-realty.org/showthread.php?t=20825 You need to make the folder "s3Slider" inside your addons folder, then add all the files from the zip into there. :)

ebmarques
03-24-2009, 12:39 PM
Sorry for the confusion with the folder missing, as pb mentions on the addon release page here: http://support.open-realty.org/showthread.php?t=20825 You need to make the folder "s3Slider" inside your addons folder, then add all the files from the zip into there. :)

In fact, that was MY fault. I created the zip file and did not realize it was not going to create the folder. The same for the other add-on I posted at:
http://support.open-realty.org/showthread.php?t=20815
Please note the warning about the need to create the respective folder.
Sorry for the trouble!

Eduardo

marriosuffy
04-29-2009, 07:26 AM
MODERATED - This is not a real estate help forum. It is for help with the Open Realty script.

LeadingEdgeRealty
06-21-2009, 01:42 PM
www.leronline.com (http://www.leronline.com)

I've got the image+text positioned properly in IE, and the text positioned properly in Firefox but not the image...can you please tell me what/how I modify in the css to correct this?:confused:



#slider {
width:175px;
height:125px;
position:relative;
overflow:hidden;
margin-bottom:0px;
}
#sliderContent {
width:175px;
position:left;
top:0;
margin-left:0;
}
img.FeaturedListingSlide {
width:138px;
height:100px; /*This is a proportionally scaled down 500 by 275*/
margin:0px !important;
margin-bottom:9px !important;
-ms-interpolation-mode:bicubic; /*Makes it resize much more smoothly in IE*/
}
li.sliderImage {list-style-type:none !important;}
.sliderImage { /*(The actual image)*/
position:left; /* changed from relative ****/
display:none; /*This gets toggled by the script*/
}
.sliderImage span { /*(The caption, and its background)*/
position:absolute; /* changed from absolute ****/
left:0;
font:10px Arial, Helvetica, sans-serif;
padding:2px 2px 2px 2px;
width:138px;
background-color:#111;
filter:alpha(opacity=80); -moz-opacity:0.8; -khtml-opacity:0.8; opacity:0.8;
color:#fff;
display:none; /*This gets toggled by the script*/
bottom:0;
}
.sliderImage span strong { /*The title in the caption*/
font-size:10px;
font-weight:bold;
display:block; /*Makes the caption display on two lines*/
}
.clear {clear:both;}

zarathustra
06-22-2009, 04:37 AM
Hi, The fault I am afraid is not with the CSS above per se, but with other CSS on your site (and as we will see...the css NOT on your site! ;). The "C" bit of course stands for "Cascading" which is exactly what is happening here.

This is fairly obvious because the slideshow image has a five pixel margin and an orange border amongst other things. That particular bit it is inheriting from the fact that you put this:

img
border:1px solid #FF9933;
margin-bottom:2px;
padding:6px;
}

on line 18. There is more from your padding in .blokbox div.blokcontent and elsewhere

However the worst offender is the 40px of left hand margin that Firefox (Haven't checked IE...but it's likely different...and worse!) is giving to your ul tags.

That is because you are not using any kind off css reset file which is an absolute recipe for disaster. You must reset your ul to 0 before you start.

If you require any further help, please pm me.

Tom

Kaiser Nicolai
11-07-2009, 07:26 AM
I am having a problem with this addon, site:ainvercon, firefox and internet explorer, the image that slides is always the same, I refresh the site and the slide changes but with only 2 featured listings, it should cycle them, not present the same one over and over, I am at a loss here, any help???

Biscuit
12-14-2009, 07:46 PM
I *love* this addon! It's almost exactly what my client had requested. The only change I need to find how to do (or if it's not possible, please let me know) if to filter the results by property class.

I understand how to filter based on class from a search link, etc...but I've spent days trying to test different methods, combing through every related forum post, and yes...even reading the documentation,etc...to no avail.

This section:

require_once($config['basepath'].'/include/listing.inc.php');
$listings = new listing_pages();

pulls in the listings, but I'm nothing I've tried (or found to try) will filter them from that point. I've tried additional MySQL queries,


$sold_prop = "SELECT class_id, listingsdb_id FROM " . $config['table_prefix'] . "classlistingsdb WHERE (listingsdb_id = $listingID AND `class_id = `7`)";
$recordSet = $conn->Execute($sold_prop);

but nothing is working. I've written PHP/MySQl for years, but I've very green to OR. Any help (without saying "Oh, that's easy" and leaving it at that, which isn't helpful at all) would be greatly appreciated.

pbflash
12-14-2009, 08:08 PM
require_once($config['basepath'].'/include/listing.inc.php');
$listings = new listing_pages();

This does not pull in the listings. The listing_pages class holds many different functions.

This line pulls in the featured listings:

$display .= $listings->renderFeaturedListings($max_number_of_listings,'s3 Slider');

Change that line to:

$display .= $listings->renderFeaturedListings($max_number_of_listings, 's3Slider',FALSE, CLASSID)

Replace CLASSID with the property class you want to show or look at the attached addon.inc.php file. You'll see I added 2 more template tags and modified it slightly so you can pass the pclass id to the function that generates the display. You can add more tags if you want 1 for each of your property classes.

I didn't test it but it should work.

Biscuit
12-14-2009, 08:19 PM
require_once($config['basepath'].'/include/listing.inc.php');
$listings = new listing_pages();

This does not pull in the listings. The listing_pages class holds many different functions.

This line pulls in the featured listings:

$display .= $listings->renderFeaturedListings($max_number_of_listings,'s3 Slider');


Ahhhh cool, good to know!



Change that line to:

$display .= $listings->renderFeaturedListings($max_number_of_listings, 's3Slider',FALSE, CLASSID)

Replace CLASSID with the property class you want to show or look at the attached addon.inc.php file. You'll see I added 2 more template tags and modified it slightly so you can pass the pclass id to the function that generates the display. You can add more tags if you want 1 for each of your property classes.

I didn't test it but it should work.

Awesome, thank you, You're da bomb! I'll test it and report back, for the benefit of anyone else searching for this. I've seen several people ask for variations of this, but never found a solution.

Biscuit
12-16-2009, 12:21 AM
Well, it's not working...but I'm going through each part to find why. It's probably something simple, and I've just been looking at it too long.

pbflash
12-16-2009, 12:34 AM
Just saying it's not working doesn't give us anything to try and help. Do you get any errors? Did you use the file I attached to my last post or did you modify the existing file you had? Provide some more info so we can try to help troubleshoot the problem.

Biscuit
12-16-2009, 01:38 AM
Just saying it's not working doesn't give us anything to try and help. Do you get any errors? Did you use the file I attached to my last post or did you modify the existing file you had? Provide some more info so we can try to help troubleshoot the problem.

I know it's not helpful what I posted...I should have waited until I had more info. Sorry, I hate when people do that to me! ...I guess it was my way of saying "Hang on a sec" to anyone else who was trying to use the file as is and it wasn't working for them.

I got it working by defining the function for each option. It's very possible the $pclass you gave was meant as pseudo-code to be replaced by the actual class ID, I just wasn't sure.

I defined each as a function (in my case I only need two, for class id 1 and 7):



// Addon Specific Function
function s3Slider_show1() {
global $config, $jscript, $jscript_last;
$jscript .= '<script type="text/javascript" src="' . $config['baseurl'] . '/addons/s3Slider/js/jquery.min.js"></script>' . "\r\n";
$jscript .= '<script type="text/javascript" src="' . $config['baseurl'] . '/addons/s3Slider/js/s3Slider.js"></script>' . "\r\n";
$jscript_last .= '
<script type="text/javascript">
$(document).ready(function() {
$(\'#slider\').s3Slider({
timeOut: 3000
});
});
</script>' . "\r\n";
require_once($config['basepath'].'/include/listing.inc.php');
$listings = new listing_pages();
$display = '';
$display .= '
<div id="slider">
<ul id="sliderContent">';
// modify as you wish:
$max_number_of_listings = 5;
// it is set to use "featured_listing_s3Slider.html" template file:
$display .= $listings->renderFeaturedListings($max_number_of_listings,'s3 Slider',FALSE,1);
$display .= '
</ul>
</div>';
return $display;
}

function s3Slider_show7() {
global $config, $jscript, $jscript_last;
$jscript .= '<script type="text/javascript" src="' . $config['baseurl'] . '/addons/s3Slider/js/jquery.min.js"></script>' . "\r\n";
$jscript .= '<script type="text/javascript" src="' . $config['baseurl'] . '/addons/s3Slider/js/s3Slider.js"></script>' . "\r\n";
$jscript_last .= '
<script type="text/javascript">
$(document).ready(function() {
$(\'#slider\').s3Slider({
timeOut: 3000
});
});
</script>' . "\r\n";
require_once($config['basepath'].'/include/listing.inc.php');
$listings = new listing_pages();
$display = '';
$display .= '
<div id="slider">
<ul id="sliderContent">';
// modify as you wish:
$max_number_of_listings = 5;
// it is set to use "featured_listing_s3Slider.html" template file:
$display .= $listings->renderFeaturedListings($max_number_of_listings, 's3Slider',FALSE,7);
$display .= '
</ul>
</div>';
return $display;
}


The one thing I can't get working (so far) is to have one slideshow of class ID 1 and one of class ID 7 both on the same page. I use the correct template tags:


{addon_s3Slider_show1} and {addon_s3Slider_show7}

and either one with display fine...but not both. I'm still working on it though. I know I can always divide it into 2 addons, which wouldn't be a very elegant solution, but would get the job done. I'm still unsure of how (or rather which) variables are passed in OR...that may take me a while.

I really appreciate your help pbflash, thanks!

pbflash
12-16-2009, 01:09 PM
Not sure why it's not working right by using 1 function and passing the pclass id to he function based on the tag used. It's probably something simple I missed and I haven't had a chance to test it.

The problem with showing 2 on 1 page could be because you're loading the js files twice which could cause problems. It could also be the fact that the js uses an ID on the div and ul. ID's should be unique. When you try to display it twice on 1 page, you have 2 div's and 2 ul's with the same ID. You can change the js to use a class instead of an ID.

Change

$(\'#slider\').s3Slider({

to

$(\'div.slider\').s3Slider({

And then change the ID in the div to class.

pbflash
12-16-2009, 02:04 PM
It may be better to give the second function it's own ID like slider2. Then change the js from:

$(document).ready(function() {
$(\'#slider\').s3Slider({
timeOut: 3000
});
});

to:

$(document).ready(function() {
$(\'#slider\').s3Slider({
timeOut: 3000
});
$(\'#slider2\').s3Slider({
timeOut: 3000
});
});

Then change the css to include settings for #slider2.

Biscuit
12-16-2009, 07:53 PM
It may be better to give the second function it's own ID like slider2. Then change the js from:

$(document).ready(function() {
$(\'#slider\').s3Slider({
timeOut: 3000
});
});

to:

$(document).ready(function() {
$(\'#slider\').s3Slider({
timeOut: 3000
});
$(\'#slider2\').s3Slider({
timeOut: 3000
});
});

Then change the css to include settings for #slider2.

I tried that (and about 40 variations of things that also haven't worked). From reading the documentation of the original JQuery ps3Slider plugin, it *should* work with mutiple ID's, as long as the ID starts with "slider" (i.e.- "#slider1, #slider2).

The part of my brain that holds Javascript syntax seems to be on early holiday, which isn't helping ;-/

I tried echo'ing "$pclass" and I'm not getting anything, though when I use the class_id's as per your example, that works.

I really appreciate your help on this! I'll keep at it until I find a combination that works.

pbflash
12-16-2009, 10:23 PM
Did you try removing the call to the jquery files from the second function? You have both functions loading the jquery files and some browsers have problems with that.

Biscuit
12-16-2009, 10:59 PM
Did you try removing the call to the jquery files from the second function? You have both functions loading the jquery files and some browsers have problems with that.

Yes, I did. I've got it soooo close. Both slideshows are technically displaying on the page (and it validates), and both are pulling from the correct property classes.

The only problem I'm having now is the second slideshow's code is "displaying" right behind/after the first slideshow. Meaning I can see it in the source, but it's not showing on the page. I've tried putting the div's directly on the template, and then in the addon.inc.php script.

I have 2 different div id's, using the correct tags ( 2 different tags for each of the slideshows). I'd post a link if it was my site, but it's for a client.

Here the code I've got so far (if you have time to look at it). I just have this feeling I'm missing something obvious.

addon.inc.php:

<?php
/* snipped credits just to save space for purposes of forum posting only */
/*
s3Slider ADDON - Version 1.1 - March/2009
@author "zarathustra" (Tom)
@link http://support.open-realty.org/showthread.php?t=20788
Adapted to an add-on by Eduardo Marques <ebmarques at gmail dot com>
*/

function s3Slider_install_addon() {
// NOT NEEDED
}
/*
show_admin_icons()
*/
function s3Slider_show_admin_icons() {
// NOT NEEDED
}
/*
load_template()
*/
function s3Slider_load_template() {
$template_array = array('addon_s3Slider_show1', 'addon_s3Slider_show7');
return $template_array;
}
/*
run_action_user_template()
*/
function s3Slider_run_action_user_template() {
switch ($_GET['action']) {
default:
$data = '';
break;
}
return $data;
}

/*
run_action_admin_template()
*/
function s3Slider_run_action_admin_template() {
switch ($_GET['action']) {
default:
$data = '';
break;
}
return $data;
}

/*
run_template_user_fields()
*/
function s3Slider_run_template_user_fields($tag = '') {
switch ($tag) {
case 'addon_s3Slider_show1':
$data = s3Slider_show(1); // ADD-ON TAG: {addon_s3Slider_show}
break;
case 'addon_s3Slider_show7':
$data = s3Slider_show(7); // ADD-ON TAG: {addon_s3Slider_show}
break;
default:
$data = '';
break;
}
return $data;
}

// Addon Specific Function
function s3Slider_show() {
global $config, $jscript, $jscript_last;
$jscript .= '<script type="text/javascript" src="' . $config['baseurl'] . '/addons/s3Slider/js/jquery.min.js"></script>' . "\r\n";
$jscript .= '<script type="text/javascript" src="' . $config['baseurl'] . '/addons/s3Slider/js/s3Slider.js"></script>' . "\r\n";
$jscript_last .= '
<script type="text/javascript">
$(document).ready(function() {
$(\'#slider\').s3Slider({
timeOut: 3000
});
});
$(document).ready(function() {
$(\'#slider7\').s3Slider({
timeOut: 3000
});
});
</script>' . "\r\n";
require_once($config['basepath'].'/include/listing.inc.php');
$listings = new listing_pages();
$display = '';
// modify as you wish:
$max_number_of_listings = 5;
// it is set to use "featured_listing_s3Slider.html" template file:
$display .='<div class="clear"></div>';
$display .='<div id="slider">';
$display .= $listings->renderFeaturedListings($max_number_of_listings,'s3 Slider',FALSE,1);
$display .= '</div>';

$display .='<div class="clear"></div>';
$display .='<div id="slider7">';
$display .= $listings->renderFeaturedListings($max_number_of_listings,'s3 SliderSold',FALSE,7);
$display .= '</div>';
return $display;
}
?>

featured_listing_s3Slider.html (template for slideshow1 / class1)


<!-- bof "featured_listing_s3Slider.html" -->
<ul id="sliderContent">
{featured_listing_block}
{featured_img_block}
<li class="sliderImage"><a href="{featured_url}"><img class="FeaturedListingSlide" src="{featured_large_src}" alt="Current Properties Available" /> <span><strong>{listing_title} <br />{listing_field_address_value}</strong>{listing_pclass}</span></a></li>
{/featured_img_block}
{/featured_listing_block}
<li class="clear s3sliderImage"></li>
</ul>
<!-- eof "featured_listing_s3Slider.html" -->


featured_listing_s3SliderSold.html 9template for slideshow7 class 7)


<!-- bof "featured_listing_s3SliderSold.html" -->
<ul id="sliderContent7">
{featured_listing_block}
{featured_img_block}
<li class="sliderImage"><a href="{featured_url}"><img class="FeaturedListingSlide" src="{featured_large_src}" alt="Recently Sold Properties" /> <span><strong>{listing_title} <br />{listing_field_address_value}</strong>{listing_pclass}</span></a></li>
{/featured_img_block}
{/featured_listing_block}
<li class="clear s3sliderImage"></li>
</ul>
<!-- eof "featured_listing_s3SliderSold.html" -->


(And of course there's the appropriate CSS).

Generated source:


<div class="featlist"> <div class="clear"></div>
<div id="slider">
<!-- bof "featured_listing_s3Slider.html" -->
<ul id="sliderContent">
<li class="sliderImage"><a href="index.php?action=listingview&amp;listingID=3"><img class="FeaturedListingSlide" src="http://[domain].com/or/images/listing_photos/3_1.jpg" alt="Current Properties Available" /> <span><strong>Name <br />Address</strong>Single Family Homes</span></a></li>
<li class="clear s3sliderImage"></li>
</ul>
<!-- eof "featured_listing_s3Slider.html" -->
</div>

<div id="slider7">
<!-- bof "featured_listing_s3SliderSold.html" -->
<ul id="sliderContent7">
<li class="sliderImage"><a href="index.php?action=listingview&amp;listingID=2"><img class="FeaturedListingSlide" src="http://[domain].com/or/images/listing_photos/2_1.jpg" alt="Recently Sold Properties" /> <span><strong>Name <br />Address</strong>Sold</span></a></li>
<li class="clear s3sliderImage"></li>
</ul>
<!-- eof "featured_listing_s3SliderSold.html" -->
</div>
[code]

And the template for the page, abbreviated version:
[code]
<div class="featlist">
{addon_s3Slider_show1}
</div>

... lots of stuff here, center column...

<div class="soldlist">
{addon_s3SliderSold_show7}
</div>


So, if I had to, I could generate all the center "lots of stuff here" but PHP adding it into the addon.inc.php....but I'd really, really not have to do that.

The problem is the {addon_s3SliderSold_show7} isn't displaying where it should be.

Caught that error....the correct 2nd template tag is: {addon_s3Slider_show7}. Still no joy.

czaras
12-17-2009, 07:06 AM
I rewrite the request which already was given by someone: can you please provide some link presenting this add-on ? Neither here nor on add-on's thread can't find any of it.

Biscuit
12-18-2009, 12:26 AM
I rewrite the request which already was given by someone: can you please provide some link presenting this add-on ? Neither here nor on add-on's thread can't find any of it.

I haven't seen anyone ask where this addon was in this thread since last March...but it's in the addon(free) forum. Here's the link to the thread:

http://support.open-realty.org/showthread.php?t=20825&highlight=s3slider

czaras
12-18-2009, 07:24 AM
I haven't seen anyone ask where this addon was in this thread since last March...but it's in the addon(free) forum. Here's the link to the thread:

http://support.open-realty.org/showthread.php?t=20825&highlight=s3slider
As I wrote ;) even there you can't find any link to see how this add-on looks like.

pbflash
12-18-2009, 08:49 AM
As I wrote ;) even there you can't find any link to see how this add-on looks like.
Not everyone has a site where they can demo their addons. Especially the free ones. In a lot of cases they are created for their site or a clients site and they don't want to post a link to the site in the forum. Feel lucky that they were generous enough to share the addon with you for free.

It only take about 5 minutes to install an addon so it's not that hard for you to add it to your site to see what it does and how it looks.

awddesign
12-18-2009, 08:52 AM
Hi

ok just for you I have added a demo for you to see here:
http://demo.open-realty.co.uk/open-realty_addons/index.php?action=page_display&PageID=412

I have not used the "featured_listing_s3Slider.html" just the standard featured_listing template.

I will need to look into this again as the the addon needs to call that template "featured_listing_s3Slider.html" from the addon file. Tha would make it better :)




As I wrote ;) even there you can't find any link to see how this add-on looks like.

pbflash
12-18-2009, 11:40 AM
I will need to look into this again as the the addon needs to call that template "featured_listing_s3Slider.html" from the addon file. Tha would make it better
Since the addon uses OR's built in featured listings function, the template must be in the template folder. In order to change that you would need to copy the featured listings function into the addon and modify it. Then the addon would need to be updated with each OR release where there may be changes that affect the operation of that function. Much easier to maintain the way it is now.

Biscuit
12-18-2009, 02:09 PM
Feel lucky that they were generous enough to share the addon with you for free.

Well said!

czaras
12-19-2009, 01:20 PM
Hi

ok just for you I have added a demo for you to see here:
http://demo.open-realty.co.uk/open-realty_addons/index.php?action=page_display&PageID=412

Thx a lot ! I wouldn't ask for demo but I've seen a few posts regarding some issues with this add-on, so I hope you don't hang me for that I wanted to save some time ;)

Biscuit
12-20-2009, 09:20 PM
Thx a lot ! I wouldn't ask for demo but I've seen a few posts regarding some issues with this add-on, so I hope you don't hang me for that I wanted to save some time ;)

I don't want to beat a dead horse, but it only takes a few minutes to install and test. There have been a few addons I've tried that simply didn't work. If they were commercial/paid addons, I'd expect support. But the free ones are a different story.

I'm very thankful PBFlash was willing to take the time to make suggestions on what I could try to troubleshoot. He's not the "addon author of record", though I believe he helped along the way, and has written similar addons (in addition to MANY other addons).

I didn't have ANY issues with this addon, using it as it was intended to be used. My issue is I'm trying (or rather was trying) to modify it to display two slideshows on the same page. And for anyone who thinks "What a stupid idea, two slideshows on the same page"...I so totally agree. The client is insisting on it, against my recommendation. *shrugs*

FYI: In most forums, if you've done your homework and tried *first*, someone will help you. In this case, awddesign went above and beyond with the Holiday spirit. :)

stanhook
03-18-2010, 05:15 PM
Hi,

I installed this addon and I can't see the slideshow. When I view source all of the code for the addon is there, I can test the links by clicking in the "view source" page and it all works. But I don't see anything on the actual page.

Any thoughts?

Thanks,

Stan

stanhook
03-19-2010, 01:43 PM
I found my issue. I did not have {load_js_last} on my template at all. I placed it just before the body tag and it works. It's just not rotating the images even-though I see them in the source. A little more digging....

Stan