Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
maguskrool #1
Spry xml data set, accessing specific rows
Hello. I've been trying to build a website using Spry XML Data Sets, and while
I've accomplished my goals for now, I don't think the solution I came up with
is the best.
The website consists of several areas that show projects. Each project has
several fields that are to be filled with content retrieved from the xml files,
but the projects are not all exactly alike and some have specific fields that
others don't require.
All the info is available in several languages, so for now I've created an xml
file for each one. An xml file could be like Code Part1. (Why I can't add
several code snippets along the post baffles me. I mean, I can't, right?)
This dataset, for simplicity purposes, is not dependent on the language (Code
Part2).
And then there are the content areas (Code Part3).
So as you see, each project has its own structure. This makes using
spry:repeat a not very effective method for filling in all the content. Ideally
I should be able to access each row in the dataset through some sort of value,
like id, or one of its children's values. The ds_RowID depends on the row
order, so unless there's another way to use it, it doesn't solve my problem.
Here's what I've come up with (Code Part4).
This works (in FF3 OSX, at least), although there are some other problems that
might make it necessary to create a spry:region (or at least use spry:repeat)
for each field. Anyway, it sounds silly and wasteful to go through every row of
the dataset everytime for each of the fields that need to be filled.
My hope is that I'm ignorant of some much better method of achieving my goals,
something more direct and elegant.
Can anyone help me out with this? Thank you very much in advance.
Code Part1
projects.xml:
<project_list>
<project name="proj1">
<title>project one</title>
<date>2008</date>
<slogan>project one is great</slogan>
</project>
<project name="proj2">
<title>project two</title>
<date>2008</date>
<team>team alpha</team>
<description>it was something we did</description>
</project>
</project_list>
- - - - -
Code Part2
var dsProjects = new Spry.Data.XMLDataSet("projects.xml",
"project_list/project");
- - - - -
Code Part3
<div id="proj1">
<p>title goes here</p>
<div id="gallery">
(...gallery)
</div>
<p>date goes here</p>
<div id="pub">
(...banner)
<p>slogan goes here</p>
</div>
</div>
<div id="proj2">
<p>title goes here / date goes here</p>
<div id="team stuff">
<p>team goes here</p>
<div>
<p>description goes here</p>
</div>
</div>
</div>
- - - - -
Code Part4
<div id="proj1" spry:region="dsProjects" spry:repeat="dsProjects">
<p spry:if="'{@id}'=='proj1'">{title}</p>
(same method for each other element I need to retrieve from the xml dataset)
</div>
maguskrool Guest
-
Spry Data Set
Hello, I'm trying to populate a web page table using a Spry data set. One of the XML row elements is a hyperlink to PDF files. The table... -
Disabling specific rows in datagrid
Any help is appriciated with this problem. Thanks in advance. I have a datagrid based off a set of data which returns a column called "edit".... -
Deleting specific rows from a returned query result
I execute a <cfquery> statement block, and that works fine. However, I need to manipulate the return query rows by deleting the ones that do not... -
Total Rows and count of specific instance in one read
Is it possible to get the total number of rows and specify where clause in the same stored procedure. For instance, I am trying to get the the... -
Finding Specific Data
I have a table that contains 17 different data fields that contain either an "A", "P", or "NA". I need to create a report that lists all the...



Reply With Quote

