Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: Listings Manager Add-ons:
Random Listings Script

 

First page Previous page 1 2 Next page Last page  View All


mbodamer
User

Mar 27, 2006, 8:45 PM

Post #26 of 50 (39304 views)
Shortcut
Re: [cclinton] Random Listings Script [In reply to] Can't Post

I checked out your random.php file and it is identicle to mine except for the following:

You have:

<?php echo $listing_num[16];?><br>
&nbsp;<?php echo $listing_num[15]." ".$listing_num[17];?><br>
&nbsp;<?php echo $listing_num[19];?>

I Have:

<?php echo $listing_num[14];?><br>
&nbsp;<?php echo $listing_num[16]." ".$listing_num[17];?><p align=center>
&nbsp;<?php echo $listing_num[19];?>

Which is basically only the listing field numbers that is different. So base don what you have posted I do not see a problem in your script. Like I said mine is exactly the same. So with that script like that all I did was place the random.php file in my root directory and I created my index file and simply made sure it was an .shtml file. Then I placed the include random.php file and voila.

please post more info as to whats happening. Went to your site and tried to run the random.php by itself and all I get is the number 1,2,3 etc.

One other thing I noticed was that my file had the normal <html> tags and yours did not. After teh script you go right into the <table> tag. I am not sure but mine has <html><body><table> then after everything it closes the tags.

Perhaps you need them in there?



****************** UPDATED *****************

I did notice one other thing... you have:

<img src="http://s119129017.onlinehome.us/testing/March06/listman/listings/images/<?php echo $listing_num[5];?>" border="0" width="120">

I have:

<img src="www.sitename.com/listings/images/<?php echo $listing_num[4];?>" border="0" width="120">

I think thats your problem :-)


(This post was edited by mbodamer on Mar 28, 2006, 9:38 PM)


mbodamer
User

Mar 28, 2006, 9:47 PM

Post #27 of 50 (39253 views)
Shortcut
Re: [mbodamer] Random Listings Script [In reply to] Can't Post

Heck here is mine... it works fine for me... maybe just copy and paste this one and then change teh paths....
Attachments: random.php (1.58 KB)


mbodamer
User

Mar 28, 2006, 9:56 PM

Post #28 of 50 (39251 views)
Shortcut
Re: [mbodamer] Random Listings Script [In reply to] Can't Post

Are you sure the path to you dat.cgi file is correct? other then that I am at a loss. your file is identicle to mine expect for those changes, and since your install of LM doesnt follow the normal directory structure I can't tell if you have your paths right.

hope something here helps.


cclinton
User

Apr 4, 2006, 10:38 AM

Post #29 of 50 (39130 views)
Shortcut
Re: [mbodamer] Random Listings Script [In reply to] Can't Post

I just figured it out. Random.php did not like my external links. I changed the full links to simple stepping links and bingo.


cclinton
User

Apr 4, 2006, 1:32 PM

Post #30 of 50 (39125 views)
Shortcut
Re: [mbodamer] Random Listings Script [In reply to] Can't Post

next problem - my default image for when there is no image is not working. I get a blank space where the image should be.

I attached the new random.php file.

Have you found any reasons why the particular image would need to be placed in another folder?
Attachments: random.php (1.44 KB)


ross
Staff / Moderator


Apr 5, 2006, 11:10 AM

Post #31 of 50 (39073 views)
Shortcut
Re: [cclinton] Random Listings Script [In reply to] Can't Post

Hi Don.

While I don’t really know a whole lot about the script you are working with here, one thing I have found works really well when there is the possibility of broken images is the onError attribute. Basically, if you through that in your image tag with the path to a default image on your site, you’ll never have broken images. Here’s what it would look like:

<img src=/images/image1.gif onError=/images/default_image.gif>

Does that seem like it would help here? Let me know what you think Smile.
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.




cclinton
User

Apr 5, 2006, 11:26 AM

Post #32 of 50 (39072 views)
Shortcut
Re: [ross] Random Listings Script [In reply to] Can't Post

I tried and it still comes up as a blank. Bummer...Any other ideas?


Donna
Staff / Moderator


Apr 5, 2006, 5:41 PM

Post #33 of 50 (39061 views)
Shortcut
Re: [cclinton] Random Listings Script [In reply to] Can't Post

Hi there,

Can you let us know where your website is? I wouldn't mind taking a look at it so I can see what's actually being output in the code. I'm not familiar with the script in question, but I might be able to give some advice based on the output...

Donna


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.


cclinton
User

Apr 5, 2006, 5:48 PM

Post #34 of 50 (39060 views)
Shortcut
Re: [Donna] Random Listings Script [In reply to] Can't Post

Sorry, I figured it out and forgot to add an update. The problem was that I was attempting to link to an image in another location on the site. I had to add this image to the image folder in the listings folder, make sure it wasn't pointing to the wrong image, and then it worked fine.


Donna
Staff / Moderator


Apr 5, 2006, 5:55 PM

Post #35 of 50 (39057 views)
Shortcut
Re: [cclinton] Random Listings Script [In reply to] Can't Post

Excellent! Let us know if you run into any other problems. :)

Donna


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.


cclinton
User

Jun 28, 2006, 1:21 PM

Post #36 of 50 (38619 views)
Shortcut
Re: [Donna] Random Listings Script [In reply to] Can't Post

Its been a few months and a couple of hacks I tried are starting to drive me crazy. Here's the issue:

My site is built with php pages and the header, navigation and side columns are all added using php includes. When using the random script the link for more details opens the listings in my listing template minus everything that would be included using php includes. Thus the company information and navigation is missing. To see what was going on I chose to view the source in the browser and the php include code is shown rather than the information that was supposed to appear in its place. Here's a quick copy of the table code in my random file:

<table width=126 border=1 cellspacing=1 cellpadding=1>
<tr><td width=120 align=center valign=top class="bg2">Featured Property<br>
<img src="listman/listings/images/<?php echo $listing_num[4];?>" border="0" width="120"></td></tr>
<tr><td width=100% valign=top class="bg2">$ <?php echo $listing_num[18];?><br>
<?php echo $listing_num[16];?><br>
<?php echo $listing_num[22];?> Bed, <?php echo $listing_num[23];?> Bath<br>
&nbsp;<a href="http://www.buyusa1.com/listman/exec/search.cgi?view=<?php echo $listing_num[0];?>">More details...</a>
</td></tr></table>

Knowing this was a problem I generated a hack that sent the viewer directly to the listing page on my site. The problem with this is that it doesn't work for single digit listing numbers. Here's a copy of that table code:

<table width=126 border=1 cellspacing=1 cellpadding=1>
<tr><td width=120 align=center valign=top class="bg2">Featured Property<br>
<img src="listman/listings/images/<?php echo $listing_num[4];?>" border="0" width="120"></td></tr>
<tr><td width=100% valign=top class="bg2">$ <?php echo $listing_num[18];?><br>
<?php echo $listing_num[16];?><br>
<?php echo $listing_num[22];?> Bed, <?php echo $listing_num[23];?> Bath<br>
&nbsp;<a href="http://www.buyusa1.com/listman/listings/l00<?php echo $listing_num[0];?>.php">More details...</a>
</td></tr></table>

I highlighted the change in red. This works most of the time but truly is not acceptable.

So, I thought I might try modifying a copy of the search script to open a php version of the template, thus causing the php includes to work. I tried to change the html notes in the script and changed the link in the table to
<a href="http://www.buyusa1.com/listman/exec/search.cgi?view=<?php echo $listing_num[0];?>">More details...</a>
but that did not solve the problem either.

Anyone feel ambitious? I attached two versions of my random script as well as a copy of the publish listing template. Any help would be greatly appreciated.

If there is no way to make this work by modifying the search script, how about adding some javascript that forces the link to layout out a certain way if the listing number is 1-9, another way for 10-99 and another way for 100+?
Attachments: random3.php (1.42 KB)
  random.php (1.43 KB)
  _publish_listing.php (7.31 KB)


MikeB
Staff / Moderator


Jun 29, 2006, 5:03 PM

Post #37 of 50 (38598 views)
Shortcut
Re: [cclinton] Random Listings Script [In reply to] Can't Post

Hi,

Thanks for the post! Smile

Setting up Listings Manager's search.cgi script to use PHP includes isn't something that you'll actually be able to set up unless you use a PHP Wrap. This is because you're generally not able to include dynamic content (such as PHP) on dynamically generated pages (like Listings Manager's search.cgi).

That said, you may want to have a look at this forum post that outlines how you can use a PHP Wrap to use PHP code on your search_query.html template file:

http://www.interactivetools.com/forum/gforum.cgi?post=41619#41619

Also, if you think it will help to use JavaScript to display the links for a listing then you could use something like this:


Code
  <script> 
if($listing_num_je$ <= 9)
{
document.write('<a href="$listing_url$/l000$listing_num$.php">$lfield1$</a>');
}
else if($listing_num_je$ <= 99)
{
document.write('<a href="$listing_url$/l00$listing_num$.php">$lfield1$</a>');
}
else if($listing_num_je$ <= 999)
{
document.write('<a href="$listing_url$/l0$listing_num$.php">$lfield1$</a>');
}
else if($listing_num_je$ <= 9999)
{
document.write('<a href="$listing_url$/l$listing_num$.php">$lfield1$</a>');
}
</script>


This JavaScript checks to see how what the listing number is and then determines how it should be output.

I hope one of these solutions will work for you and if you have any other questions or comments, just let me know! Smile

Cheers,
Mike Briggs - Product Specialist
support@interactivetools.com


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.


cclinton
User

Jun 30, 2006, 8:50 AM

Post #38 of 50 (38586 views)
Shortcut
Re: [MikeB] Random Listings Script [In reply to] Can't Post

Thanks for the quick replay.

Wrapping - I am familiar with this as I am already using it in various places on our site to generate php includes in our searches. I checked this out and played with it a bit and am not quite sure how to use this to generate an actual listing page though as the listing pages are already generated. I am sure that I could generate a php page with all the includes and then call out the listing portion to be added to the correct location. That's two new pages to be written. No big deal. The question I have is how this would affect the already existing listing page and would the person be able to go back with his browser button.

Javascript - I plugged your script into the table and it wasn't working. It appears as though it is not able to determine the value of $listing_num_je$. I gave it some other valient efforts with no luck as well. I changed it to $listing_num$ and also tried $listing_num[0] as they seemed like viable options. The first appears more like previous inserts used on other pages and the second is the call out used in the above fields. None generated the line the code was supposed to write. Here's how my table looked with your script added:

<table width=126 border=1 cellspacing=1 cellpadding=1>
<tr>
<td width=120 align=center valign=top class="bg2">Featured Property<br><img src="listman/listings/images/<?php echo $listing_num[4];?>" border="0" width="120"></td></tr>
<tr><td width=100% valign=top class="bg2">$ <?php echo $listing_num[18];?><br>
<?php echo $listing_num[16];?><br>
<?php echo $listing_num[22];?> Bed, <?php echo $listing_num[23];?> Bath<br>
&nbsp;
<script>
if($listing_num_je$ <= 9)
{
document.write('<a href="$listing_url$/l000$listing_num$.php">$lfield1$</a>');
}
else if($listing_num_je$ <= 99)
{
document.write('<a href="$listing_url$/l00$listing_num$.php">$lfield1$</a>');
}
else if($listing_num_je$ <= 999)
{
document.write('<a href="$listing_url$/l0$listing_num$.php">$lfield1$</a>');
}
else if($listing_num_je$ <= 9999)
{
document.write('<a href="$listing_url$/l$listing_num$.php">$lfield1$</a>');
}
</script>
</td>
</tr>
</table>


MikeB
Staff / Moderator


Jul 1, 2006, 3:53 PM

Post #39 of 50 (38570 views)
Shortcut
Re: [cclinton] Random Listings Script [In reply to] Can't Post

Hi,

Thanks for the update! Smile

It sounds to me like this issue is pretty specific to the way the site and the templates are set up and it's a bit tough to see what may be happening.

At this point I think you'll just want to fill out a Support Request with your FTP details here:

https://www.interactivetools.com/support/email_support.cgi

This should allow me to get onto your server and have a closer look at the templates for you.

I look forward to hearing from you! Smile

Cheers,
Mike Briggs - Product Specialist
support@interactivetools.com


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.


cclinton
User

Jul 24, 2006, 8:17 AM

Post #40 of 50 (38333 views)
Shortcut
Re: [MikeB] Random Listings Script [In reply to] Can't Post

Quick update for those who read this forum: Mike took a look at the code and switched out the javascript for php scripting. Thus, the code looks like so:

<?php
$listnum = $listing_num[0];
if($listnum <= 9)
{
echo "<a href='http://s119129017.onlinehome.us/testing/March06/listman/listings/l000$listnum.php'>More details...</a>";
}
else if($listnum <= 99)
{
echo "<a href='http://s119129017.onlinehome.us/testing/March06/listman/listings/l00$listnum.php'>More details...</a>";
}
else if($listnum <= 999)
{
echo "<a href='http://s119129017.onlinehome.us/testing/March06/listman/listings/l0$listnum.php'>More details...</a>";
}
else if($listnum <= 9999)
{
echo "<a href='http://s119129017.onlinehome.us/testing/March06/listman/listings/l$listnum.php'>More details...</a>";
}

?>

If you want to check out the working example, its at http://www.buyusa1.com/random.php

Thanks Mike.


mc
User

Nov 2, 2006, 2:41 PM

Post #41 of 50 (37690 views)
Shortcut
Re: [cclinton] Random Listings Script [In reply to] Can't Post

There is a fundamental problem with this script - it ignores listings that are marked as hidden so that "hidden" listings will show when they should not. Can anyone come up with the php code required to eliminate those results from the listing.dat array?


jasonrenda
User

Nov 6, 2006, 7:41 AM

Post #42 of 50 (37606 views)
Shortcut
Re: [Deven] Random Listings Script [In reply to] Can't Post

hey guys- outstanding site and products as usual. I do have a question for the random file. I am using the full javascript/html/php code you outline on the 2nd page of this tutorial. Is there a way I can get the script to display an additional random listing? as it is currently, the same image gets displayed twice. ideally i'd like it to pull another distinct image from the files.

here's the code:

<?php
//Path to listing.dat.cgi file.
$path = "cgi-bin/listman/data/listing.dat.cgi";

//Put listings into an array.
$array = file($path);

//Remove first 3 lines of listing.dat file.
array_splice($array,0,3);

//Randomize the array.
$element = $array[rand(0, count($array)-1)];

//Separate each field.
$listing_num = explode("¡", $element);

//Strip everything past the 75th field.
array_splice($listing_num, 75);

//If no image, let's use a default one.
if ($listing_num[4] == ''){
$listing_num[4] = ('nophoto.jpg');
} else {
$listing_num[4] = $listing_num[4];
}
?>

<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width=150 height=150 valign=top>
<img src="http://www.classic-upholstery.com/cgi-bin/listman/listings/images/<?php echo $listing_num[4];?>" border="0" height="150" width="150"></td>
</tr>

<tr>
<td height=1 valign=topbgcolor="#FFFFFF">
<img src="http://www.wispubs.com/images/spacer.gif" width="150" height="1"></td>
</tr>

<tr>
<td width=150 height=150 valign=top>
<img src="http://www.classic-upholstery.com/cgi-bin/listman/listings/images/<?php echo $listing_num[4];?>" border="0" height="150" width="150"></td>
</tr>
</table>


Joey
User

Nov 12, 2006, 11:23 AM

Post #43 of 50 (37328 views)
Shortcut
Re: [Deven] Random Listings Script [In reply to] Can't Post

Is there a way to pull in the THUMBNAIL picture for the featured listing box instead of those huge scaled down but still 50+ kb each pictures....

thanks,

Joey Stubblefield
http://Used-CarLots.com
Powered By Auto Manager!

http://1000Cars.com
Powered By Auto Manager!

http://MeetingStreetMotors.com
Powered By Used-CarLots.com Via Auto Manager!

(This post was edited by Joey on Nov 21, 2006, 9:08 AM)


cclinton
User

Jan 30, 2007, 9:24 AM

Post #44 of 50 (35146 views)
Shortcut
Random Listings Script - photos? [In reply to] Can't Post

Just wondering if anyone had figured out a way to force this script to only show those listings that have photos? I have the script using temp images for those missing photos but I would prefer to only show those with photos as the randomly listed property without a photo looks lame.


willydoit
User

Feb 6, 2008, 2:00 AM

Post #45 of 50 (29357 views)
Shortcut
Re: [Deven] Random Listings Script [In reply to] Can't Post

Hi, Just came across this script which will do everything I need, unfortunately the links are now dead, does anyone have a download location for it or could they send me a copy to try.



Thanks in advance


MikeB
Staff / Moderator


Feb 6, 2008, 2:02 PM

Post #46 of 50 (29281 views)
Shortcut
Re: [willydoit] Random Listings Script [In reply to] Can't Post

Hi,

Thanks for the post! Smile

I'm not quite sure which links you had followed but does the attachment at the bottom of this post work for you?

http://www.interactivetools.com/forum/forum.cgi?post=38483

These files should be what you need to get going on this and it seemed to work for me here on my end.

I hope this helps! Smile

Cheers,
Mike Briggs - Product Specialist
support@interactivetools.com


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.


willydoit
User

Feb 10, 2008, 3:42 AM

Post #47 of 50 (29225 views)
Shortcut
Re: [MikeB] Random Listings Script [In reply to] Can't Post

Hi,

Thanks for that, have got the script however when I run the random.php which is placed in my route directory I get the following error messages.

Warning: file() [function.file]: Unable to access cgi-bin/accommodation/data/listing.dat.cgi in /usr/local/4admin/apache/vhosts/bridlington.net/httpdocs/random.php on line 32

Warning: file(cgi-bin/accommodation/data/listing.dat.cgi) [function.file]: failed to open stream: No such file or directory in /usr/local/4admin/apache/vhosts/bridlington.net/httpdocs/random.php on line 32

Warning: array_splice() [function.array-splice]: The first argument should be an array in /usr/local/4admin/apache/vhosts/bridlington.net/httpdocs/random.php on line 35


The path is correct (the structure of our server is that the cgi-bin actually resides outside of the public folder httpdocs) however it does display a blank _publish_listing.html underneath the error so I assume that the path is fine, I have double checked the permissions on the data folder which are correct and have also experimented with the paths, however if I change the paths in any way I get different error messages and the _publish_listing.html doesnt display so I suspect that despite the error message saying the file doesnt exist I believe the path to be correct.

Is it possible that some security settings somewhere are preventing access to the files within the cgi-bin?



Any help on this would be appreciated.



Thanks in advance


Jake
Staff / Moderator


Feb 11, 2008, 3:19 PM

Post #48 of 50 (29134 views)
Shortcut
Re: [willydoit] Random Listings Script [In reply to] Can't Post

Hi willydoit,

While we can't really support third-party scripts I'd suggest you contact your web host and ask them if it's possible to use PHP includes for files located within the cgi-bin directory on your server. This does seem to be a security issue of some kind. Smile
-----------------------------------------------------------
Cheers,
Jake Swanson - Product Specialist
support@interactivetools.com


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.



capic
New User

Apr 28, 2008, 3:41 PM

Post #49 of 50 (28197 views)
Shortcut
Re: [Jake] Random Listings Script [In reply to] Can't Post

I'm having trouble getting this working. Just for background info, I'm using servers hosted through interactivetools and the initial listman installation was done by interactivetools.

I've tried creating both the shtml file that calls the random.php as well as creating a single all-in-one php file. Both fail to pull any data. I just receive empty template pages in the shtml version and empty images/links in the all in one php version. The path appears to be correct, the default cgi-bin/listman/data/listing.dat.cgi. I have five dummy listings in the system.

The shtml version is at www.indylandbank.com/test.shtml and the allinone is at www.indylandbank.com/random2.php. Any thoughts? I'm not an expert coder by any means...but with no errors being returned I'm having a hard time troubleshooting what is going wrong. Thanks.


MikeB
Staff / Moderator


Apr 29, 2008, 10:16 AM

Post #50 of 50 (28132 views)
Shortcut
Re: [capic] Random Listings Script [In reply to] Can't Post

Hi,

Thanks for the post!

It's a bit tough to tell what might be happening here and it seems that the issue is just related to pulling content from the database.

Although this is an unsupported add-on script, I'd be happy to have a quick look at this for you if you're able to fill out a Support Request here:

https://www.interactivetools.com/support/email_support.cgi

I look forward to hearing from you! Smile

Cheers,
Mike Briggs - Product Specialist
support@interactivetools.com


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.

First page Previous page 1 2 Next page Last page  View All
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4