Nested Repeat Region
Dreamweaver CS3
ASP / VBScript
Hi,
I'm trying to create a nested repeat region to display a list
of categories
and, in brackets afterwards, a count of the number of
sub-categories
contained in it E.g.
Cats (12)
Dogs (43)
Fish (92)
Etc
I have managed to create my repeat region ok because as soon
as I drop a
field in from the recordset, it loops through them all and
displays them
correctly. However, when I try and simply write out the total
number of
records found, it doesn't display anything.
Recordset 1 is a straighforward select from the table.
Recordset 2 adds a
WHERE clause usinga variable based on the 1st recordset. Here
is the code
i'm using for the 2 recordsets:
Recordset 1 :
<%
Dim Level1
Dim Level1_cmd
Dim Level1_numRows
Set Level1_cmd = Server.CreateObject ("ADODB.Command")
Level1_cmd.ActiveConnection = MM_SemiDirectory_STRING
Level1_cmd.CommandText = "SELECT * FROM TBL_Level1 ORDER BY
[Description]
ASC"
Level1_cmd.Prepared = true
Set Level1 = Level1_cmd.Execute
Level1_numRows = 0
%>
Recordset 2 :
<%
Dim Level2__varLink
Level2__varLink = "1"
If (level1.fields.item("Level1_ID").value <> "") Then
Level2__varLink = level1.fields.item("Level1_ID").value
End If
%>
<%
Dim Level2
Dim Level2_cmd
Dim Level2_numRows
Set Level2_cmd = Server.CreateObject ("ADODB.Command")
Level2_cmd.ActiveConnection = MM_SemiDirectory_STRING
Level2_cmd.CommandText = "SELECT * FROM TBL_Level2 WHERE
Level1_ID = ? ORDER
BY Level1_ID ASC"
Level2_cmd.Prepared = true
Level2_cmd.Parameters.Append
Level2_cmd.CreateParameter("param1", 5, 1, -1,
Level2__varLink) ' adDouble
Set Level2 = Level2_cmd.Execute
Level2_numRows = 0
%>
Now for the repeated code :
<%
While ((Repeat1__numRows <> 0) AND (NOT Level1.EOF))
%>
<li><a
href="category.asp?level1=<%=(Level1.Fields.Item("Level1_ID").Value)%>"><%=(Level1.Fields .Item("Description").Value)%>
(<%=(Level2_total)%>)
</li></a>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Level1.MoveNext()
Wend
%>
Can anyone tell me what I need to do to this code to make it
display the
number of sub-categories?
Thanks!!!
Ok folks,
I found a way to get what I want. It's not pretty as I had to
make an extra
query in the database (that select of the count of all child
table results
for each parent category) and am pulling from that but it
works and that's
the main thing. I'm sure there is a more effective way of
doing it but
that's life!
I'm still interested in knowing the 'proper' way (if there is
such a thing)
so if you have the time to show me, i'm all ears!
Cheers!
"Mintyman" <[email protected]> wrote in message
news:[email protected]...
> Ok,
>
> So I closed the <li> code before the <a>
code. D'oh!
>
> Anyway, it returns a number now........the problem now
is that it returns
> the same value for each parent repeat!!!
>
> "Mintyman" <[email protected]> wrote in message
> news:[email protected]...
>> Dreamweaver CS3
>> ASP / VBScript
>>
>> Hi,
>>
>> I'm trying to create a nested repeat region to
display a list of
>> categories and, in brackets afterwards, a count of
the number of
>> sub-categories contained in it E.g.
>>
>> Cats (12)
>> Dogs (43)
>> Fish (92)
>> Etc
>>
>> I have managed to create my repeat region ok because
as soon as I drop a
>> field in from the recordset, it loops through them
all and displays them
>> correctly. However, when I try and simply write out
the total number of
>> records found, it doesn't display anything.
>>
>> Recordset 1 is a straighforward select from the
table. Recordset 2 adds a
>> WHERE clause usinga variable based on the 1st
recordset. Here is the
>> code i'm using for the 2 recordsets:
>>
>> Recordset 1 :
>>
>> <%
>> Dim Level1
>> Dim Level1_cmd
>> Dim Level1_numRows
>>
>> Set Level1_cmd = Server.CreateObject
("ADODB.Command")
>> Level1_cmd.ActiveConnection =
MM_SemiDirectory_STRING
>> Level1_cmd.CommandText = "SELECT * FROM TBL_Level1
ORDER BY [Description]
>> ASC"
>> Level1_cmd.Prepared = true
>>
>> Set Level1 = Level1_cmd.Execute
>> Level1_numRows = 0
>> %>
>>
>> Recordset 2 :
>>
>> <%
>> Dim Level2__varLink
>> Level2__varLink = "1"
>> If (level1.fields.item("Level1_ID").value <>
"") Then
>> Level2__varLink =
level1.fields.item("Level1_ID").value
>> End If
>> %>
>> <%
>> Dim Level2
>> Dim Level2_cmd
>> Dim Level2_numRows
>>
>> Set Level2_cmd = Server.CreateObject
("ADODB.Command")
>> Level2_cmd.ActiveConnection =
MM_SemiDirectory_STRING
>> Level2_cmd.CommandText = "SELECT * FROM TBL_Level2
WHERE Level1_ID = ?
>> ORDER BY Level1_ID ASC"
>> Level2_cmd.Prepared = true
>> Level2_cmd.Parameters.Append
Level2_cmd.CreateParameter("param1", 5,
>> 1, -1, Level2__varLink) ' adDouble
>>
>> Set Level2 = Level2_cmd.Execute
>> Level2_numRows = 0
>> %>
>>
>>
>> Now for the repeated code :
>>
>>
>> <%
>> While ((Repeat1__numRows <> 0) AND (NOT
Level1.EOF))
>> %>
>> <li><a
>>
href="category.asp?level1=<%=(Level1.Fields.Item("Level1_ID").Value)%>"><%=(Level1.Fields .Item("Description").Value)%>
>> (<%=(Level2_total)%>)
>> </li></a>
>>
>>
>> <%
>> Repeat1__index=Repeat1__index+1
>> Repeat1__numRows=Repeat1__numRows-1
>> Level1.MoveNext()
>> Wend
>> %>
>>
>> Can anyone tell me what I need to do to this code to
make it display the
>> number of sub-categories?
>>
>> Thanks!!!
>>
>>
>>
>
>
Similar Messages
-
Nested Repeat Regions in Dreamweaver 8
I am waying the option of upgrading from MX to 8 or just
getting MX Looper to do nested repeat regions. Any advice? Are
nested repeat regions built into Dreamweaver 8?SmellyPete wrote:
> I've got a problem with nested templates in my site. I
don't think it's an
> error or bug as such, just a really strange limitation,
that I hope there is a
> work around for.
>
> I've setup a menubar with a repeating table region in a
template. Then I laid
> out the content (editable) regions in a nested template.
The system works
> really well in dreamweaver, if you want to add a menu
item, you do so to the
> parent template, and then it filters through out the
site.
>
> The problem is that when I try to edit the pages as a
client with contribute
> (even as an administrator) it will not allow access to
edit a .dwt file, even
> if it has editable regions in it. This means I can't use
contribute to add an
> item to the menubar, because I need to be able to edit
the nested template. I'm
> sure it's possible, because a .dwt is just an .htm file
with a different hat on.
>
> There must be some way of doing this. As soon as I read
about the template
> system I immediately thought this would be one of it's
strengths, and would be
> very surprised if the contribute user were limited to
making changes on every
> individual page.
>
> PS. I'm sure someone will suggest that I just move the
repeating region into
> the nested template. I could do this, but the whole
point is that with one
> change I want it to will filter down through the whole
site. I thought maybe
> SSI might be the answer, but would that just confuse
contribute even more?
>
It seems to me the whole point of using Contribute is to keep
users from
changing basic site configurations such as the menu. Use
Dreamweaver or
one of the simple HTML editors around. -
Limit records in nested repeat region
I am using the nested repeat region behaviour and I need to limit the amount of records in the detail table.
in ADDT it guides you through a wizard for master and detail tables to use this nesting which works great but it also returns all the records in the detail. I would like to limit the amount.
I tried modifying the query by adding
$maxRows_detail4tbl_products = 4;
$pageNum_detail4tbl_products = 0;
if (isset($_GET['pageNum_detail4tbl_products'])) {
$pageNum_detail4tbl_products = $_GET['pageNum_detail4tbl_products'];
$startRow_detail4tbl_products = $pageNum_detail4tbl_products * $maxRows_detail4tbl_products;
still returns all rows. any help is greatly appreciated.In the Application Panel, select the tab Biddings
dbclick Recordset Detail. Click the Advanced button, in the last SQL command ORDER BY
You add LIMIT 0,4 -
URGENTLY NEED HELP WITH NESTED REPEAT REGION
Im using dreamweaver to deevelop a page that displays questions in ann assessment to the user. First of all the page shows the assessment name to the user and then it gets some information about the questions in the assessment from the table called Item. It gets the Question_ID and then there is a repeat region which uses the Question_ID to display the questions in the assessment. There is a nested repeat region inside this which displays the possible answers the user can respond to the question with It gets this information from a table called outcome. The page should display each question and then all the possible answers but i am having problems and im not sure wether i am doing this in the correct way. What is wrong with my code? PLEASE HELP! can someone tell me what is going wrong and how i can fix this problem thamks.
here is my code.
Driver DriverassessmentRecordset = (Driver)Class.forName(MM_connAssessment_DRIVER).newInstance();
Connection ConnassessmentRecordset = DriverManager.getConnection(MM_connAssessment_STRING,MM_connAssessment_USERNAME,MM_connAssessment_PASSWORD);
PreparedStatement StatementassessmentRecordset = ConnassessmentRecordset.prepareStatement("SELECT Assessment_ID, Assessment_Name, Time_Limit, Display_Random, Record_Answers FROM Assessment.assessment WHERE Assessment_ID = '" + session.getValue("AssessmentID") + "' ");
ResultSet assessmentRecordset = StatementassessmentRecordset.executeQuery();
boolean assessmentRecordset_isEmpty = !assessmentRecordset.next();
boolean assessmentRecordset_hasData = !assessmentRecordset_isEmpty;
Object assessmentRecordset_data;
int assessmentRecordset_numRows = 0;
%>
<%
Driver DriveritemRecordset = (Driver)Class.forName(MM_connAssessment_DRIVER).newInstance();
Connection ConnitemRecordset = DriverManager.getConnection(MM_connAssessment_STRING,MM_connAssessment_USERNAME,MM_connAssessment_PASSWORD);
PreparedStatement StatementitemRecordset = ConnitemRecordset.prepareStatement("SELECT Question_ID, Assessment_ID FROM Assessment.item WHERE Assessment_ID = '" + session.getValue("AssessmentID") + "' ");
ResultSet itemRecordset = StatementitemRecordset.executeQuery();
boolean itemRecordset_isEmpty = !itemRecordset.next();
boolean itemRecordset_hasData = !itemRecordset_isEmpty;
Object itemRecordset_data;
int itemRecordset_numRows = 0;
%>
<%
Driver DriverquestionRecordset = (Driver)Class.forName(MM_connAnswer_DRIVER).newInstance();
Connection ConnquestionRecordset = DriverManager.getConnection(MM_connAnswer_STRING,MM_connAnswer_USERNAME,MM_connAnswer_PASSWORD);
//PreparedStatement StatementquestionRecordset = ConnquestionRecordset.prepareStatement("SELECT Question_Type, Number_Outcomes, Question_Wording FROM Answer.question WHERE Question_ID = '" + (((itemRecordset_data = itemRecordset.getObject("Question_ID"))==null || itemRecordset.wasNull())?"":itemRecordset_data) +"' ");
//ResultSet questionRecordset = StatementquestionRecordset.executeQuery();
%>
<%
Driver DriveroutcomeRecordset = (Driver)Class.forName(MM_connAnswer_DRIVER).newInstance();
Connection ConnoutcomeRecordset = DriverManager.getConnection(MM_connAnswer_STRING,MM_connAnswer_USERNAME,MM_connAnswer_PASSWORD);
PreparedStatement StatementoutcomeRecordset = ConnoutcomeRecordset.prepareStatement("SELECT Outcome_Number, Outcome_Text, Score, Feedback FROM Answer.outcome WHERE Question_ID = '" +itemRecordset.getObject("Question_ID")+ "' ");
ResultSet outcomeRecordset = StatementoutcomeRecordset.executeQuery();
boolean outcomeRecordset_isEmpty = !outcomeRecordset.next();
boolean outcomeRecordset_hasData = !outcomeRecordset_isEmpty;Object outcomeRecordset_data;
int outcomeRecordset_numRows = 0;
%>
<%
int Repeat1__numRows = -1;
int Repeat1__index = 0;
itemRecordset_numRows += Repeat1__numRows;
%>
<%
int Repeat2__numRows = -1;
int Repeat2__index = 0;
assessmentRecordset_numRows += Repeat2__numRows;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/assessment.dwt.jsp" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Assessment</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link href="../css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="1000" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="190"><img src="../img/assessment_login.png" alt="" name="navigation" width="1000" height="190" border="0" id="navigation" /></td>
</tr>
<tr>
<td height="19"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="19"><!-- InstanceBeginEditable name="main" -->
<table>
<tr>
<td width="990">Assessment Name:<%=(((assessmentRecordset_data = assessmentRecordset.getObject("Assessment_Name"))==null || assessmentRecordset.wasNull())?"":assessmentRecordset_data)%> </td>
</tr>
<tr>
<td><% int count = 1; %> </td>
</tr>
<tr>
<td valign="top"><table>
<% while ((itemRecordset_hasData)&&(Repeat1__numRows-- != 0)) { %>
<tr>
<td width="21">
</td>
<td width="86">Question:<%= count %></td>
</tr>
<tr>
<td></td>
<td>
<%
PreparedStatement StatementquestionRecordset = ConnquestionRecordset.prepareStatement("SELECT Question_Type, Number_Outcomes, Question_Wording FROM Answer.question WHERE Question_ID = '" +itemRecordset.getObject("Question_ID")+"' ");
ResultSet questionRecordset = StatementquestionRecordset.executeQuery();
boolean questionRecordset_isEmpty = !questionRecordset.next();
boolean questionRecordset_hasData = !questionRecordset_isEmpty;
Object questionRecordset_data;
int questionRecordset_numRows = 0;
%> <%= questionRecordset.getObject("Question_Wording") %></td>
</tr>
<tr>
<td></td>
<td>
</td>
</tr>
<tr>
<td></td>
<td>
<table>
<% while ((outcomeRecordset_hasData)&&(Repeat2__numRows-- != 0)) {%>
<tr>
<td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Number"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
<td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Text"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
<td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Score"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
<td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Feedback"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
<td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Question_ID"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
</tr>
<%
Repeat2__index++;
outcomeRecordset_hasData = outcomeRecordset.next();
%>
</table>
<table>
<tr> </tr>
<tr> </tr>
</table></td>
</tr>
<%
Repeat1__index++;
itemRecordset_hasData = itemRecordset.next();
count++;
//questionRecordset.close();
//StatementquestionRecordset.close();
//ConnquestionRecordset.close();
%>
Here is the exception i am gettingorg.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 115 in the jsp file: /delivery/session.jsp
Generated servlet error:
C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:220: cannot find symbol
symbol : variable outcomeRecordsetRecordset_data
location: class org.apache.jsp.delivery.session_jsp
out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Number"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
^
An error occurred at line: 116 in the jsp file: /delivery/session.jsp
Generated servlet error:
C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:223: cannot find symbol
symbol : variable outcomeRecordsetRecordset_data
location: class org.apache.jsp.delivery.session_jsp
out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Text"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
^
An error occurred at line: 117 in the jsp file: /delivery/session.jsp
Generated servlet error:
C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:226: cannot find symbol
symbol : variable outcomeRecordsetRecordset_data
location: class org.apache.jsp.delivery.session_jsp
out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Score"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
^
An error occurred at line: 118 in the jsp file: /delivery/session.jsp
Generated servlet error:
C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:229: cannot find symbol
symbol : variable outcomeRecordsetRecordset_data
location: class org.apache.jsp.delivery.session_jsp
out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Feedback"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
^
An error occurred at line: 119 in the jsp file: /delivery/session.jsp
Generated servlet error:
C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:232: cannot find symbol
symbol : variable outcomeRecordsetRecordset_data
location: class org.apache.jsp.delivery.session_jsp
out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Question_ID"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
^
An error occurred at line: 119 in the jsp file: /delivery/session.jsp
Generated servlet error:
Note: C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java uses or overrides a deprecated API.
An error occurred at line: 119 in the jsp file: /delivery/session.jsp
Generated servlet error:
Note: Recompile with -Xlint:deprecation for details.
An error occurred at line: 119 in the jsp file: /delivery/session.jsp
Generated servlet error:
Note: C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java uses unchecked or unsafe operations.
An error occurred at line: 119 in the jsp file: /delivery/session.jsp
Generated servlet error:
Note: Recompile with -Xlint:unchecked for details.
5 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)Hi,
Dont have much time to go through your code, but apparently i can see the error is becoz of the following reason.
In the following code, you have used "outcomeRecordset_data ", but its not declared. You need to declare the variable first before you can use it.
<% while ((outcomeRecordset_hasData)&&(Repeat2__numRows-- != 0)) {%>
<tr>
<td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Number"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
<td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Text"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
<td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Score"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
<td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Feedback"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
<td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Question_ID"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
</tr>
<%
Repeat2__index++;
outcomeRecordset_hasData = outcomeRecordset.next();
%>Try declaring the "outcomeRecordset_data " on top as an object
Hope it helps -
I've got a page where I need nested repeat regions using the
same data.
Basically, list people who have donated money in groupings by
level:
$100-$199
Murray
Nadia
Thierry
$200-$299
Dan
Dan
Patty
I'm looking at Tom Muck's "Simulated Nested Region" extension
so I can do
this using one Recordset (seems silly to set up a recordset
for each
donation level) but the only problem is it looks like the
donation levels
have to sort in order to work, and they don't.
Anyone know of any other extensions or easy ways to make this
work?
Oh yeah.....MySQL and PHP.
Thanks!
Mad DogSmellyPete wrote:
> I've got a problem with nested templates in my site. I
don't think it's an
> error or bug as such, just a really strange limitation,
that I hope there is a
> work around for.
>
> I've setup a menubar with a repeating table region in a
template. Then I laid
> out the content (editable) regions in a nested template.
The system works
> really well in dreamweaver, if you want to add a menu
item, you do so to the
> parent template, and then it filters through out the
site.
>
> The problem is that when I try to edit the pages as a
client with contribute
> (even as an administrator) it will not allow access to
edit a .dwt file, even
> if it has editable regions in it. This means I can't use
contribute to add an
> item to the menubar, because I need to be able to edit
the nested template. I'm
> sure it's possible, because a .dwt is just an .htm file
with a different hat on.
>
> There must be some way of doing this. As soon as I read
about the template
> system I immediately thought this would be one of it's
strengths, and would be
> very surprised if the contribute user were limited to
making changes on every
> individual page.
>
> PS. I'm sure someone will suggest that I just move the
repeating region into
> the nested template. I could do this, but the whole
point is that with one
> change I want it to will filter down through the whole
site. I thought maybe
> SSI might be the answer, but would that just confuse
contribute even more?
>
It seems to me the whole point of using Contribute is to keep
users from
changing basic site configurations such as the menu. Use
Dreamweaver or
one of the simple HTML editors around. -
3 level nested repeat region?
hi all,
I tried to follow the ADDT tutorial related to creatìng 3 level nested
repeat region.
All is ok and I can list all continend, countries and cities.
But, how can I show only continent and countries that have cities set and
hide all those continents and countries that do not contains any city?
Example:
EUROPE
France
Paris
Spain
Madrid
ITALY
Germany
Monaco
In this example, how can I hide the ITALY country? Or how can I hide entire
continent/countries with no city set yet?
TIA
tonyCiao Tony,
you´ll most probably just need to add the IS NOT NULL comparison function to the query´s WHERE clause, example:
WHERE city IS NOT NULL
http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
I am trying to create a simple nested repeat region and I get a mismatch error. I ran a SQL trace and it seems to not be passing the key from the master table , but rather @p1 in its place. any ideas?
I am trying to create a simple nested repeat region and I get a mismatch error. I ran a SQL trace and it seems to not be passing the key from the master table , but rather @p1 in its place. any ideas?
-
Nested repeat Region - run time var PHP
I have tried several attempts at creating a nested region
with no luck of sucess
sql & PHP
There are 2 record sets
rsProduct and
rsCourse
rsProduct
SELECT *
FROM svProductList
WHERE svProductList.productOrder
ORDER BY productOrder ASC
rsCourse
SELECT *
FROM trainingCourseTBL
WHERE trainingCourseTBL.product = colname
ORDER BY trainingCourseTBL.courseOrder ASC
colname
type numeric
default value -1
runtim value $row_rsProduct['productOrder']
Start repeat region 1
rsProduct.productName
Start repeat region 2
rsCourse.course
END repeat region 2
END Start repeat region 1
I would like to set up a run time var for the rsCourse where
I get the value from the first repeat regions productID
Can someone point me towards the right direction?On 21 May 2007 in macromedia.dreamweaver.appdev, cdembek
wrote:
> Can someone point me towards the right direction?
I don't have time for a long explanation right now, but do a
web search
for 'Nested Repeat Region'.
Joe Makowiec
http://makowiec.net/
Email:
http://makowiec.net/contact.php -
Nested Repeat Region (How to convert from table to list)
Sorry, i am really no PHP hero :-(
i created a menu with the "nested repeat region" wizzard. Now i want to change the HTML from TABLE to LIST.
I thought i just need to delete <table>- and <td>-tags, replace <tr> with <ul> and that's it. (But ist's NOT!)
This is my code:
------- START ----------------
<ul id="nav">
<?php do { ?>
<li><?php echo $row_master1waa_page_top['top_name']; ?></li>
<?php
if ($totalRows_master1waa_page_top>0) {
$nested_query_detail2waa_page_sub = str_replace("123456789", $row_master1waa_page_top['id_top'], $query_detail2waa_page_sub);
mysql_select_db($database_WAA);
$detail2waa_page_sub = mysql_query($nested_query_detail2waa_page_sub, $WAA) or die(mysql_error());
$row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub);
$totalRows_detail2waa_page_sub = mysql_num_rows($detail2waa_page_sub);
$nested_sw = false;
if (isset($row_detail2waa_page_sub) && is_array($row_detail2waa_page_sub)) {
do { //Nested repeat
?>
<ul>
<li> <?php echo $row_detail2waa_page_sub['sub_head']; ?></li>
</ul>
<?php
} while ($row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub)); //Nested move next
?>
<?php } while ($row_master1waa_page_top = mysql_fetch_assoc($master1waa_page_top)); ?>
</ul>
------- END -----
The problem is located in line 3. the result is a list like this:
<ul id="nav">
<li>xxx</li>
<li>xxx</li>
<ul>
<li>xxx</li>
<li>xxx</li>
</ul>
<li>xxx</li>
</ul>
Of course it will not work. I need the nested list inserted like this:
<ul id="nav">
<li>xxx</li>
<li>xxx
<ul>
<li>xxx</li>
<li>xxx</li>
</ul>
</li>
<li>xxx</li>
</ul>
Can someone please help me changing my code to get this result?Hi,
I had trouble replying. I may be of some assistance until one of the Guru's get on.
The whole thing works on loops based inside do and while
EX.
<?php
do{ //end php, use html
?>
I can repeat anthing here in HTML!
<?php } while ( /* some critera exist ex: i<5 */ ); ?>
so, your 'options' tag or LI' tags should only exist inside the first loop, check your { }
The entire LIST would repeat if you add the UL tags inside the nested loop area
You may find it easier to reaplace the table with div tags and then indent the sub or nested loop with a class
I don't have time to test this but try this:
<ul id="nav">
<ul>
<?php do { ?>
<li><?php echo $row_master1waa_page_top['top_name']; ?></li>
<?php
if ($totalRows_master1waa_page_top>0) {
$nested_query_detail2waa_page_sub = str_replace("123456789", $row_master1waa_page_top['id_top'], $query_detail2waa_page_sub);
mysql_select_db($database_WAA);
$detail2waa_page_sub = mysql_query($nested_query_detail2waa_page_sub, $WAA) or die(mysql_error());
$row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub);
$totalRows_detail2waa_page_sub = mysql_num_rows($detail2waa_page_sub);
$nested_sw = false;
if (isset($row_detail2waa_page_sub) && is_array($row_detail2waa_page_sub)) { ?>
<ul>
<?php do { //Nested repeat ?>
<li> <?php echo $row_detail2waa_page_sub['sub_head']; ?></li>
<?php } while ($row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub)); //Nested move next ?>
</ul>
<?php
?>
<?php } while ($row_master1waa_page_top = mysql_fetch_assoc($master1waa_page_top)); ?>
</ul>
Hit me back if its close but wonky..
J -
PHP help with nested repeat region
Hopefully someone can help me out with this one.
I basically have some SQL returning results of a search page,
where you can search on various keywords by checking boxes, and it
returns Employers that match those keywords :
mysql_select_db($database_myDatabase, $myDatabase);
if (isset($_GET['ckbox'])){
// get profile keys
$ckbox = array_keys($_GET['ckbox']);
// sql string
$sql = 'SELECT Employers.*, EmployerContacts.* FROM
EmployerContacts
INNER JOIN Employers ON EmployerContacts.EmployerID =
Employers.EmployerID
INNER JOIN EmployerProfiles ON EmployerProfiles.EmployerID =
EmployerContacts.EmployerID
WHERE EmployerProfiles.ProfileID IN(' . implode(',',
$ckbox).')
GROUP BY Employers.EmployerID
ORDER BY Employers.EmployerID DESC';
$rsContacts = mysql_query($sql) or die(mysql_error());
$row_rsContacts = mysql_fetch_assoc($rsContacts);
@$totalRows = mysql_num_rows($rsContacts);
else
echo 'You did not check any profiles.';
?>
The results are drawing fields from the Employers table and
EmployerContacts table, hopefully to look like :
Employer1
Employer1.Contact 1
Employer1.Contact 2
Employer1.Contact 3
Employer2
Employer2.Contact 1
Employer2.Contact 2
Employer2.Contact 3
etc
However, I can only seem to get it to repeat the Employers,
and show just the first Contact for each, like this :
Employer1
Employer1.Contact 1
Employer2
Employer2.Contact 1
etc
So I guess I'm looking for help with looping through the
Contacts for each Employer.
The code currently looks like this :
[code attached]
Hope that makes sense.
Many thanks.Iain71,
The DW Repeat Region cannot be nested because both loops use
the same
variable names (e.g. $RepeatSelectionCounter_1).
You will have to manually edit the code, and DW may not
recognize it
after you do, but you should be able to get it working fairly
easily. I
think that you just need to change the variable names in the
inner loop
so that they do not conflict with the similar names in the
outer loop
(e.g. rename $RepeatSelectionCounter_1 to
$RepeatSelectionCounter_2).
Does that make sense?
HTH,
Randy
> I basically have some SQL returning results of a search
page, where you can
> search on various keywords by checking boxes, and it
returns Employers that
> match those keywords : -
Hi,
I am trying to summarise the activity within a forum. The
forum contains 4 different discussion boards you can post to, and I
want to list each discussion board, along with the 5 latest threads
within each discussion board. (each thread is assigned a forumid
value which is linked to a 'forums' table containing the forum
name)
I have created a page that almost works perfectly. It is made
up 2 repeat regions: 1 for the 4 discussion boards, and another for
the threads within them. As I said, this is working almost
perfectly, but there is a problem. The second repeat region (for
the threads) is not doing the repeat for each discussion board. ie,
If I set the number of repeats to 20, it will display 20 threads
from the first forum, rather than 5 from each of the forums. If I
add 'GROUP BY forumid' to the query it returns only 1 result from
each forum.
I have attached the code - if anyone can help me out on this
I'd be really grateful - am so close and it's really frustrating!
Thanks a lotYou need to create a recordset for each discussion thread
count that is filtered by a discussionID. So you will have 4 thread
recordsets each filtered by a different discussionID. -
I am new to working with DW templates but am trying to set up
a site for a client who will edit in Contribute. I'd like to set
these up using templates so the client won't inadvertently mess up
the formatting.
However, I'm running into a problem setting up a template for
an Events listing. I need to have a repeatable region for each
month of events she will add and then inside each month, a
repeating region for each event within that month. So far, I have
not been able to make this work.
Is something like this possible? This doesn't seem that
advanced or sophisticated so perhaps I am just missing something?
Thanks for any advice."choirellie" <[email protected]> wrote in
message
news:g0fg42$o0$[email protected]..
> Maybe I wasn't explaining clearly what I mean...
>
> I haven't got the template set up yet because I can not
figure out how to
> have
> a repeating region within another repeating region.
>
> The reason I want to specifically have it in a repeating
region is to make
> it
> easier and less likely for bad formatting tags to creep
in when the client
> wants to add a new month and/or event within a month.
>
> The client ("they") is not doing anything yet - I have
merely been testing
> a
> setup that I would like to use for a client. using
pseudo code, this is
> something like what I want to do:
>
> <repeatable region1>
> non-editable formatting<editable
region>Month<end editable region>
> <repeatable region2>
> non editable formatting<editable region>Event
Details<end editable region>
> <end repeatable region2><end repeatable
region1>
>
> Does this make sense? Am I going about this the wrong
way? I would be
> very
> comfortable doing all this with server side code and
database (either
> ColdFusion or PHP) but the template business is really
throwing me.
but that repeating region info would have to come from a
database, which
would need its own form page for updates/additions/deletions,
etc... and you
said you weren't going to use a database yet... so doesn't
that boil down to
"why do a repeating region" since they're going to manually
enter it anyway? -
Nested repeat region - multiple email recipients
Basically what I'm trying to do is to send a email made up of a dynamic table to some email recipients (5-20) from a database table.
This seemed like the right way to do it, but doesn't work correctly. The first email is sent correctly to the first email recipient. The second email is sent to the second recipient, but without any of the dynamic table.
My question is: How to make so that the dynamic info gets sent to every person. Is there a better way to have the "send email" function repeat?
It feels like I'm really close to a working solution, but have been struggling with this for a few hours without making any progress. Any help is greatly appreciated!
<?php do { ?>
<?php
$sectemailObj = new tNG_EmailPageSection();
$sectemailObj->getCSSFrom(__FILE__);
$sectemailObj->setTo("{grain_closing_bids.email}");
$sectemailObj->setFrom("[email protected]");
$sectemailObj->setSubject("Closing Grain bids");
$sectemailObj->setFormat("HTML/Text");
$sectemailObj->setEncoding("ISO-8859-1");
$sectemailObj->setImportance("Normal");
$sectemailObj->BeginContent();
?>
<p>Here's today's Closing Grain Bids.</p>
<table width="400" border="0" cellpadding="3" cellspacing="0">
<tr>
<td></td>
<td><h5><strong>Nearby Price</strong></h5></td>
<td><h5><strong>Price Change</strong></h5></td>
<td><h5><strong>Price on</strong></h5></td>
<td><h5><strong>New Crop</strong></h5></td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_grain['title']; ?></td>
<td>$<?php echo $row_grain['price']; ?></td>
<td><?php echo $row_grain['price_change']; ?></td>
<td><?php echo $row_grain['price_on']; ?></td>
<td>$<?php echo $row_grain['new_crop']; ?></td>
</tr>
<?php } while ($row_grain = mysql_fetch_assoc($grain)); ?>
</table>
<?php
$sectemailObj->EndContent();
$sectemailObj->Execute();
?> <?php } while ($row_grain_closing_bids = mysql_fetch_assoc($grain_closing_bids)); ?>The emails get sent correctly. It's the repeating region in the email content that doesn't show after the first email. I think I may not have communicated what my problem is, as well as I could have.
The first email looked like this:
Nearby Price
Price Change
Price on
New Crop
Corn
$4.34
+0.16
06/05/09
$4.27
Hard Wheat
$6.25
+0.18
06/05/09
$
Milo
$3.79
+0.16
06/05/09
$
Oats
$2.00
+0.00
06/05/09
$
Soybeans
$12.00
+0.46
06/05/09
$9.97
the following emails look like this:
Nearby Price
Price Change
Price on
New Crop
$
$
Anyway, I fixed the problem when I inserted this code:
<?php
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
?>
This makes so the <tr> repeats again and again, not just in the first email.
Thanks for your help! Your replies were very helpful! -
Nested templates - problems with inheriting editable/repeating regions
I have made a template called 'basic', with 2 sections, 'maincontent' and 'sidecontent' then nested a template in it called 'home'. In 'home', I have made repeats of some regions (sidecontent) and edited them to make a section I want on all 'home' type pages. When I make a new document from 'basic', it has all the same editable and repeating regions as 'basic'. But when I make a new document from 'home' there are no editable or repeating regions, either in 'sidecontent' which I edited or 'maincontent' which I didn't. I want to be able to edit 'maincontent' when I make a new document from 'home', to make repeating regions and edit them. Please can you advise me what to do?
ThanksWhen I tried to attach the files it automatically zipped them again, so I have put the code above.
Thanks,
Rachel -
Nesting Template w/ Repeating Regions
I'm new to Dreamweaver so please bare with me. I am setting
up a nested template. On my first level template I have some
editable regions and some repeating regions that also have an
editable region inside. On the second level template I created some
more editable regions. I then create my actual html page from the
second level template, and on that page the editable regions are
ok, but the I don't have access to the repeating regions from the
first level template - they are static. Is that working as
expected? Is there any way I can make my repeating regions
pass-though also?
Thanks,
KenIf you don't use nested templates, you never have to face
such mind-bending
issues. I have not yet found a scenario where I needed to use
nested
templates....
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"kldjsflksjfkljs" <[email protected]> wrote
in message
news:g43ebd$hni$[email protected]..
> Well, I figured out my problem. Part of the problem was
me just being
> stupid
>
. But in case anyone else ever wonders, the repeating
> region
> code cannot go in the master template. It must go in an
editable region of
> a
> template that the page is based directly on. As far as I
can tell there is
> no
> way to make it pass-through in the same way as you can
with optional
> regions.
> Too bad, I think. But hopefully I can work with it for
now.
>
Maybe you are looking for
-
BOE 3.1 Service Pack 2 SDK changes
We are getting ready to install Service Pack 2 in our BOE 3.1 environment. In a test VM I have installed the SP and noticed that the dsws.jar files that are in the SDK directory (common\4.0\java\lib) are, in general, older than the dsws..jar file th
-
Secondary Method Not Invoked - Possible String Length Connection ?
We have a workflow exhibiting a problem that, after much unlayering, can best be be distilled as follows. A variable of type string exists in the work flow container, and its parameters are set for import/export. A variable of type string exists in t
-
Iphone 4s screen is black, phone is on, wont connect to itunes
A couple of days ago, I dropped my phone in the toilet. I got it out in about three seconds, dried it off and put it in a bag of rice for 40 hours.When I took it out of the rice, I plugged it in to my charger, it showed that it was charging and then
-
How to reduce the cloning time if using cold backup?
Hi, We are using EBS r12 (12.0.6) with database 10.2.0.3 in Linux Redhat 4 32-bit envoirnment. Our datbase size is around 480 GB and we are facing the issues to provide the clone to my consultants for meet the target timelines in given time. (Source:
-
Exit for ke26 ....
Hi Gurus, Using a Program for finding exits with transaction code. i found out that for Transaction KE26 there is an Exit Function Module:EXIT_SAPLKEII_002. And i have written codings . but when i tried to test it the exit is not triggered when i tr