This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Last x reviews on home


avatar
capslock 0
From: -
Last x reviews on home

Is it possible to have the latest x reviews on homepage with a small preview image? I don't mean to use the block feature, but just a review's box.

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Last x reviews on home
avatar
OP 0
From: -
Last x reviews on home

Thank you,
this works!
1 Re: Last x reviews on home
avatar
Administrator
1340
From: Vienna, Austria
Last x reviews on home

This should work:

// show reviews on front page 


if (preg_match("/index.php/i",$_SERVER[PHP_SELF]))
{
dbconnect();
$query = DBQuery("SELECT * FROM esselbach_st_review ORDER BY review_id DESC LIMIT 5"); // Show last 5 review (LIMIT 5)
while($reviewd = mysql_fetch_array($query))
{

$query2 = DBQuery("SELECT reviewcat_name FROM esselbach_st_reviewcat WHERE reviewcat_id = '$reviewd[review_category]'");
list($reviewd[category_name]) = mysql_fetch_row($query2);

if ($reviewd[review_extra1]) $reviewimg = "<td valign=top><img src=$reviewd[review_extra1] alt=$reviewd[review_title] hspace=4 vspace=2 border=0 align=left class=imgborder></td> ";
$preview = explode("n",$reviewd[review_text]);
$reviewd[review_preview] = $preview[0];

$review .= "<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td colspan="2"><a href="https://www.contentteller.com/review.php?id=$reviewd[review_id]" title="$reviewd[review_title]" class="linkbig">$reviewd[review_title] </a></td>
</tr>
<tr>

$reviewimg
<td valign="top"><span class="textsmall"><a href="https://www.contentteller.com/review.php?cat=$reviewd[review_category]" class="nomecat" title="$reviewd[category_name]">$reviewd[category_name] </a> - $reviewd[review_date]</span><br>
<div align="justify"><span class="textsmall">$reviewd[review_preview]</span> <a href="https://www.contentteller.com/review.php?id=$reviewd[review_id]" class="linksmall" title="$reviewd[review_title]"><i>»</i></a></div></td>
</tr>
</table>";
}
}
1 Re: Last x reviews on home
avatar
Administrator
1340
From: Vienna, Austria
Last x reviews on home

1. All the review is shown, while it would be a small preview

The script is looking for a line break and should show only the first part of the review.

2. it shows only 1 review preview.

Here an update:

// show reviews on front page 


if (preg_match("/index.php/i",$_SERVER[PHP_SELF]))
{
dbconnect();
$query = DBQuery("SELECT * FROM esselbach_st_review ORDER BY review_id DESC LIMIT 5"); // Show last 5 review (LIMIT 5)
while($reviewd = mysql_fetch_array($query))
{

$query = DBQuery("SELECT reviewcat_name FROM esselbach_st_reviewcat WHERE reviewcat_id = '$reviewd[review_category]'");
list($reviewd[category_name]) = mysql_fetch_row($query);

if ($reviewd[review_extra1]) $reviewimg = "<td valign=top><img src=$reviewd[review_extra1] alt=$reviewd[review_title] hspace=4 vspace=2 border=0 align=left class=imgborder></td> ";
$preview = explode("n",$reviewd[review_text]);
$reviewd[review_preview] = $preview[0];

$review = "<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td colspan="2"><a href="https://www.contentteller.com/review.php?id=$reviewd[review_id]" title="$reviewd[review_title]" class="linkbig">$reviewd[review_title] </a></td>
</tr>
<tr>

$reviewimg
<td valign="top"><span class="textsmall"><a href="https://www.contentteller.com/review.php?cat=$reviewd[review_category]" class="nomecat" title="$reviewd[category_name]">$reviewd[category_name] </a> - $reviewd[review_date]</span><br>
<div align="justify"><span class="textsmall">$reviewd[review_preview]</span> <a href="https://www.contentteller.com/review.php?id=$reviewd[review_id]" class="linksmall" title="$reviewd[review_title]"><i>»</i></a></div></td>
</tr>
</table>";
}
}
1 Re: Last x reviews on home
avatar
OP 0
From: -
Last x reviews on home

this solution is quite good, but there are 2 things to adjust Smiling Face

1. All the review is shown, while it would be a small preview
2. it shows only 1 review preview.
1 Re: Last x reviews on home
avatar
Administrator
1340
From: Vienna, Austria
Last x reviews on home

Ok, here an example:

Open site_header with the template editor and add after:

<?php

global $insert;

the following:

// show review on front page


if (preg_match("/index.php/i",$_SERVER[PHP_SELF]))
{
dbconnect();
$query = DBQuery("SELECT * FROM esselbach_st_review ORDER BY review_id DESC LIMIT 1");
$reviewd = mysql_fetch_array($query);

$query = DBQuery("SELECT reviewcat_name FROM esselbach_st_reviewcat WHERE reviewcat_id = '$reviewd[review_category]'");
list($reviewd[category_name]) = mysql_fetch_row($query);

if ($reviewd[review_extra1]) $reviewimg = "<td valign=top><img src=$reviewd[review_extra1] alt=$reviewd[review_title] hspace=4 vspace=2 border=0 align=left class=imgborder></td> ";
$preview = explode("n",$reviewd[review_text]);
$reviewd[review_preview] = $preview[0];

$review = "<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td colspan="2"><a href="https://www.contentteller.com/review.php?id=$reviewd[review_id]" title="$reviewd[review_title]" class="linkbig">$reviewd[review_title] </a></td>
</tr>
<tr>

$reviewimg
<td valign="top"><span class="textsmall"><a href="https://www.contentteller.com/review.php?cat=$reviewd[review_category]" class="nomecat" title="$reviewd[category_name]">$reviewd[category_name] </a> - $reviewd[review_date]</span><br>
<div align="justify"><span class="textsmall">$reviewd[review_preview]</span> <a href="https://www.contentteller.com/review.php?id=$reviewd[review_id]" class="linksmall" title="$reviewd[review_title]"><i>»</i></a></div></td>
</tr>
</table>";
}

After:

$insert[login_header]

add:

$review

and save the template.

Now you need to add a custom field with Reviews => Edit Fields. Select "Enabled, Text only" and add "Location to preview image" as Field Text.

Let me know if you have any questions.
1 Re: Last x reviews on home
avatar
OP 0
From: -
Last x reviews on home

Yes, just something like this:

<table width="464" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td colspan="2"><a href="#" title="Revie title" class="linkbig">Review's Title </a></td>
</tr>
<tr>
<td valign="top"><img src="https://www.contentteller.com/33333.jpg" alt="revie title" width="100" height="100" hspace="4" vspace="2" border="0" align="left" class="imgborder"></td>
<td valign="top"><span class="textsmall"><a href="#" class="nomecat" title="Comparativa">Catecory </a><a href="#" class="nomecat" title="Schede Video"></a>&nbsp;-&nbsp;14/06/2005</span><br>
<div align="justify"><span class="textsmall">Alla vigilia della futura generazione di processori grafici NVIDIA, le aziende Galaxy e Leadtek presentano due nuovi prodotti basati sul processore grafico GeForce 6600 GT, contraddistinti da frequenze di funzionamento fuori specifica e funzionalit&agrave; innovative&nbsp;</span><a href="#" class="linksmall" title="Galaxy e Leadtek: due GeForce 6600 GT spinte"><i>&raquo;</i></a></div></td>
</tr>
</table>
1 Re: Last x reviews on home
avatar
Administrator
1340
From: Vienna, Austria
Last x reviews on home

Everything is possible Winking Face. Do you have any example HTML code?

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.