This topic is locked

How to display list of categories on left side

6/25/2007 7:02:28 AM
ASPRunnerPro General questions
L
live2 author

In all the demos given with the application, creates a search on left side , and also displays the categopry listings and the count of records in that category.

I crated a small db with categories and then table company names but it doesn't gave me option to show the listings and count of records in that category ?

is this somethig manually i had to do ?

Like in your real estate application in the tblresults listpage design i see Search By City / City which prints the names of the cities and then the count of records in the city ?

I tried lookign for the SQL or where you added this relationhip.

Is this something manullay you did ?

and you displayed ::: {foreach from=$rowsearch item=row}<A href="{$row.href}">{$row.1City_value}</A><BR>{/foreach}</TD>

how do i print the list of categories and count of records of that category listing on left side in my small demo i am trying to create ?

Admin 6/25/2007

Create a project using Real Estate template. Check ListOnLoad event that does the job. Adjust this event code for your own needs.

J
jeannot30 6/27/2007

Create a project using Real Estate template. Check ListOnLoad event that does the job. Adjust this event code for your own needs.



Hello,

With Real Estate template,

I also try change Search by City with another field... Code "ListOnload" is :

/** Custom code ****

// put your custom code here

global $conn,$smarty;

$rowsearch=array();

$rstt = db_query("SELECT tblresults.City, Count(tblresults.City) AS CountOfCity FROM tblresults GROUP BY tblresults.City", $conn);

$ind=0;

while($data=db_fetch_array($rstt))

{

$rows=array();

$CityName = str_Replace(" ","+",$data["City"]);

$rows["href"]="tblresults_list.php?a=search&value=1&SearchFor=".$CityName."&SearchOption=Contains&SearchField=City";

$rows["1City_value"]=$data["City"]." (".$data["CountOfCity"].")";

$rowsearch[$ind]=$rows;

$ind=$ind+1;

}

$smarty->assign("rowsearch", $rowsearch);
How can I chang it for Search by Type.... I replace City by Type but that doesn't work I getan error with TypeName....
Last question : how to display several Search by on a list page
Thanks

Admin 6/27/2007

This is PHP code posted in ASPRunnerPro forum.
What product do you use?

S
sfhussain 8/6/2008

This is PHP code posted in ASPRunnerPro forum.

What product do you use?



I need the same scenerio code for ASPRunner. Can anybody help plzz?

J
Jane 8/6/2008

Create a project using Real Estate template. Check ListOnLoad event that does the job. Adjust this event code for your own needs.

S
sfhussain 8/6/2008

Create a project using Real Estate template. Check ListOnLoad event that does the job. Adjust this event code for your own needs.


HI,
I have got the code but didnt understand what CityName do?

Set rowsearch = CreateObject("Scripting.Dictionary")

Set rstt = server.CreateObject("ADODB.Recordset")

rstt.Open "SELECT tblresults.City, Count(tblresults.City) AS CountOfCity, [city] + '('+" & [countofcity] & "+')' AS Cities FROM tblresults GROUP BY tblresults.City", dbConnection

ind=0

while not rstt.eof

Set rows = CreateObject("Scripting.Dictionary")
CityName = Replace(rstt("City")," ","+")

rows.add "href","tblresults_list.asp?a=search&value=1&SearchFor=" & CityName& "&SearchOption=Contains&SearchField=City"

rows.add "1City_value", rstt("city") & " (" & rstt("countofcity") & ")"

rstt.MoveNext

rowsearch.add ind,rows

ind=ind+1

wend

rstt.close

smarty.add "rowsearch", rowsearch


What i have to do if i want to user simple text or Date in this code.
My error on page

Microsoft VBScript compilation error '800a03ee'
Expected ')'
/include/south_events.asp, line 207
problem = Replace(rstt("problem" ","+")

---------------------------------^

J
Jane 8/7/2008

Hi,
You need to replace all white spaces with + in the URL string.

Here is the correct code:

problem = Replace(rstt("problem")," ","+")