Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Instant Website: Realty/Listings/Auto:
how to publish 2 listings in 1 page? (homepages & listings in one single page)

 

 


carlosdiaz
New User

Aug 28, 2009, 11:41 AM

Post #1 of 4 (6666 views)
Shortcut
how to publish 2 listings in 1 page? (homepages & listings in one single page) Can't Post

Hi

im making an online nightclub directory

listingswebsite seems to work pretty well



What im trying to do is to show in one page (home page) the clubs listing (homepages) and the events listings (listings)



i started making listings.php page, adding web desing and template and it works pretty good, now i want to ad the club event listings to this page and i get an error



What i am doing is copying the code from de GENERATOR code for homepagesList.php, and pasting it in listings.php

BUT I GET THIS ERROR: Homepages - List Page Viewer

Notice: Undefined variable: homepagesRecords in /home/ticketni/public_html/ticketnight/simpleticket/listings.php on line 187 Warning: Invalid argument supplied for foreach() in /home/ticketni/public_html/ticketnight/simpleticket/listings.php on line 187 Notice: Undefined variable: homepagesRecords in /home/ticketni/public_html/ticketnight/simpleticket/listings.php on line 212 No records were found!



How can i do this? to post both listings and home pages in same page?

this is the basic idea: www.clubzone.com

to have in the home page at leas 2 diferent listings (events and clubs)

this is my website where you can see the error and my work until now


www.ticketnight.nightconexion.com/simpleticket/listings.php



by the way i dont know nothing about php





ill apreciate a soon answer



best regards



Carlos


(This post was edited by carlosdiaz on Aug 28, 2009, 11:49 AM)


Chris
Staff


Aug 29, 2009, 11:33 AM

Post #2 of 4 (6581 views)
Shortcut
Re: [carlosdiaz] how to publish 2 listings in 1 page? (homepages & listings in one single page) [In reply to] Can't Post

Hi Carlos,

Can you post the source PHP code for that page here as an attachment please? If we can see the exact code, we can determine exactly what the problem is. Thanks! :)
Chris


carlosdiaz
New User

Aug 30, 2009, 11:12 PM

Post #3 of 4 (6344 views)
Shortcut
Re: [chris] how to publish 2 listings in 1 page? (homepages & listings in one single page) [In reply to] Can't Post

 hi, this is the code

Code



<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */
require_once "init.php";

list($listingRecords, $listingDetails) = getRecords(array(
'tableName' => 'listings',
'joinTable' => 'homepages',
'perPage' => '10',

));

?>
<?php include "include_header.php"; ?>
<style type="text/css">
<!--
.box {
font-size: 10px;
}
-->
</style>
<style type="text/css">
<!--
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
-->
</style>
<div class="subheader">
<table width="760" height="183" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="529" rowspan="2" align="left" valign="top"><div class="subheader"><font color="#FFFFFF">Ver
Listado de Antros</font></div>
<br/>
<!-- show listings -->
<table width="96%" border="0" cellpadding="4" cellspacing="0">
<?php foreach ($listingRecords as $listing): ?>
<tr>
<td width="115" rowspan="2" align="center" valign="top">
<?php foreach ($listing['uploads'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $listing['_link'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" alt="" /></a><br/>
<?php break /* only show one image */ ?>
<?php endif; ?>
<?php endforeach ?>
<?php if (!$listing['uploads']): /* if no uploads show this: */ ?>
<table border="0" cellspacing="0" cellpadding="0" width="150" height="100">
<tr>
<td bgcolor="#EEEEEE" align="center"><b>Photo<br/>
Not<br/>
Available</b></td>
</tr>
</table>
<?php endif; ?>
</td>
<td valign="top" background="../images/boxtitulojpg.jpg"><a href="<?php echo $listing['_link'] ?>" class="title"><font color="#FF3300"><?php echo $listing['product'] ?></font></a>
<font color="#FF3300">.</font><font color="#FFFFFF"><br>
</font></td>
</tr>
<tr>
<td width="300" valign="top"><font color="#FFFFFF"><br>
Zona: <?php echo $listing['zona']; ?><br/>
Tipo: <?php echo $listing['tipo']; ?><br/>
Genero: <?php echo $listing['genero']; ?><br/>
</font> <p> <font color="#FFFFFF"><?php echo $listing['summary']; ?></font></p></td>
</tr>
<?php endforeach ?>
</table>
<font color="#FFFFFF">
<!-- /show listings -->
<!-- show errors -->
<?php if ($listingDetails['invalidPageNum']): ?>
Results page '<?php echo $listingDetails['page']?>' not found, <a href="<?php echo $listingDetails['firstPageLink'] ?>">start
over &gt;&gt;</a>.<br/>
<br/>
<?php elseif (!$listingRecords): ?>
No listings were found!<br/>
<br/>
<?php endif ?>
<!-- /show errors -->
<!-- show prev/next page links -->
</font> <div align="center"><font color="#FFFFFF"><br/>
<?php if ($listingDetails['prevPage']): ?>
<a href="<?php echo $listingDetails['prevPageLink'] ?>">&lt;&lt;
prev</a>
<?php else: ?>
&lt;&lt; prev
<?php endif ?>
- page <?php echo $listingDetails['page'] ?> of <?php echo $listingDetails['totalPages'] ?>
-
<?php if ($listingDetails['nextPage']): ?>
<a href="<?php echo $listingDetails['nextPageLink'] ?>">next
&gt;&gt;</a> </font>
<?php else: ?>
.next <font color="#FFFFFF">&gt;&gt;
<?php endif ?>
</font></div>
<font color="#FFFFFF">
<!-- /show prev/next page links -->
</font></td>
<td colspan="4" align="center" valign="top" bgcolor="#111111"><p>&nbsp;</p>
<p><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Buscar
Antros</font> <br>
</p>
<form method="post" action="listings.php">
<div align="left">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30"><font color="#CCCCCC">&nbsp;Nombre&nbsp;</font></td>
<td> <font color="#CCCCCC">
<input name="product" type="text" class="box" size="20">
</font></td>
</tr>
<tr>
<td height="30"><font color="#CCCCCC">&nbsp;Zona&nbsp;&nbsp;</font></td>
<td> <font color="#CCCCCC">
<select name="zona" class="box">
<option value="">&lt;selecciona&gt;</option>
<option value="">Any</option>
<option>Benito Juarez</option>
<option>Coyoacan</option>
<option>Cuauthemoc</option>
<option>Miguel Hidalgo</option>
</select>
</font></td>
</tr>
<tr>
<td height="30"><font color="#CCCCCC">&nbsp;Tipo</font></td>
<td> <font color="#CCCCCC">
<select name="tipo" class="box">
<option value="">&lt;select&gt;</option>
<option value="">Any</option>
<option>Antro</option>
<option>Cantina</option>
<option>Bar</option>
<option>Club</option>
</select>
</font></td>
</tr>
<tr>
<td height="30"><font color="#CCCCCC">&nbsp;Genero</font></td>
<td> <font color="#CCCCCC">
<select name="genero" class="box">
<option value="">Cualquiera</option>
<option>Rock</option>
<option>Pop</option>
<option>Electronico</option>
<option>Gay</option>
<option>Hip Hop</option>
<option>80s &amp; 90s</option>
</select>
</font></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td><font color="#CCCCCC">&nbsp;Near School&nbsp;</font></td>
<td><font color="#CCCCCC">
<input type="checkbox" name="near_school" value="1" />
</font></td>
</tr>
<tr>
<td><font color="#CCCCCC">&nbsp;Near Transit&nbsp;</font></td>
<td><font color="#CCCCCC">
<input type="checkbox" name="near_transit" value="1" />
</font></td>
</tr>
</table>
<font color="#CCCCCC"><br/>
</font> </div>
<div align="center"> <font color="#CCCCCC">
<input type="submit" name="search" value=" Buscar Antros"/>
</font></div>
</form></td>
</tr>
<tr>
<td width="203" colspan="4" align="center" valign="top" bgcolor="#111111">
<p align="left">&nbsp;</p>
<h1><font color="#FFFFFF">Homepages - List Page Viewer</font></h1>
<font color="#FFFFFF">
<?php foreach ($homepagesRecords as $record): ?>
Record Number: <?php echo $record['num'] ?><br/>
Full Name: <?php echo $record['fullname'] ?><br/>
Specialty: <?php echo $record['specialty'] ?><br/>
Phone: <?php echo $record['phone'] ?><br/>
Email: <?php echo $record['email'] ?><br/>
Background: <?php echo $record['background'] ?><br/>
Qualifications: <?php echo $record['qualifications'] ?><br/>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>
<!-- STEP 2a: Display Uploads for field 'uploads' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($record['uploads'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>
<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download
<?php echo $upload['filename'] ?></a><br/>
<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
</font>
<hr/> <font color="#FFFFFF">
<?php endforeach; ?>
<?php if (!$homepagesRecords): ?>
No records were found!<br/>
<br/>
<?php endif ?>
<!-- /STEP2: Display Records -->
</font>
<p align="left">&nbsp;</p>
</td>
</tr>
<tr>
<td colspan="5" align="left" valign="top"><div align="center"><font color="#FFFFFF">
<?php include "include_footer.php"; ?>
</font></div></td>
</tr>
</table>

<div align="center"><font color="#FFFFFF"> </font></div>
</div>


Chris
Staff


Aug 31, 2009, 9:15 AM

Post #4 of 4 (6282 views)
Shortcut
Re: [carlosdiaz] how to publish 2 listings in 1 page? (homepages & listings in one single page) [In reply to] Can't Post

Hi Carlos,

You've copied over the STEP 2 (Display) code from your Homepages List Viewer, but you'll also need to copy over the STEP 1 (Load Records) code too.

You currently have the following code at the top of your page:


Code
<?php 
/* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */
require_once "init.php";

list($listingRecords, $listingDetails) = getRecords(array(
'tableName' => 'listings',
'joinTable' => 'homepages',
'perPage' => '10',

));

?>


You'll want to find the getRecords code for your Homepages List (you can again use the generator.) It should look something like this:


Code
<?php 
/* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */
require_once "init.php";

list($homepagesRecords, $homepagesDetails) = getRecords(array(
'tableName' => 'homepages'
));
?>


And you'll want to combine that into something like this: (new code emphasized in bold)


Code
<?php 
/* STEP 1: LOAD RECORDS - Copy this PHP code block to the TOP of your page BEFORE anything else. */
require_once "init.php";

list($listingRecords, $listingDetails) = getRecords(array(
'tableName' => 'listings',
'joinTable' => 'homepages',
'perPage' => '10',
));

list($homepagesRecords, $homepagesDetails) = getRecords(array(
'tableName' => 'homepages'
));


?>


If you're unable to get this working, please post an example Homepages List page that displays the homepages you want and we'll show you how to add those homepages to your existing page.

I hope this helps! Please let us know if you have any questions or comments.
Chris