about validation of a page with "repeating" elements

Maybe it’s not that important, maybe I just must forget about this. But, as newbe in CSS and dynamic sites I want to be sure that what I build is acceptable. And since FW is such a great tool that I’m proud of to use, I want to do everything to create pages that are “better :-)” than so many others.
OK, so far my motivation.

Please have a look at:
http://www.monumentmaker.nl/tempindex.php

and then the validation of that page:

They say:

An “id” is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).

In my FW document, this element is filled with code (tags) that pull info from the database. Hence the repetition in the final HTML output.

Is there a way to avoid the error and keep the seperate elements in the output?

Again, if it’s not such a big deal, then I forget about it, but I just wanted to know.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

As the validator stated, the only way to avoid this problem is to give each element a unique id name. You can’t have 5 different elements on the same page all named “item5”.

Todd

On Mar 22, 2008, at 7:45 AM, atelier wrote:

Is there a way to avoid the error and keep the seperate elements in the output?

Again, if it’s not such a big deal, then I forget about it, but I just wanted to know.

I know. But I have no control over these elements. It’s a dynamic page. So if the user asks for ten objects, they get ten objects, all with the same id name. That’s my problem.

The validation service speaks about class. Is there the solution? How do I do that?


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It refers to attaching a class style to an element. For example, in FW if you drew an element (div) you could select that item and apply a class style to it. This is what they mean by using a class to group items (of different names). You could then target that class style and all the elements it’s been attached to for whatever purpose you need. How this helps you in this particular case I can’t say, I’ll have to think about it some more. Sorry I can’t be of more help at the moment.

Todd

On Mar 22, 2008, at 10:47 AM, atelier wrote:

The validation service speaks about class. Is there the solution? How do I do that?

Sure. Generate unique IDs for your elements as part of your template
code.

Here’s a very artificial example: Let’s say you have a fragment for a
table row that you iterate over to generate the elements on your page:

<tr id="row_1"><td>$column1</td><td>$column2</td></tr>

And you have that inside a loop, like this:

foreach($result as $row){
	$column1 = $row->column1;
	$column2 = $row->column2;
	$output .= (template code here...);
}

Then you can see that you will end up with count($result) copies of
the ID row_1.

There’s a simple answer to this, and it’s just to extend your
template so that you replace row_1 in each turn of the loop with some
unique number. In all of my database layouts, I follow the Rails
convention of making the first column an integer, auto-number, called
‘id’. So I would simply change the template to be:

<tr id="row_$id"><td>$column1</td><td>$column2</td></tr>

And get my guaranteed unique auto-number in there. Problem solved.

What if you are not pulling from a database, you ask…

$i = 0;
foreach ($foo as $bar){
	$i++;
	$out .= '<div id="bar_' . $i . '">' . $bar->img . '</div>';
}

And again, presto, instant unique ID at the page level.

Walter

On Mar 22, 2008, at 8:45 AM, atelier wrote:

In my FW document, this element is filled with code (tags) that
pull info from the database. Hence the repetition in the final HTML
output.

Is there a way to avoid the error and keep the seperate elements in
the output?


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This sounds great to me, I even understand the principle.
Next question, how to implement that in FW?

In my case: table cell with EE tag that codes for a particular weblog, inside this cell an HTML element (border dotted, some margin backgroundcolour) with EE tags that pull data.

Where do I put your “id repetition formula” ?

(exciting if this is gonna work!)


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

There should be an EE tag that corresponds to the unique id. EE uses
a fairly Rails-like code base under the hood. I would use Source Code
Snooper on the page fragment that you are using as your template to
insert this tag in place of the Freeway-generated ID. Remember to
always begin an ID with a letter, never a number. The ID in the
database will be a number, hence the ‘row_’ . $id (string
concatenation) construct I used in my example.

Walter

On Mar 22, 2008, at 12:18 PM, atelier wrote:

This sounds great to me, I even understand the principle.
Next question, how to implement that in FW?

In my case: table cell with EE tag that codes for a particular
weblog, inside this cell an HTML element (border dotted, some
margin backgroundcolour) with EE tags that pull data.

Where do I put your “id repetition formula” ?

(exciting if this is gonna work!)


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Just to clarify, never begin an HTML ID with anything except a letter.

Walter

On Mar 22, 2008, at 12:27 PM, Walter Lee Davis wrote:

Remember to
always begin an ID with a letter, never a number. The ID in the
database will be a number, hence the ‘row_’ . $id (string
concatenation) construct I used in my example.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

So, if I understand you well, in my example of this particular cell with the EE tags:

{exp:weblog:entries weblog="nieuws" limit="5"}

{title}

{samenvatting}

--->

{/exp:weblog:entries}

I must replace item 5 with …?
(sorry if I sound ignorant, because I am)


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Replace item5 with anything unique. Sorry, I don’t know EE tags at all. There’s got to be something suitable in there, maybe it’s as easy as row_{id} or something like that.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Oh, duh. Just realized something even easier. IF you can, just remove the ID. There’s no rule that says you need one on every DIV. Freeway won’t let you do this, but you can do it easily with SCS or a text editor. I’m not sure if you are generating your template entirely in Freeway, or if you have to cut it up afterward and make the template in the EE Web control panel. I haven’t used EE, only pMachine, and that quite some time ago.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I make the template completely in FW. and have it uploaded. EE is tweaked to follow just that template (as file on the server). All this thanks to EE tags action of Joe Muscara.

I’ll try this, take away the id by hand (TextWrangler) and manually upload the altered file. I’ll be back.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sorry to say that it did not work.
I made three attempts.
1): <div id=“”
2): <div id=
3): < (took div id completely away)

So, as you mentioned, maybe is the trick to replace XXX in <div id=“XXX” by an id that adds up.

That formula, should I put that somewhere in the raw HTML code?

(thanks for answering, appreciate your help very much)


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Completely untested, but give it a try anyway:

http://freewaypro.com/actions/downloads/Anonymous.fwaction

Apply this to the DIV you wish to be without an ID. It will remove
the ID from a TD or DIV, if one is present.

Walter

On Mar 22, 2008, at 1:41 PM, atelier wrote:

Sorry to say that it did not work.
I made three attempts.
1): <div id=“”
2): <div id=
3): < (took div id completely away)

So, as you mentioned, maybe is the trick to replace XXX in <div
id=“XXX” by an id that adds up.

That formula, should I put that somewhere in the raw HTML code?

(thanks for answering, appreciate your help very much)


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Waltd? Kan I please keep Anonymous?

It works.

Yes, it works! I’m flabbergasted. Awesome.
This is good news!

What can I say, thank you…


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sure, as all of my Actions are, free to share.

Walter

On Mar 22, 2008, at 2:03 PM, atelier wrote:

Waltd? Kan I please keep Anonymous?

It works.

Yes, it works! I’m flabbergasted. Awesome.
This is good news!

What can I say, thank you…


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options